/* ============================================================
   หน้าเข้าสู่ระบบ — ประตูเกราะสองฝั่ง
   ซ้าย: ผนังรังผึ้งเคลื่อนไหว + ตัวเลขสถานะ
   ขวา: แผงล็อกอิน/สมัครสมาชิก
   ============================================================ */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- ฝั่งซ้าย ---------- */

.stage {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 64px 56px;
  background: linear-gradient(150deg, #0a1a12, #040b07 72%);
  border-right: 1px solid var(--gold-line);
}

#lattice {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 30% 40%, transparent 30%, rgba(4, 11, 7, 0.86) 100%);
}

.stage__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 520px;
}

.stage__brand {
  animation: fadeup 0.6s ease both;
}

.stage__rule {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), rgba(216, 180, 81, 0.05));
  transform-origin: left;
  animation: draw 0.9s 0.15s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.stage__headline {
  font-family: var(--font-ui);
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: #f1f6f0;
  animation: fadeup 0.6s 0.1s ease both;
}

.stage__headline em {
  font-style: normal;
  color: var(--gold-bright);
}

.stage__lede {
  margin: 0;
  max-width: 44ch;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-dim);
  animation: fadeup 0.6s 0.18s ease both;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--gold-line);
  background: rgba(6, 15, 10, 0.55);
  backdrop-filter: blur(3px);
  animation: fadeup 0.6s 0.26s ease both;
}

.hud__cell {
  padding: 16px 18px;
  border-right: 1px solid rgba(216, 180, 81, 0.14);
}

.hud__cell:last-child {
  border-right: 0;
}

.hud__k {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.hud__v {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.hud__v small {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
}

.hud__cell--live .hud__v {
  color: var(--emerald);
}

.hud__note {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ---------- ฝั่งขวา ---------- */

.gatewrap {
  display: grid;
  place-items: center;
  padding: 48px 34px;
  background: linear-gradient(200deg, #08120d, #050c09);
}

.gate {
  position: relative;
  width: min(408px, 100%);
  padding: 32px 30px 28px;
  background: linear-gradient(168deg, #0f2318, #081310);
  border: 1px solid var(--gold-line);
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.62);
  animation: fadeup 0.5s 0.06s ease both;
}

.gate.is-shaking {
  animation: shake 0.4s ease;
}

.gate__corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid var(--gold);
  pointer-events: none;
}

.gate__corner:nth-child(1) {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.gate__corner:nth-child(2) {
  top: -1px;
  right: -1px;
  border-left: 0;
  border-bottom: 0;
}

.gate__corner:nth-child(3) {
  bottom: -1px;
  left: -1px;
  border-right: 0;
  border-top: 0;
}

.gate__corner:nth-child(4) {
  bottom: -1px;
  right: -1px;
  border-left: 0;
  border-top: 0;
}

.gate__sigil {
  width: 58px;
  height: 64px;
  margin: 0 auto 14px;
  display: block;
}

.gate__title {
  text-align: center;
  font-size: 19px;
  font-weight: 600;
}

.gate__sub {
  margin: 5px 0 22px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ---------- แท็บสลับฟอร์ม ---------- */

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(216, 180, 81, 0.18);
}

.tab {
  padding: 10px 4px 12px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-faint);
  background: none;
  border: 0;
  transition: color 0.18s ease;
}

.tab:hover {
  color: var(--ink-dim);
}

.tab.is-active {
  color: var(--gold-bright);
}

.tabs__ink {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 50%;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
  transition: transform 0.24s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.tabs__ink[data-at='1'] {
  transform: translateX(100%);
}

/* ---------- ช่องกรอก ---------- */

.gateform[hidden] {
  display: none;
}

.gateform .field {
  margin-bottom: 14px;
}

.inputwrap {
  position: relative;
  display: flex;
  align-items: center;
}

.inputwrap svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  stroke: var(--ink-faint);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 0.15s ease;
}

.inputwrap input {
  width: 100%;
  padding-left: 38px;
}

.inputwrap:focus-within svg {
  stroke: var(--gold);
}

.peek {
  position: absolute;
  right: 6px;
  padding: 6px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  background: none;
  border: 0;
}

.peek:hover {
  color: var(--gold);
}

.hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}

.hint--warn {
  color: var(--gold);
}

.hint[hidden] {
  display: none;
}

/* ---------- ปุ่มหลักแบบมีแสงกวาด ---------- */

.btn--sweep {
  position: relative;
  overflow: hidden;
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.btn--sweep::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s ease;
}

.btn--sweep:hover::after {
  left: 125%;
}

/* ---------- ข้อความแจ้งผล ---------- */

.note {
  margin: 0 0 16px;
  padding: 10px 13px;
  font-size: 13px;
  border-radius: 2px;
  line-height: 1.5;
}

.note[hidden] {
  display: none;
}

.note--error {
  color: #ffbcae;
  background: rgba(196, 87, 63, 0.14);
  border: 1px solid rgba(196, 87, 63, 0.42);
}

.note--ok {
  color: #a7ecc9;
  background: rgba(53, 184, 122, 0.12);
  border: 1px solid rgba(53, 184, 122, 0.4);
}

/* ---------- บัตรบัญชีทดลอง ---------- */

.keycard {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(216, 180, 81, 0.14);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keycard__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.keycard__row b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--gold);
}

.keycard__row .tag {
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.keycard__row .tag:hover {
  color: var(--gold-bright);
  border-color: var(--gold-line-hi);
}

/* ---------- จังหวะเคลื่อนไหว ---------- */

@keyframes fadeup {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes draw {
  from {
    transform: scaleX(0);
  }
}

@keyframes shake {
  20% {
    transform: translateX(-7px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage__brand,
  .stage__rule,
  .stage__headline,
  .stage__lede,
  .hud,
  .gate {
    animation: none;
  }

  .gate.is-shaking {
    animation: none;
    border-color: var(--rust);
  }

  .btn--sweep::after {
    display: none;
  }
}

/* ---------- จอเล็ก ---------- */

@media (max-width: 940px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .stage {
    padding: 40px 26px 34px;
    border-right: 0;
    border-bottom: 1px solid var(--gold-line);
  }

  .stage__inner {
    gap: 22px;
  }

  .stage__headline {
    font-size: 27px;
  }

  .stage__lede {
    display: none;
  }

  .gatewrap {
    padding: 34px 22px 48px;
  }
}

@media (max-width: 460px) {
  .hud__cell {
    padding: 12px 12px;
  }

  .hud__v {
    font-size: 21px;
  }

  .gate {
    padding: 26px 20px 24px;
  }
}
