body {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.login-stage {
  position: relative;
  width: calc(1447px * var(--app-scale, 1));
  height: calc(1087px * var(--app-scale, 1));
  overflow: visible;
}

.login-page {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1447px;
  height: 1087px;
  aspect-ratio: 1447 / 1087;
  display: flex;
  flex-direction: column;
  transform: translate(-50%, -50%) scale(var(--app-scale, 1));
  transform-origin: center center;
  background: url("./assets/login.webp") left center / cover no-repeat;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.login-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  z-index: 10;
}

.login-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-header .brand-mark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
}

.login-header .brand-text strong {
  display: block;
  font-size: 34px;
  color: #cb4d16;
  line-height: 1;
}

.login-header .brand-text small {
  display: block;
  max-width: none;
  margin-top: 6px;
  color: #4b4f54;
  font-size: 18px;
  line-height: 1.18;
  white-space: nowrap;
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  color: #5a554f;
  font-size: 15px;
  cursor: pointer;
}

.login-body {
  flex: 1;
  display: flex;
  position: relative;
  padding: 0 40px 20px;
}

.login-character-area {
  flex: 1;
  display: flex;
  align-items: flex-end;
  padding-bottom: 60px;
  position: relative;
}

.speech-bubble {
  position: absolute;
  left: 35%;
  top: 55%;
  padding: 16px 24px;
  border: 2px solid #c4b49a;
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.25);
  backdrop-filter: blur(2px);
  font-size: 22px;
  line-height: 1.7;
  color: #3a3530;
  max-width: 320px;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  left: -12px;
  top: 65%;
  transform: translateY(-50%);
  border: 10px solid transparent;
  border-right-color: #c4b49a;
}

.login-form-card {
  width: 480px;
  align-self: center;
  padding: 44px 42px 36px;
  border: 1px solid #f1e3cf;
  border-radius: 28px;
  background: rgba(255, 253, 250, 0.95);
  box-shadow: 0 18px 44px rgba(139, 103, 45, 0.16);
  z-index: 10;
}

.login-step {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#verifyStep {
  gap: 22px;
}

.login-step[hidden],
.login-field[hidden],
.login-error[hidden],
.login-tabs[hidden],
.login-reset-head[hidden],
.login-links[hidden],
.login-link[hidden],
.login-resend[hidden] {
  display: none;
}

/* 登入、註冊兩個標題切換 */
.login-tabs {
  display: flex;
  gap: 32px;
  margin: 0 0 6px;
}

.login-tab {
  position: relative;
  padding: 0 0 8px;
  border: 0;
  background: transparent;
  color: #b3a998;
  font-size: 36px;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
}

.login-tab.active {
  color: #2d2b2b;
  cursor: default;
}

.login-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #ffa24d, #e26d2d);
}

.login-reset-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-reset-head h1 {
  margin: 0;
}

.login-links {
  display: flex;
  justify-content: space-between;
  margin-top: -6px;
}

.login-link {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b4501f;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.login-link:hover {
  color: #8f3a16;
}

.login-step h1 {
  margin: 0 0 6px;
  font-size: 36px;
  font-weight: 900;
  line-height: 1.2;
  color: #2d2b2b;
}

#verifyStep h1 {
  margin: 0;
}

.login-field {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 18px;
  border: 1.5px solid #ead9c4;
  border-radius: 16px;
  background: #fffdf8;
  transition: border-color 0.2s;
}

.login-field:focus-within {
  border-color: #f0c4a2;
}

.login-field-prefix {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-right: 16px;
  border-right: 1.5px solid #ead9c4;
  color: #2d2b2b;
  font-size: 22px;
  font-weight: 700;
}

.login-field-icon {
  flex: none;
  color: #b4501f;
}

.login-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #2d2b2b;
  font-size: 22px;
  font-weight: 500;
}

.login-field input::placeholder {
  color: #a39a8e;
}

.login-error {
  margin: -8px 0 0;
  color: #b3261e;
  font-size: 16px;
  line-height: 1.4;
}

.login-btn {
  width: 100%;
  height: 62px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffa24d, #e26d2d);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  border: none;
  box-shadow: 0 8px 18px rgba(226, 109, 45, 0.28);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(226, 109, 45, 0.3);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.login-consent {
  margin: 0;
  color: #5f574c;
  font-size: 16px;
  text-align: center;
}

/* 中文直接連寫《使用條款》《私隱政策》，英文中間加 and */
html:not([lang="en"]) .login-consent-and {
  display: none;
}

.login-consent button {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b4501f;
  font: inherit;
  cursor: pointer;
}

.login-consent button:hover {
  color: #8f3a16;
  text-decoration: underline;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  color: #6f675c;
  font-size: 16px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ead9c4;
}

.login-apple {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #4d463d;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.login-apple-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1f1d1a;
}

.login-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b4501f;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.login-back:hover {
  color: #8f3a16;
}

.login-target {
  margin: 10px 0 0;
  color: #5f574c;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.login-code {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  border: 0;
}

.login-code input {
  width: 58px;
  height: 68px;
  padding: 0;
  border: 1.5px solid #ead9c4;
  border-radius: 16px;
  background: #fffdf8;
  color: #2d2b2b;
  font-size: 30px;
  font-weight: 800;
  text-align: center;
}

.login-code input:focus {
  outline: none;
  border: 2px solid #ff7a2f;
  background: #fff4ec;
}

.login-resend {
  align-self: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: #b4501f;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.login-resend:disabled {
  color: #8e877c;
  cursor: default;
}

.login-turnstile {
  display: flex;
  justify-content: center;
}

.login-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 16px 40px;
  color: #000000;
  font-size: 18px;
}

.login-footer a,
.footer-link-btn {
  color: #000000;
  text-decoration: none;
}

.footer-link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  font: inherit;
  cursor: pointer;
}

.login-footer a:hover,
.footer-link-btn:hover {
  text-decoration: underline;
}

.footer-divider {
  color: #d4c4a8;
}

.info-dialog.hidden {
  display: none;
}

.info-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.info-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 35, 24, 0.42);
  backdrop-filter: blur(3px);
}

.info-dialog-card {
  position: relative;
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: rgba(255, 252, 246, 0.98);
  border: 2px solid #eadcc5;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(64, 48, 24, 0.28);
  padding: 34px 40px 36px;
  color: #2d261b;
}

.info-dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff3df;
  color: #6d5a3a;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.info-dialog-close:hover {
  background: #ffe3b6;
}

.info-dialog-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff1d8;
  color: #bb6b20;
  font-size: 28px;
  margin-bottom: 14px;
}

.info-dialog-card h2 {
  margin: 0 0 16px;
  font-size: 28px;
  color: #2d261b;
}

.info-dialog-body {
  font-size: 17px;
  line-height: 1.8;
  color: #514532;
}

.info-dialog-body p {
  margin: 0 0 12px;
}

.info-dialog-body h3 {
  margin: 20px 0 8px;
  font-size: 20px;
  color: #8f3a16;
}

.info-dialog-body ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.info-dialog-body ol {
  margin: 0 0 14px;
  padding-left: 24px;
}

.info-dialog-body li {
  margin: 6px 0;
}

.info-dialog-body dl {
  margin: 0 0 16px;
}

.info-dialog-body dt {
  margin-top: 10px;
  color: #2d261b;
  font-weight: 800;
}

.info-dialog-body dd {
  margin: 4px 0 0;
}

.info-dialog-body a {
  color: #0f7bbf;
  font-weight: 700;
}

.info-dialog-body .doc-note {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #eadcc5;
  border-radius: 8px;
  background: #fff7e8;
  color: #5b4b33;
}

/* Proportional scaling - maintains fixed layout ratio */
@media (max-width: 1447px), (max-height: 1087px) {
  .login-stage {
    width: calc(1447px * var(--app-scale, 1));
    height: calc(1087px * var(--app-scale, 1));
  }

  .login-page {
    transform: translate(-50%, -50%) scale(var(--app-scale, 1));
  }
}
