/* 3D Arena — base theme.
   Light, friendly, fresh. The accent is a vivid indigo (5b6cff) with a
   warm gold side accent for celebration moments. Score colors fan out
   across red → amber → blue → green so feedback is unmistakable. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* ── Surfaces ──────────────────────────────────────────────────────── */
  /* A whisper-warm off-white that's less harsh than #fff at full screen. */
  --bg: #f6f7fb;
  --bg-soft: #eef0f6;
  --surface: #ffffff;
  --surface-soft: #f4f5f9;
  --surface-strong: #fafbff;
  --canvas-bg: #eef1f6;     /* viewer scene background */

  --border: #dadde6;
  --border-subtle: #e7e9f0;
  --border-strong: #c5c9d4;

  /* ── Text ─────────────────────────────────────────────────────────── */
  --ink: #14151a;
  --text: #14151a;
  --text-secondary: #4f5161;
  --text-tertiary: #8b8e9b;
  --text-muted: #a9acb8;

  /* ── Brand ────────────────────────────────────────────────────────── */
  --primary: #5b6cff;
  --primary-strong: #4254ea;
  --primary-soft: #eef0ff;
  --primary-tint: #5b6cff14;
  --primary-text: #ffffff;

  --gold: #f0b73b;
  --gold-soft: #fdf3d4;
  --gold-text: #6a4d12;

  /* ── Score palette ────────────────────────────────────────────────── */
  --score-1: #ef4444;       /* 差 */
  --score-1-soft: #fee4e4;
  --score-2: #c89759;       /* 较差 — muted amber, less alarming than score 1 */
  --score-2-soft: #f5e8d2;
  --score-3: #2f6cff;       /* 较好 */
  --score-3-soft: #e2eaff;
  --score-4: #16a37e;       /* 优秀 */
  --score-4-soft: #d2f1e6;

  /* ── Status ───────────────────────────────────────────────────────── */
  --success: #16a37e;
  --success-soft: #d2f1e6;
  --warn: #f59e0b;
  --error: #ef4444;
  --info: #2f6cff;

  /* ── Focus / interaction ──────────────────────────────────────────── */
  --focus: #5b6cff;
  --focus-ring: rgba(91, 108, 255, 0.18);
  --focus-strong: #4254ea;

  --shadow-sm: 0 1px 2px rgba(20, 22, 36, 0.04);
  --shadow-md: 0 6px 22px -10px rgba(20, 22, 36, 0.18);
  --shadow-lg: 0 18px 48px -18px rgba(20, 22, 36, 0.22);
  --shadow-pop: 0 12px 32px -10px rgba(91, 108, 255, 0.32);

  --font-display: 'Epilogue', system-ui, -apple-system, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

::selection { background: var(--primary); color: var(--primary-text); }

/* Tiny utility classes */
.center { display: flex; align-items: center; justify-content: center; }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ── Toast ───────────────────────────────────────────────────────────── */
.arena-toast {
  position: fixed; top: var(--space-lg); right: var(--space-lg);
  display: none;
  align-items: center; gap: var(--space-sm);
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px; font-family: var(--font-display); font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.arena-toast.visible { display: flex; opacity: 1; transform: translateY(0); }
.arena-toast.fade-out { opacity: 0; transform: translateY(-6px); }
.arena-toast .arena-toast-spinner svg { animation: arena-spin 0.9s linear infinite; color: var(--primary); }
.arena-toast .arena-toast-check { display: none; color: var(--success); }
.arena-toast.done .arena-toast-spinner { display: none; }
.arena-toast.done .arena-toast-check { display: inline-flex; }
.arena-toast.done {
  background: var(--success-soft);
  border-color: rgba(22, 163, 126, 0.3);
}
.arena-toast.done .arena-toast-text { color: var(--success); }
.arena-toast.error .arena-toast-spinner { display: none; }
.arena-toast.error {
  background: #fef0f0;
  border-color: rgba(239, 68, 68, 0.25);
}
.arena-toast.error .arena-toast-text { color: var(--error); }
@keyframes arena-spin { to { transform: rotate(360deg); } }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  letter-spacing: 0.005em;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-soft); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  box-shadow: var(--shadow-pop);
}
.btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn.ghost { background: transparent; color: var(--text-secondary); border-color: transparent; box-shadow: none; }
.btn.ghost:hover { color: var(--text); background: var(--surface-soft); }

/* ── Page wrapper for centred forms ──────────────────────────────────── */
.page-shell {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-3xl) var(--space-xl);
  background:
    radial-gradient(circle at 12% 8%, rgba(91, 108, 255, 0.07), transparent 40%),
    radial-gradient(circle at 88% 92%, rgba(240, 183, 59, 0.06), transparent 40%),
    var(--bg);
}
.page-card {
  width: 100%; max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
}
.page-eyebrow {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}
.page-title {
  font-family: var(--font-display); font-size: 28px; font-weight: 700;
  letter-spacing: -0.015em; line-height: 1.15;
  margin-bottom: var(--space-sm);
}
.page-sub {
  color: var(--text-secondary); font-size: 14px; line-height: 1.6;
  margin-bottom: var(--space-xl);
}

/* ── Form fields ──────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-lg); }
.field label {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-tertiary);
}
.field input[type=email], .field input[type=text], .field input[type=password] {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px; font-size: 14px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.field .hint { font-size: 12px; color: var(--text-tertiary); }
.field .err { font-size: 12px; color: var(--error); }

.divider {
  display: flex; align-items: center; gap: var(--space-md);
  margin: var(--space-md) 0;
  color: var(--text-tertiary); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-subtle);
}

/* ── Stepper ─────────────────────────────────────────────────────────── */
.stepper {
  display: flex; align-items: center; gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; color: var(--text-tertiary);
}
.stepper .step { display: flex; align-items: center; gap: 6px; }
.stepper .step .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong);
}
.stepper .step.done .dot { background: var(--primary); }
.stepper .step.current .dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.stepper .arrow { color: var(--text-muted); }

/* ── Keyboard chips ──────────────────────────────────────────────────── */
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; padding: 1px 6px;
  font-family: var(--font-body); font-size: 10.5px; font-weight: 600;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  line-height: 1.45;
  box-shadow: 0 1px 0 rgba(20, 22, 36, 0.04);
}

/* ── Project badge ───────────────────────────────────────────────────── */
.project-badge {
  position: fixed; right: var(--space-xl); bottom: var(--space-md);
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  color: var(--text-tertiary); opacity: 0.6; transition: opacity 0.2s;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.project-badge:hover { opacity: 1; color: var(--primary); }

/* ── UltraTex GitHub link ──────────────────────────────────────────────
   Inline text variant — drops into footers / under buttons / inside the
   topbar without a dedicated layout slot. */
.ultratex-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.ultratex-link:hover { color: var(--primary); background: var(--surface-soft); }
.ultratex-link svg { width: 14px; height: 14px; fill: currentColor; }
.ultratex-link.icon-only { padding: 6px; }
.ultratex-link.icon-only svg { width: 16px; height: 16px; }

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
