/* ==========================================================================
   Oddilo — Daily Calibration
   Playful Precision Lab Aesthetic (Flagship Daily Ritual)
   ========================================================================== */

:root {
  --bg-paper: #F7F5F0;
  --bg-surface: #FFFFFF;
  --bg-subtle: #EFECE3;
  --ink: #16161A;
  --ink-muted: #666573;
  --border-soft: #E2DDD0;
  --accent-red: #FF3B30;
  --accent-blue: #2D5BFF;
  --accent-green: #00A878;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-tactile: 0 3px 0 #16161A;
  --shadow-tactile-sm: 0 2px 0 #16161A;
  --font-display: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background-color: var(--bg-paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { display: flex; flex-direction: column; min-height: 100dvh; }

/* ---------- Topbar ---------- */
.topbar {
  width: 100%;
  border-bottom: 1.5px solid var(--border-soft);
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}

.topbar-inner {
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

.brand-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: transparent; border: none; padding: 4px 6px 4px 2px;
  border-radius: 10px; cursor: pointer; color: var(--ink);
}

.brand-wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  letter-spacing: -0.03em; line-height: 1;
}

.brand-lab-tag {
  font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 6px;
  background: var(--ink); color: #FFFFFF;
}

.topbar-center-pill {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg-surface); border: 1.5px solid var(--ink);
  color: var(--ink); white-space: nowrap;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1.5px solid var(--border-soft); background: var(--bg-surface);
  color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.15s ease, transform 0.12s ease;
}

.icon-btn:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ---------- Main App Shell ---------- */
.app-shell {
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 14px 16px 24px; flex: 1;
  display: flex; flex-direction: column; gap: 12px;
}

/* ---------- 3-Stage Stepper ---------- */
.stepper {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}

.step-pill {
  background: var(--bg-surface); border: 1.5px solid var(--border-soft);
  border-radius: 12px; padding: 8px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  transition: all 0.2s ease;
}

.step-pill.active {
  border-color: var(--ink); box-shadow: var(--shadow-tactile-sm); background: #FFFFFF;
}

.step-pill.done { border-color: var(--ink); background: var(--bg-subtle); }

.step-left { display: flex; align-items: center; gap: 6px; min-width: 0; }

.step-num {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--bg-subtle); color: var(--ink-muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.step-pill.active .step-num { background: var(--ink); color: #FFFFFF; }
.step-pill.done .step-num { background: var(--accent-green); color: #FFFFFF; }

.step-name {
  font-family: var(--font-display); font-weight: 700; font-size: 0.82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.step-score {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
  color: var(--ink); flex-shrink: 0;
}

/* ---------- Intro Hero Card ---------- */
.intro-card {
  background: var(--bg-surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 0 #16161A;
  padding: 26px 22px;
  display: flex; flex-direction: column; gap: 20px;
  animation: popIn 0.35s cubic-bezier(0.22, 1.25, 0.36, 1) forwards;
}

.intro-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.intro-kicker {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted);
}

.streak-chip {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: #FEF3C7; color: #92400E; border: 1.5px solid #F59E0B;
}

.intro-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.8rem, 5.5vw, 2.35rem);
  letter-spacing: -0.035em; line-height: 1.06; margin: 0 0 8px;
}

.intro-sub { margin: 0; font-size: 0.96rem; color: var(--ink-muted); line-height: 1.45; }

.intro-triad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}

.triad-box {
  background: var(--bg-paper); border: 1.5px solid var(--border-soft);
  border-radius: 14px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
}

.triad-dot {
  width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink);
  margin-bottom: 4px;
}

.triad-axis { font-family: var(--font-display); font-weight: 700; font-size: 0.96rem; }
.triad-game { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-muted); }

/* ---------- Practice Banner ---------- */
.practice-ribbon {
  background: #FEF3C7; border: 1.5px solid #F59E0B; color: #92400E;
  border-radius: 10px; padding: 6px 12px;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* ---------- Play View (Banner + Stage + Action Dock) ---------- */
.target-banner {
  background: var(--bg-surface); border: 1.5px solid var(--ink);
  border-radius: var(--radius-md); padding: 12px 16px;
  box-shadow: var(--shadow-tactile-sm);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 66px; transition: background 0.25s ease;
}

.prompt-kicker {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); display: block;
}

.prompt-headline {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.15rem, 3.6vw, 1.5rem); letter-spacing: -0.02em; line-height: 1.15;
}

.shape-tag {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  color: var(--ink-muted); background: var(--bg-subtle);
  padding: 4px 9px; border-radius: 8px; white-space: nowrap;
}

.verdict-wrap {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; gap: 10px; animation: popIn 0.3s ease forwards;
}

.verdict-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.verdict-badge {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; border: 1.5px solid var(--ink);
}

.verdict-score {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.verdict-detail {
  text-align: right; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-muted);
}

.verdict-detail strong { display: block; color: var(--ink); font-size: 0.86rem; }

.stage-card {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  max-height: min(49dvh, 420px);
  background: var(--bg-surface); border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 0 rgba(22, 22, 26, 0.08);
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
}

.stage-card canvas { display: block; width: 100%; height: 100%; }

.stage-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border-soft);
  padding: 5px 12px; border-radius: 999px; font-size: 0.74rem; font-weight: 500;
  color: var(--ink-muted); pointer-events: none; white-space: nowrap;
}

.stage-toggle-btn {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--bg-surface); color: var(--ink);
  cursor: pointer;
}

.stage-toggle-btn.active { background: var(--ink); color: #FFFFFF; }

/* ---------- Inter-Stage Transition Curtain ---------- */
.transition-curtain {
  position: absolute; inset: 0;
  background: rgba(22, 22, 26, 0.94); color: #FFFFFF;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 20px; text-align: center;
  z-index: 15; animation: fadeIn 0.2s ease forwards;
}

.curtain-kicker {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: #9CA3AF;
}

.curtain-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1.75rem;
  letter-spacing: -0.02em; margin: 0;
}

.curtain-sub { font-size: 0.88rem; color: #D1D5DB; margin: 0; }

/* ---------- Action Dock ---------- */
.action-dock { display: flex; align-items: center; gap: 10px; }

.btn-primary {
  flex: 1; font-family: var(--font-display); font-weight: 700; font-size: 1.06rem;
  height: 54px; border-radius: var(--radius-md); border: 2px solid var(--ink);
  background: var(--accent-red); color: #FFFFFF; box-shadow: var(--shadow-tactile);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.14s ease;
}

.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 0 #16161A; }
.btn-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #16161A; }
.btn-primary:disabled { background: #C9C5BA; color: #6B6A75; border-color: #8A8996; box-shadow: none; cursor: not-allowed; }
.btn-primary.blue-mode { background: var(--accent-blue); }
.btn-primary.dark-mode { background: var(--ink); }

.btn-secondary {
  height: 54px; padding: 0 16px; border-radius: var(--radius-md);
  border: 1.5px solid var(--ink); background: var(--bg-surface); color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
  box-shadow: var(--shadow-tactile-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}

.btn-secondary:hover { background: var(--bg-subtle); transform: translateY(-1px); }

/* ---------- Flagship Result Card ---------- */
.result-card {
  background: var(--bg-surface); border: 2px solid var(--ink);
  border-radius: var(--radius-lg); box-shadow: 0 6px 0 #16161A;
  padding: 22px 20px; display: flex; flex-direction: column; gap: 16px;
  animation: popIn 0.38s cubic-bezier(0.22, 1.25, 0.36, 1) forwards;
}

.result-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  border-bottom: 1.5px dashed var(--border-soft); padding-bottom: 14px;
}

.result-archetype {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.5rem, 4.5vw, 1.85rem);
  letter-spacing: -0.03em; line-height: 1.08; margin: 4px 0 6px;
}

.result-blurb { margin: 0; font-size: 0.9rem; color: var(--ink-muted); line-height: 1.45; }

.hero-score-badge {
  background: var(--ink); color: #FFFFFF;
  border-radius: 16px; padding: 12px 16px; text-align: center; flex-shrink: 0;
}

.hero-score-num {
  font-family: var(--font-display); font-weight: 700; font-size: 1.9rem;
  line-height: 1; font-variant-numeric: tabular-nums;
}

.hero-score-lbl {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: #D1D5DB; margin-top: 4px;
}

.result-body-grid {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 14px; align-items: center;
}

.radar-wrap {
  background: var(--bg-paper); border: 1.5px solid var(--border-soft);
  border-radius: 16px; padding: 8px; display: flex; justify-content: center;
}

.radar-svg { width: 100%; max-width: 280px; height: auto; display: block; }

.axis-list { display: flex; flex-direction: column; gap: 8px; }

.axis-row {
  background: var(--bg-paper); border: 1.5px solid var(--border-soft);
  border-radius: 12px; padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.axis-row-title { font-family: var(--font-display); font-weight: 700; font-size: 0.92rem; display: block; }
.axis-row-sub { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-muted); }
.axis-row-score {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.86rem;
  padding: 4px 9px; border-radius: 999px; border: 1.5px solid var(--ink);
}

.result-meta-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--bg-paper); border: 1.5px solid var(--border-soft);
  border-radius: 12px; padding: 10px 14px;
  font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600;
}

.result-actions { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }

.standalone-links {
  border-top: 1.5px dashed var(--border-soft); padding-top: 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.standalone-kicker {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted);
}

.standalone-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.standalone-btn {
  background: var(--bg-paper); border: 1.5px solid var(--border-soft);
  border-radius: 10px; padding: 8px 10px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem; color: var(--ink);
  text-align: center; transition: border-color 0.14s ease, transform 0.1s ease;
}

.standalone-btn:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ---------- Modals & Toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(22, 22, 26, 0.45);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 60;
}

.modal-card {
  width: 100%; max-width: 420px; background: var(--bg-surface);
  border: 2px solid var(--ink); border-radius: var(--radius-lg);
  box-shadow: 0 8px 0 #16161A; padding: 20px;
}

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin: 0; }

.lab-list { display: flex; flex-direction: column; gap: 8px; }
.lab-item {
  width: 100%; text-align: left; padding: 11px 13px; border-radius: 12px;
  border: 1.5px solid var(--border-soft); background: var(--bg-paper);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer; color: var(--ink);
}
.lab-item.live { background: #FFFFFF; border-color: var(--ink); }
.lab-item-name { font-family: var(--font-display); font-weight: 700; font-size: 0.92rem; display: block; }
.lab-item-desc { font-size: 0.76rem; color: var(--ink-muted); }
.lab-pill { font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; }
.lab-pill.live { background: #E6F8F2; color: #007A57; border: 1px solid #00A878; }
.lab-pill.launched { background: #EBF0FF; color: #1D4ED8; border: 1px solid #2D5BFF; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #FFFFFF; font-family: var(--font-display); font-weight: 600; font-size: 0.86rem;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(22, 22, 26, 0.25);
  opacity: 0; pointer-events: none; z-index: 80; transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.95) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 600px) {
  .topbar-inner { padding: 8px 12px; }
  .brand-lab-tag { display: none; }
  .app-shell { padding: 10px 12px 18px; gap: 10px; }
  .intro-card { padding: 20px 16px; gap: 16px; }
  .intro-triad { grid-template-columns: 1fr; gap: 8px; }
  .triad-box { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; }
  .triad-dot { margin-bottom: 0; }
  .step-pill { padding: 6px 8px; }
  .step-name { font-size: 0.74rem; }
  .result-body-grid { grid-template-columns: 1fr; }
  .result-actions { grid-template-columns: 1fr; }
  .standalone-pills { grid-template-columns: 1fr; }
  .stage-card { max-height: min(47dvh, 390px); }
}
