/* ═══════════════════════════════════════════════════════════
   CML — Create My Life  ·  Visual Design System
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #101830;
  --bg-alt: #1a2850;
  --panel: rgba(22, 32, 60, 0.85);
  --panel-strong: rgba(28, 40, 72, 0.93);
  --panel-border: rgba(164, 178, 255, 0.24);
  --text: #f7f7ff;
  --muted: #bcc6e8;
  --accent: #9c74ff;
  --accent-2: #59bcff;
  --accent-3: #7af0d5;
  --accent-4: #ff78de;
  --danger: #ff7f8d;
  --warning: #ffcb6d;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
  --font-display: "Plus Jakarta Sans", "Avenir Next", "Trebuchet MS", sans-serif;
  --font-body: "Inter", "Segoe UI", "Apple SD Gothic Neo", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  --route-politician: linear-gradient(135deg, rgba(118, 98, 255, 0.55), rgba(78, 201, 255, 0.3));
  --route-celebrity: linear-gradient(135deg, rgba(255, 111, 182, 0.5), rgba(140, 124, 255, 0.35));
  --route-entrepreneur: linear-gradient(135deg, rgba(76, 201, 255, 0.48), rgba(122, 240, 213, 0.26));
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --transition-fast: 160ms ease;
  --transition-medium: 280ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(circle at 12% 10%, rgba(140, 124, 255, 0.40), transparent 22%),
    radial-gradient(circle at 88% 14%, rgba(78, 201, 255, 0.30), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(255, 111, 182, 0.20), transparent 36%),
    linear-gradient(160deg, #0e1428 0%, #162244 44%, #101830 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  opacity: 0.2;
}

button,
.button-link {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

/* ── Flex containers ──────────────────────────────────────── */
.topbar,
.layout,
.game-shell,
.cta-row,
.topbar-actions,
.pill-group,
.modal-actions,
.hero-grid,
.avatar-card,
.preview-tags {
  display: flex;
  gap: 14px;
}

.topbar,
.layout {
  align-items: stretch;
}

.topbar {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.layout {
  flex-direction: column;
  gap: 20px;
}

/* ── Panel / Card shared styles ────────────────────────────── */
.panel,
.modal-card,
.preview-card,
.touch-button {
  border: 1px solid var(--panel-border);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

/* ── Hero / Game panels ────────────────────────────────────── */
.hero-panel,
.game-panel {
  overflow: hidden;
}

.game-panel {
  display: none;
}

.hero-panel {
  padding: 36px 32px;
}

.game-panel {
  padding: 18px;
}

.hero-grid {
  align-items: stretch;
  justify-content: space-between;
}

#hero-copy,
.selection-preview {
  flex: 1 1 0;
}

/* ── Eyebrow labels ────────────────────────────────────────── */
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--font-display);
}

/* ── Typography ────────────────────────────────────────────── */
h1,
h2,
h3,
p,
dd {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  line-height: 0.92;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h1 span {
  display: block;
  margin-top: 8px;
  font-size: 0.38em;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #c8d4ff, #a8b2d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: tagline-fade 800ms ease-out both;
}

@keyframes tagline-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  line-height: 1.2;
}

h3 {
  font-size: 1.1rem;
}

p {
  color: var(--muted);
  line-height: 1.7;
  max-width: 680px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.primary-button,
.secondary-button,
.button-link,
.touch-button {
  min-height: 48px;
  padding: 13px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-display);
  transition: transform var(--transition-fast), opacity var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  touch-action: manipulation;
}

.primary-button {
  position: relative;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07101d;
  font-weight: 800;
  overflow: hidden;
}

/* Shimmer animation on primary button */
.primary-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.2) 45%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.2) 55%,
    transparent 70%
  );
  transform: translateX(-120%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-120%); }
  60% { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

.secondary-button,
.button-link {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.primary-button:hover,
.secondary-button:hover,
.button-link:hover,
.option-card:hover {
  transform: translateY(-2px) scale(1.02);
}

.primary-button:hover {
  box-shadow: 0 8px 32px rgba(156, 116, 255, 0.3);
}

.secondary-button:hover,
.button-link:hover {
  border-color: rgba(156, 116, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
}

.primary-button:active,
.secondary-button:active,
.button-link:active,
.touch-button:active {
  transform: scale(0.98);
}

/* ── Pill group (language switcher, etc.) ──────────────────── */
.pill-group {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-group button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.pill-group button.active {
  background: rgba(140, 124, 255, 0.24);
  color: #efeaff;
  border: 1px solid rgba(140, 124, 255, 0.32);
}

/* ── Preview card ──────────────────────────────────────────── */
.preview-card {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 80% 10%, rgba(156, 116, 255, 0.22), transparent 28%),
    radial-gradient(circle at 12% 85%, rgba(89, 188, 255, 0.16), transparent 26%),
    rgba(16, 22, 46, 0.74);
}

.route-politician.preview-card,
.result-hero.route-politician {
  background-image: var(--route-politician);
}

.route-celebrity.preview-card,
.result-hero.route-celebrity {
  background-image: var(--route-celebrity);
}

.route-entrepreneur.preview-card,
.result-hero.route-entrepreneur {
  background-image: var(--route-entrepreneur);
}

/* ── Avatar card ───────────────────────────────────────────── */
.avatar-card {
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.avatar-card.compact {
  margin: 14px 0 18px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}

.avatar-card.compact p {
  margin-bottom: 0;
}

.preview-avatar {
  align-items: flex-start;
  gap: 20px;
}

.preview-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.preview-copy h3 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
}

.preview-copy p {
  margin-bottom: 0;
}

/* ── Portrait card (SVG-based) ─────────────────────────────── */
.portrait-card {
  display: grid;
  gap: 10px;
}

.portrait-card svg {
  width: 100%;
  height: auto;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.portrait-card.hero svg {
  width: 220px;
  height: 288px;
}

.portrait-card.compact svg {
  width: 114px;
  height: 152px;
}

.portrait-card.result svg {
  width: 220px;
  height: 288px;
}

.portrait-card.result {
  margin: 10px 0 16px;
}

.portrait-meta {
  display: grid;
  gap: 6px;
}

.portrait-meta strong {
  font-size: 1rem;
  font-family: var(--font-display);
}

.portrait-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portrait-chips span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #edf2ff;
  font-size: 0.82rem;
}

/* ── Result hero ───────────────────────────────────────────── */
.result-hero {
  display: grid;
  gap: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 80% 18%, rgba(156, 116, 255, 0.24), transparent 28%),
    rgba(255, 255, 255, 0.06);
}

.result-hero .portrait-card.result {
  justify-self: start;
}

.preview-tags {
  flex-wrap: wrap;
  margin-top: 16px;
}

.preview-tags span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #eaf0ff;
  font-size: 0.92rem;
}

/* ── HUD sidebar ───────────────────────────────────────────── */
.wallet-status,
.story-feed,
.verified-box,
.hud-cards,
.milestone-strip {
  color: var(--muted);
}

/* ── Route builder / option grids ──────────────────────────── */
.route-builder,
.option-grid {
  display: grid;
  gap: 12px;
}

.route-builder {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 22px 0;
}

.option-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.option-card {
  min-height: 112px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(9, 14, 32, 0.76);
  border: 1px solid transparent;
  color: var(--text);
  text-align: left;
  font-family: var(--font-display);
  transition: all var(--transition-fast);
  position: relative;
}

/* Route-colored left accent border on option cards */
.route-builder > div:first-child .option-card {
  border-left: 3px solid rgba(156, 116, 255, 0.4);
}
.route-builder > div:nth-child(2) .option-card {
  border-left: 3px solid rgba(89, 188, 255, 0.4);
}
.route-builder > div:nth-child(3) .option-card {
  border-left: 3px solid rgba(122, 240, 213, 0.4);
}

.option-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
  font-family: var(--font-body);
}

.option-card.active {
  border-color: rgba(140, 124, 255, 0.38);
  border-left-color: rgba(140, 124, 255, 0.6);
  background:
    linear-gradient(180deg, rgba(140, 124, 255, 0.22), rgba(78, 201, 255, 0.08)),
    rgba(15, 19, 40, 0.9);
  box-shadow: 0 0 24px rgba(156, 116, 255, 0.15);
}

/* ── Choice cards (turn decisions) ─────────────────────────── */
.choice-card + .choice-card {
  margin-top: 12px;
}

.choice-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ── Milestone strip ───────────────────────────────────────── */
.milestone-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.milestone-strip div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

/* ── Game shell layout ─────────────────────────────────────── */
.game-shell {
  align-items: flex-start;
  gap: 18px;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 auto;
}

#game-canvas {
  width: min(100%, 960px);
  max-width: 100%;
  border-radius: 22px;
  background: #0e1d36;
  display: block;
}

.touch-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: none;
  width: 164px;
  height: 164px;
  z-index: 2;
}

.touch-button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 18px;
  background: rgba(14, 20, 40, 0.76);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
}

.touch-button.up { top: 0; left: 55px; }
.touch-button.left { top: 55px; left: 0; }
.touch-button.right { top: 55px; right: 0; }
.touch-button.down { bottom: 0; left: 55px; }

/* ── HUD column ────────────────────────────────────────────── */
.hud-column {
  width: min(360px, 100%);
  display: grid;
  gap: 12px;
}

.hud-cards,
.story-feed,
.verified-box {
  min-height: 120px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-grid > div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
}

.stat-grid > div strong {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-display);
}

.story-feed p:last-child,
.verified-box p:last-child,
.hud-cards p:last-child {
  margin-bottom: 0;
}

.tone-good { color: var(--accent-3); }
.tone-warn { color: var(--warning); }

.hidden { display: none; }

/* ═══════════════════════════════════════════════════════════
   MODALS — Premium glass card system
   ═══════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 7, 18, 0.78);
  z-index: 20;
  animation: modal-backdrop-in 200ms ease both;
}

.modal.hidden {
  display: none;
}

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(88vh, 980px);
  overflow: auto;
  padding: 28px;
  background: rgba(32, 44, 78, 0.95);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.12);
  animation: modal-card-in 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modal-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-actions {
  flex-wrap: wrap;
  margin-top: 20px;
}

.modal-actions .secondary-button {
  flex: 1 1 220px;
  border-radius: 20px;
}

.event-note,
.result-subtitle {
  color: #d9e3ff;
}

.result-card {
  width: min(880px, 100%);
}

.result-hero {
  margin-bottom: 14px;
  padding: 24px;
  border-radius: 22px;
  background-color: rgba(255, 255, 255, 0.06);
}

.result-hero h2 {
  margin-bottom: 10px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Entrance animation ─────────────────────────────────────── */
@keyframes soft-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel,
.preview-card {
  animation: soft-rise 240ms ease;
}

/* ═══════════════════════════════════════════════════════════
   IDENTITY PANEL — Glass morphism name/gender inputs
   ═══════════════════════════════════════════════════════════ */
.identity-panel {
  display: none;
  flex-direction: column;
  gap: 18px;
  padding: 32px 24px;
  max-width: 480px;
  margin: 0 auto;
}
.identity-panel.active {
  display: flex;
}
.identity-panel label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}
.identity-panel input[type="text"] {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 1.1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.identity-panel input[type="text"]::placeholder {
  color: rgba(168, 178, 216, 0.5);
}
.identity-panel input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(156, 116, 255, 0.15);
}

/* Gender pill selectors */
.gender-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gender-options button {
  flex: 1;
  min-width: 100px;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.95rem;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.gender-options button:hover {
  border-color: rgba(156, 116, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}
.gender-options button.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(156, 116, 255, 0.18);
  box-shadow: 0 0 0 2px rgba(156, 116, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════
   TURN HEADER — Badge system with tabular numbers
   ═══════════════════════════════════════════════════════════ */
.turn-header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--muted);
}
.turn-badge {
  padding: 5px 12px;
  border-radius: 10px;
  background: rgba(156, 116, 255, 0.18);
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.age-badge {
  padding: 5px 12px;
  border-radius: 10px;
  background: rgba(89, 188, 255, 0.12);
  color: var(--accent-2);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.stage-badge {
  padding: 5px 12px;
  border-radius: 10px;
  background: rgba(122, 240, 213, 0.1);
  color: var(--accent-3);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════════════════════════
   HEADLINE CARD — Lighter feel, accent top border
   ═══════════════════════════════════════════════════════════ */
.headline-card {
  text-align: center;
  padding: 24px 20px;
  font-size: 1.1rem;
  line-height: 1.55;
  cursor: pointer;
  border-top: 2px solid rgba(156, 116, 255, 0.25);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  margin-top: 8px;
}
.headline-card .headline-text {
  margin: 14px 0 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
}
.headline-card .tap-hint {
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════
   TURN CONTENT — Event title & body typography
   ═══════════════════════════════════════════════════════════ */
.modal-card h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  line-height: 1.2;
  color: var(--text);
}

.modal-card p {
  line-height: 1.65;
  color: var(--muted);
  max-width: 640px;
}

/* Turn type eyebrow — route accent colors */
.modal-card .eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  margin-bottom: 10px;
}

/* Choice buttons — card-style with hover glow */
.modal-actions .secondary-button {
  text-align: left;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  transition: all var(--transition-fast);
}

.modal-actions .secondary-button:hover {
  border-color: rgba(156, 116, 255, 0.4);
  background: rgba(156, 116, 255, 0.08);
  box-shadow: 0 0 20px rgba(156, 116, 255, 0.12);
  transform: translateY(-2px);
}

.modal-actions .secondary-button strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.modal-actions .secondary-button small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════
   GRACE — Bar, prompt, onboarding
   ═══════════════════════════════════════════════════════════ */
.grace-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.grace-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.grace-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.grace-bar-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.grace-card {
  text-align: center;
}
.grace-card .grace-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}
.grace-card .grace-cost {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-display);
  margin: 10px 0;
}

/* ── Grace onboarding block ──────────────────────────────── */
.grace-onboarding {
  margin: 12px 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(156, 116, 255, 0.08);
  border: 1px solid rgba(156, 116, 255, 0.2);
}
.grace-onboarding p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.grace-damage {
  color: var(--danger);
  font-weight: 600;
  margin: 8px 0;
  font-family: var(--font-display);
}

/* ═══════════════════════════════════════════════════════════
   CAST PANEL — Character relationships
   ═══════════════════════════════════════════════════════════ */
.cast-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.cast-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.cast-item .cast-name {
  color: var(--text);
  font-weight: 500;
  font-family: var(--font-display);
}
.cast-item .cast-arc {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(156, 116, 255, 0.1);
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════
   INTRO MODAL
   ═══════════════════════════════════════════════════════════ */
.intro-card {
  text-align: center;
  max-width: 560px;
}
.intro-card h2 {
  margin-bottom: 16px;
}
.intro-card p {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
  margin-left: auto;
  margin-right: auto;
}

/* ═══════════════════════════════════════════════════════════
   ONBOARDING MODAL — Premium glass card
   ═══════════════════════════════════════════════════════════ */
.onboarding-card {
  text-align: center;
  max-width: 600px;
}
.onboarding-card h2 {
  margin-bottom: 18px;
}
.onboarding-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 12px;
}
.onboarding-list li {
  position: relative;
  padding: 16px 18px 16px 46px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
  transition: background var(--transition-fast);
}
.onboarding-list li:hover {
  background: rgba(255, 255, 255, 0.06);
}
.onboarding-list li::before {
  content: "✦";
  position: absolute;
  left: 18px;
  top: 16px;
  color: var(--accent);
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════
   STATS DASHBOARD — Clean data panel with slide animation
   ═══════════════════════════════════════════════════════════ */
.stats-card {
  width: min(720px, 100%);
}
.stats-card h2 {
  margin-bottom: 18px;
}
.stats-card h3 {
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stats-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  transition: background var(--transition-fast);
}
.stats-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.stats-item.accent {
  background: rgba(156, 116, 255, 0.1);
  border: 1px solid rgba(156, 116, 255, 0.22);
}
.stats-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stats-label small {
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}
.stats-value {
  font-weight: 700;
  color: var(--text);
  font-size: 1.1rem;
  font-family: var(--font-mono);
}

/* Color-coded stat values */
.stats-value.stat-high { color: var(--accent-3); }
.stats-value.stat-mid { color: var(--warning); }
.stats-value.stat-low { color: var(--danger); }

/* Grace visual bar in stats */
.stats-grace-bar {
  width: 100%;
  grid-column: 1 / -1;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(156, 116, 255, 0.06);
  border: 1px solid rgba(156, 116, 255, 0.15);
}
.stats-grace-bar .grace-bar {
  margin-top: 4px;
}

/* ── Stats toggle button ─────────────────────────────────── */
.stats-toggle {
  margin-left: auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  transition: all var(--transition-fast);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stats-toggle:hover {
  background: rgba(156, 116, 255, 0.15);
  border-color: rgba(156, 116, 255, 0.3);
  color: var(--accent);
  transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════
   ENDING / RESULT SCREEN — Shareable premium card
   ═══════════════════════════════════════════════════════════ */
.ending-summary {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 16px 0;
  font-style: italic;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
}

.ending-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.ending-detail-item {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
}
.ending-detail-item strong {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-display);
}

/* Result score — large centered display */
.result-card .stat-grid > div:first-child {
  text-align: center;
}

.result-card .stat-grid > div strong {
  display: block;
  margin-bottom: 4px;
}

/* Result achievements/regrets as styled list */
.result-card .choice-card {
  padding: 20px;
  border: 1px solid var(--glass-border);
}

.result-card .choice-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
  font-family: var(--font-display);
}

.result-card .choice-card p {
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════
   CTA ROW — Action buttons layout
   ═══════════════════════════════════════════════════════════ */
.cta-row {
  gap: 12px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1120px) {
  .hero-grid,
  .game-shell {
    flex-direction: column;
  }

  .hud-column {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud-cards,
  .story-feed,
  .verified-box {
    min-height: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    gap: 14px;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions > * {
    flex: 1 1 160px;
  }

  .route-builder {
    grid-template-columns: 1fr;
  }

  .preview-avatar {
    flex-direction: column;
  }

  .hud-column {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    padding: 20px;
    border-radius: 22px;
  }

  .hero-panel {
    padding: 24px 20px;
  }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .hero-panel,
  .game-panel {
    padding: 16px;
  }

  .preview-card,
  .avatar-card.compact,
  .choice-card,
  .stat-grid > div,
  .milestone-strip div {
    border-radius: 18px;
  }

  .cta-row,
  .modal-actions {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .button-link {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .modal-actions .secondary-button {
    text-align: left;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .portrait-card {
    min-width: 0;
  }

  .portrait-card.hero svg,
  .portrait-card.result svg {
    width: min(100%, 180px);
    height: auto;
  }

  .portrait-card.compact svg {
    width: 90px;
    height: auto;
  }

  .portrait-meta strong {
    font-size: 0.94rem;
  }

  .portrait-chips span {
    font-size: 0.76rem;
    padding: 5px 8px;
  }

  .avatar-card.compact {
    align-items: flex-start;
  }

  .result-hero .portrait-card.result {
    justify-self: center;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .ending-detail {
    grid-template-columns: 1fr;
  }

  .onboarding-list li {
    font-size: 0.88rem;
    padding: 12px 14px 12px 38px;
  }

  h1 {
    font-size: clamp(2.2rem, 10vw, 3.6rem);
  }

  .result-hero {
    padding: 18px;
  }

  .modal-card {
    padding: 16px;
    border-radius: 20px;
  }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Small mobile (iPhone SE)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 428px) {
  html, body {
    overflow-x: hidden;
  }

  .wizard-modal .modal-card {
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .wizard-grid {
    max-height: 40vh;
  }

  .option-card {
    min-height: 80px;
    padding: 14px;
  }

  .option-card small {
    font-size: 0.85rem;
  }

  .choice-card {
    padding: 14px;
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding: 12px;
  }

  .turn-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .turn-badge,
  .age-badge,
  .stage-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .stats-toggle {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

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

  .wizard-nav {
    flex-direction: column;
  }

  .wizard-nav .primary-button,
  .wizard-nav .secondary-button {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════
   WIZARD — Step-by-step character creation
   ═══════════════════════════════════════════════════════════ */
.wizard-modal .modal-card {
  width: min(680px, 100%);
}

.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: all var(--transition-medium);
}

.wizard-dot.active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(156, 116, 255, 0.4);
  transform: scale(1.2);
}

.wizard-dot.done {
  background: var(--accent-3);
}

.wizard-step-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 8px;
}

.wizard-body {
  animation: wizard-fade-in 300ms ease both;
}

@keyframes wizard-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-nav {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.wizard-nav .primary-button,
.wizard-nav .secondary-button {
  flex: 1;
}

.wizard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}

.wizard-grid .option-card {
  min-height: 90px;
}

.wizard-route-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.wizard-route-card {
  padding: 24px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.wizard-route-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.08);
}

.wizard-route-card.active {
  border-color: var(--accent);
  background: rgba(156, 116, 255, 0.12);
  box-shadow: 0 0 24px rgba(156, 116, 255, 0.15), inset 0 1px 0 rgba(255,255,255,0.08);
}

.wizard-route-card.route-politician {
  border-image: var(--route-politician) 1;
  border-image: none;
}
.wizard-route-card.route-politician.active {
  border-color: rgba(118, 98, 255, 0.7);
  background: linear-gradient(180deg, rgba(118, 98, 255, 0.15), rgba(78, 201, 255, 0.08));
}

.wizard-route-card.route-celebrity.active {
  border-color: rgba(255, 111, 182, 0.7);
  background: linear-gradient(180deg, rgba(255, 111, 182, 0.15), rgba(140, 124, 255, 0.08));
}

.wizard-route-card.route-entrepreneur.active {
  border-color: rgba(76, 201, 255, 0.7);
  background: linear-gradient(180deg, rgba(76, 201, 255, 0.15), rgba(122, 240, 213, 0.08));
}

.wizard-route-card h3 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.wizard-route-card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0;
}

/* Play mode step */
.wizard-play-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.wizard-play-card {
  padding: 28px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.wizard-play-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

.wizard-play-card.active {
  border-color: var(--accent);
  background: rgba(156, 116, 255, 0.12);
}

.wizard-play-card h3 {
  margin-bottom: 8px;
}

.wizard-play-card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════
   AVATAR GRID — Portrait selection
   ═══════════════════════════════════════════════════════════ */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  margin-top: 16px;
}

.avatar-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.04);
}

.avatar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.avatar-thumb:hover {
  transform: scale(1.05);
  border-color: rgba(156, 116, 255, 0.3);
}

.avatar-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(156, 116, 255, 0.3);
}

/* In-game avatar display */
.turn-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(156, 116, 255, 0.3);
  flex-shrink: 0;
}

.turn-header-with-avatar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.result-avatar {
  width: 120px;
  height: 160px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid rgba(156, 116, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stats-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(156, 116, 255, 0.3);
}

/* Landing page minimal */
.hero-panel.minimal {
  text-align: center;
  padding: 48px 32px;
}

.hero-panel.minimal .hero-tagline {
  max-width: 600px;
  margin: 16px auto 32px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-panel.minimal .cta-row {
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   TOUCH DEVICE OVERRIDES
   ═══════════════════════════════════════════════════════════ */
@media (hover: none), (pointer: coarse) {
  .touch-controls {
    display: block;
  }

  .option-card:hover,
  .primary-button:hover,
  .secondary-button:hover,
  .button-link:hover {
    transform: none;
  }

  .pill-group {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .wizard-route-grid {
    grid-template-columns: 1fr;
  }
  .wizard-play-options {
    grid-template-columns: 1fr;
  }
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .avatar-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .wizard-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════
   Leaderboard
   ═══════════════════════════════════════════════════════════ */

.leaderboard-card {
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
}

.leaderboard-card h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lb-prize-note {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 16px;
}

.lb-empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 0;
}

.lb-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.leaderboard-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard-table td {
  padding: 10px 12px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.leaderboard-table td.mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

.leaderboard-table tbody tr:hover {
  background: rgba(156, 116, 255, 0.04);
}

.leaderboard-table tr.lb-rank-1 td {
  color: #ffd700;
  font-weight: 700;
}

.leaderboard-table tr.lb-rank-2 td {
  color: #c0c0c0;
  font-weight: 600;
}

.leaderboard-table tr.lb-rank-3 td {
  color: #cd7f32;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   Share to X Button
   ═══════════════════════════════════════════════════════════ */

.share-row {
  text-align: center;
  margin-top: 20px;
}

.share-x-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: #000;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.share-x-btn:hover {
  background: #1a1a2e;
  border-color: rgba(255, 255, 255, 0.3);
}

.share-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  color: white;
  padding: 10px 24px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  z-index: 9999;
  animation: toast-pop 2.5s ease-out forwards;
  pointer-events: none;
}

@keyframes toast-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ═══════════════════════════════════════════════════════════
   WFZ Balance Display
   ═══════════════════════════════════════════════════════════ */

.wfz-balance {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.wfz-ok {
  color: #4ade80;
  font-size: 13px;
  margin-top: 8px;
}

.wfz-warn {
  color: #f87171;
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.4;
}

.wfz-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  opacity: 0.7;
}

.wfz-insufficient {
  color: #f87171;
}

@media (max-width: 640px) {
  .leaderboard-table {
    font-size: 12px;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 6px 8px;
  }
}
