:root {
  --gold: #e8c56b;
  --gold-2: #c9a24a;
  --line: #06c755;
  --ink: #f4efe6;
  --muted: rgba(244, 231, 217, 0.78);
  --panel: #2a1548;
  --panel-2: #1a0d30;
  --field: #161122;
  --stroke: rgba(216, 180, 90, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: #12081c;
  color: var(--ink);
  font-family: "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", "PingFang SC", "Hiragino Sans", "Yu Gothic", sans-serif;
}
body {
  min-height: 100svh;
  background:
    linear-gradient(180deg, rgba(8,4,16,0) 0%, rgba(8,4,16,0.08) 70%, rgba(8,4,16,0.28) 100%),
    url("/assets/bg-h5.jpg") center top / cover no-repeat #12081c;
  overflow-x: hidden;
}

/* .stack / .home / .card 的 display:flex 会盖掉 UA 对 hidden 属性的 display:none，必须强制隐藏 */
[hidden] {
  display: none !important;
}

.stage {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 96px 18px calc(16px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  position: relative;
}

.card {
  position: relative;
  width: 100%;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(86, 42, 130, 0.35), transparent 55%),
    linear-gradient(180deg, #331a58 0%, #241240 45%, #1a0d30 100%);
  border: 2px solid rgba(212, 168, 74, 0.85);
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(80, 40, 20, 0.45),
    0 18px 40px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 220, 140, 0.12),
    inset 0 0 48px rgba(20, 8, 40, 0.35);
  padding: 86px 22px 26px;
  overflow: visible;
}
.card::before,
.card::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(212, 168, 74, 0.9);
  pointer-events: none;
  z-index: 1;
}
.card::before {
  top: 10px;
  left: 10px;
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 6px;
}
.card::after {
  top: 10px;
  right: 10px;
  border-left: 0;
  border-bottom: 0;
  border-top-right-radius: 6px;
}

.brand {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -52%);
  width: 82%;
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.logo-jast {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4));
}
.logo-pc { display: none; }
.logo-h5 { display: block; }

.card-body { width: 100%; }
.panel, .home { width: 100%; }
.stack, .home { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.field { display: block; width: 100%; }
.field input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(40, 28, 58, 0.9);
  border-radius: 10px;
  background: var(--field);
  color: #f7f1e6;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35);
}
.field input::placeholder { color: rgba(196, 186, 210, 0.55); }
.field input:focus { border-color: rgba(232, 197, 107, 0.7); }

.agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  padding: 2px 2px 4px;
}
.agree input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: none;
  border: 1.5px solid rgba(230, 220, 240, 0.75);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
}
.agree input:checked {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 2px #2a1548;
}
.agree a { color: #f0d78a; text-decoration: underline; }

/* Image buttons (Login / LINE / Register) keep label text in the DOM for i18n + tests */
.btn-gold,
.btn-line,
.btn-register {
  appearance: none;
  border: 0;
  cursor: pointer;
  color: transparent;
  font-size: 1px;
  line-height: 0;
  text-indent: 0;
  overflow: hidden;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-gold span,
.btn-line span,
.btn-register,
.line-icon { color: transparent; }

.btn-gold {
  width: 100%;
  height: 64px;
  background-image: url("/assets/login-btn-m.png");
  filter: drop-shadow(0 6px 14px rgba(200, 110, 20, 0.35));
}
.btn-gold:active,
.btn-line:active,
.btn-register:active,
.btn-orange:active { filter: brightness(0.94); transform: translateY(1px); }

.btn-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.btn-line,
.btn-register {
  width: 100%;
  height: 52px;
}
.btn-line { background-image: url("/assets/line-btn-m.png"); }
.btn-register { background-image: url("/assets/register-btn-m.png"); }
.line-icon { width: 0; height: 0; opacity: 0; overflow: hidden; }

.forgot {
  align-self: center;
  text-decoration: underline !important;
  text-underline-offset: 3px;
  font-size: 14px !important;
  color: #f3efe6 !important;
  padding: 4px 0 2px;
  letter-spacing: 0.02em;
}

.text-link {
  background: none;
  border: 0;
  color: rgba(244, 231, 217, 0.9);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  align-self: center;
}
.hint { color: #f3c27a; font-size: 12px; min-height: 1.2em; text-align: center; }

.btn-orange {
  appearance: none;
  width: 100%;
  height: 50px;
  border: 2px solid #f0c56a;
  border-radius: 999px;
  cursor: pointer;
  color: #fff8ee;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f3b24a 0%, #e08920 48%, #c45e12 100%);
  box-shadow: 0 0 16px rgba(232, 150, 40, 0.4), inset 0 1px 0 rgba(255,255,255,0.35);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.btn-orange.slim { height: 46px; font-size: 15px; letter-spacing: 0.04em; }
.btn-orange.start { margin-top: 8px; }

.btn-dark, .btn-mini {
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(36, 22, 58, 0.95);
  color: var(--gold);
  cursor: pointer;
  white-space: nowrap;
  font: inherit;
}
.btn-mini { height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12px; }

.code-row { display: flex; gap: 8px; width: 100%; align-items: stretch; }
.code-row .grow { flex: 1; }

.welcome {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.ref-card {
  border: 1px solid rgba(216, 180, 90, 0.28);
  border-radius: 12px;
  padding: 12px;
  background: rgba(10, 6, 20, 0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ref-label { font-size: 11px; color: var(--gold); }
.ref-row { display: flex; gap: 8px; align-items: center; }
.ref-val {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: #f7f1e6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ref-val.link { font-size: 11px; }
.subs { list-style: none; font-size: 12px; color: var(--muted); padding: 0; }
.subs li { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }

.langs {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 16px;
  padding-bottom: 4px;
}
.langs a {
  flex: 1;
  max-width: 140px;
  height: 48px;
  background: url("/assets/lang-cn-m.png") center / contain no-repeat;
  color: transparent;
  font-size: 1px;
  overflow: hidden;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35));
}
.langs a[href="/cn"] { background-image: url("/assets/lang-cn-m.png"); }
.langs a[href="/jp"] { background-image: url("/assets/lang-jp-m.png"); }
.langs a[href="/kr"] { background-image: url("/assets/lang-kr-m.png"); }
.langs a.on { filter: drop-shadow(0 0 8px rgba(232, 197, 107, 0.55)); transform: translateY(-1px); }

dialog {
  border: 2px solid rgba(212, 168, 74, 0.7);
  border-radius: 16px;
  padding: 0;
  background: #1e1236;
  color: var(--ink);
  width: min(520px, calc(100vw - 32px));
  max-height: 80svh;
}
dialog::backdrop { background: rgba(6, 2, 12, 0.62); }
dialog article { padding: 16px 18px 20px; }
dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
dialog h2 { font-size: 16px; color: var(--gold); }
.doc-body { white-space: pre-wrap; font-size: 13px; line-height: 1.7; color: var(--muted); max-height: 60svh; overflow: auto; }

@media (min-width: 900px) {
  body {
    background:
      linear-gradient(180deg, rgba(8,4,16,0) 0%, rgba(8,4,16,0.05) 75%, rgba(8,4,16,0.22) 100%),
      url("/assets/bg-pc.jpg") center / cover no-repeat #12081c;
    overflow: hidden;
  }
  .stage {
    max-width: none;
    width: 100%;
    justify-content: center;
    padding: 4vh 24px 3vh;
  }
  .card {
    width: min(1120px, 88vw);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding: 36px 42px 36px 28px;
    min-height: 480px;
    border-radius: 26px;
  }
  .brand {
    position: static;
    transform: none;
    width: 42%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px 12px 8px;
  }
  .logo-h5 { display: none; }
  .logo-pc { display: block; width: 92%; max-width: 460px; }
  .card-body {
    width: 58%;
    display: flex;
    align-items: center;
  }
  .stack, .home { gap: 12px; }
  .field input { height: 48px; border-radius: 11px; }
  .btn-gold {
    height: 72px;
    background-image: url("/assets/login-btn.png");
  }
  .btn-line,
  .btn-register { height: 58px; }
  .btn-line { background-image: url("/assets/line-btn.png"); }
  .btn-register { background-image: url("/assets/register-btn.png"); }
  .langs {
    width: min(720px, 70vw);
    margin-top: 22px;
    gap: 16px;
  }
  .langs a {
    max-width: 220px;
    height: 58px;
  }
  .langs a[href="/cn"] { background-image: url("/assets/lang-cn.png"); }
  .langs a[href="/jp"] { background-image: url("/assets/lang-jp.png"); }
  .langs a[href="/kr"] { background-image: url("/assets/lang-kr.png"); }
  .agree { font-size: 12px; }
}
