/* AURA · 光屿 — auth screen */
:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #0d0d10;
  --field: #111115;
  --field-focus: #141419;
  --text: #f4f1ea;
  --muted: #93929b;
  --faint: #5f5f68;
  --line: rgba(244, 241, 234, 0.1);
  --line-strong: rgba(244, 241, 234, 0.22);
  --coral: #ff6b5e;
  --font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: opacity 0.24s ease;
}

body.is-leaving { opacity: 0; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: rgba(244, 241, 234, 0.9); color: #0a0a0c; }
:focus-visible { outline: 2px solid rgba(244, 241, 234, 0.65); outline-offset: 2px; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(430px, 0.88fr);
  min-height: 100dvh;
}

/* ------------------------------------------------------------ visual side */

.visual {
  position: relative;
  overflow: hidden;
  background: #0b0b0d;
  min-height: 620px;
}

.visual-columns {
  position: absolute;
  inset: -22% -8%;
  display: flex;
  gap: 16px;
  transform: rotate(-8deg) scale(1.12);
  opacity: 0;
  animation: visual-in 1.6s var(--ease) 0.05s forwards;
}

.visual-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: drift-up 64s linear infinite;
  will-change: transform;
}

.visual-col--down { animation-name: drift-down; animation-duration: 72s; }
.visual-col--slow { animation-duration: 86s; opacity: 0.85; }

.visual-col figure {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #17171b;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.visual-col img {
  display: block;
  width: 100%;
  height: 252px;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.86) contrast(1.03);
}

@keyframes drift-up {
  from { transform: translateY(0); }
  to { transform: translateY(calc(-50% - 8px)); }
}

@keyframes drift-down {
  from { transform: translateY(calc(-50% - 8px)); }
  to { transform: translateY(0); }
}

@keyframes visual-in {
  to { opacity: 1; }
}

.visual-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(9, 9, 11, 0.72) 0%, rgba(9, 9, 11, 0) 30%, rgba(9, 9, 11, 0.06) 55%, rgba(9, 9, 11, 0.94) 100%),
    linear-gradient(90deg, rgba(9, 9, 11, 0.28) 0%, rgba(9, 9, 11, 0) 38%, rgba(13, 13, 16, 0.96) 100%),
    radial-gradient(120% 80% at 15% 10%, rgba(9, 9, 11, 0.35), transparent 60%);
}

.visual-brand {
  position: absolute;
  top: clamp(28px, 4vw, 46px);
  left: clamp(26px, 4vw, 54px);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 2;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(244, 241, 234, 0.28);
  color: rgba(244, 241, 234, 0.92);
  background: rgba(9, 9, 11, 0.22);
  backdrop-filter: blur(8px);
}

.brand-word {
  font-size: 13px;
  letter-spacing: 0.22em;
  font-weight: 600;
  color: rgba(244, 241, 234, 0.94);
}

.brand-word em {
  font-style: normal;
  margin: 0 6px;
  color: rgba(244, 241, 234, 0.45);
}

.visual-copy {
  position: absolute;
  left: clamp(26px, 4vw, 54px);
  bottom: clamp(34px, 6vw, 72px);
  max-width: 470px;
  z-index: 2;
  animation: copy-in 1s var(--ease) 0.25s both;
}

@keyframes copy-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.visual-eyebrow {
  margin: 0 0 18px;
  font-size: 10.5px;
  letter-spacing: 0.32em;
  color: rgba(244, 241, 234, 0.5);
}

.visual-copy h2 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(34px, 3.6vw, 52px);
  line-height: 1.24;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #f7f4ee;
}

.visual-note {
  margin: 0;
  max-width: 380px;
  font-size: 13.5px;
  line-height: 1.9;
  color: rgba(244, 241, 234, 0.55);
}

/* ------------------------------------------------------------- form panel */

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: clamp(28px, 4vw, 52px) clamp(26px, 4vw, 56px) 22px;
}

.panel-inner {
  width: 100%;
  max-width: 396px;
  margin: auto;
  padding-block: clamp(20px, 5vh, 56px);
  animation: panel-in 0.8s var(--ease) 0.15s both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.panel-brand {
  font-size: 10.5px;
  letter-spacing: 0.3em;
  color: var(--faint);
  margin-bottom: clamp(28px, 4vh, 42px);
}

.panel-brand span { margin: 0 4px; opacity: 0.6; }

.panel-head h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(30px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

#auth-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 30px 0 26px;
  padding: 4px;
  background: #121216;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.tab {
  position: relative;
  z-index: 1;
  height: 40px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.35s var(--ease);
}

.tab.is-active { color: #0b0b0d; }
.tab:not(.is-active):hover { color: var(--text); }

.tab-glider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: 40px;
  border-radius: 9px;
  background: var(--text);
  transition: transform 0.42s var(--ease);
  will-change: transform;
}

.tabs[data-view="register"] .tab-glider { transform: translateX(100%); }

.form { display: grid; }

.field { display: grid; gap: 8px; margin-bottom: 16px; }

.field label {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  background: var(--field);
  border: 1px solid rgba(244, 241, 234, 0.09);
  border-radius: 12px;
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.field input::placeholder { color: #5a5a63; }

.field input:hover { border-color: rgba(244, 241, 234, 0.18); }

.field input:focus {
  outline: none;
  background: var(--field-focus);
  border-color: rgba(244, 241, 234, 0.42);
  box-shadow: 0 0 0 4px rgba(244, 241, 234, 0.055);
}

.field.has-error input {
  border-color: rgba(255, 107, 94, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 107, 94, 0.07);
}

.input-wrap { position: relative; }

.input-wrap input { padding-right: 48px; }

.peek {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--faint);
  transition: color 0.2s, background 0.2s;
}

.peek:hover { color: var(--text); background: rgba(244, 241, 234, 0.06); }
.peek.is-on { color: var(--text); }

.form-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 94, 0.22);
  background: rgba(255, 107, 94, 0.07);
  color: #ff9c92;
  font-size: 12.5px;
  line-height: 1.6;
}

.submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: var(--text);
  color: #0a0a0c;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.25s var(--ease), background 0.25s, opacity 0.2s;
}

.submit svg { transition: transform 0.3s var(--ease); }

.submit:hover:not(:disabled) { background: #fffdf7; transform: translateY(-1px); }
.submit:hover:not(:disabled) svg { transform: translateX(3px); }
.submit:active:not(:disabled) { transform: scale(0.992); }
.submit:disabled { cursor: default; opacity: 0.75; }

.submit.is-loading span,
.submit.is-loading svg { opacity: 0; }

.submit.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(10, 10, 12, 0.25);
  border-top-color: #0a0a0c;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.swap, .legal {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
}

.legal { margin-top: 16px; font-size: 11.5px; color: var(--faint); }

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 241, 234, 0.35);
  transition: border-color 0.2s;
}

.link:hover { border-bottom-color: var(--text); }

.demo {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 30px;
  padding: 14px;
  border: 1px dashed rgba(244, 241, 234, 0.16);
  border-radius: 12px;
  background: rgba(244, 241, 234, 0.018);
}

.demo-dot {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: #8fd6a4;
  box-shadow: 0 0 0 4px rgba(143, 214, 164, 0.1);
}

.demo strong { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }

.demo p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--muted);
}

.demo code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(244, 241, 234, 0.07);
  color: rgba(244, 241, 234, 0.86);
  font-size: 11px;
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.demo-fill {
  flex: none;
  margin-left: auto;
  align-self: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.demo-fill:hover { background: var(--text); color: #0a0a0c; border-color: var(--text); }

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid rgba(244, 241, 234, 0.06);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #57575f;
  text-transform: uppercase;
}

.foot-status { display: flex; align-items: center; gap: 7px; }

.foot-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8fd6a4;
  box-shadow: 0 0 8px rgba(143, 214, 164, 0.6);
}

@media (max-width: 1080px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr) minmax(400px, 0.95fr); }
  .visual-copy { max-width: 360px; }
  .visual-copy h2 { font-size: 38px; }
}

@media (max-width: 900px) {
  .auth-shell { display: block; }
  .visual { display: none; }
  .panel { min-height: 100dvh; border-left: 0; padding: 26px 24px 18px; }
  .panel-inner { max-width: 430px; padding-block: 12px; }
  .panel-brand { margin-bottom: 34px; }
  .panel-foot { margin-top: 36px; }
}

@media (max-width: 430px) {
  .panel { padding: 22px 18px 16px; }
  .panel-head h1 { font-size: 28px; }
  .demo { flex-wrap: wrap; }
  .demo-fill { margin-left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .visual-col, .visual-columns, .panel-inner, .visual-copy { animation: none; opacity: 1; }
  * { scroll-behavior: auto !important; }
}
