/* ══════════════════════════════════════════════════════════════════
   SHAWPTY — Mission Control
   Theme system: theme class × light/dark, using alberti_web's `.dark`
   mechanism. Three full themes (colors + emoji + copy via app.js COPY):

     <html>                             → Standard Light  (apothecary beige/orange)
     <html class="dark">                → Standard Dark   (candlelit apothecary)
     <html class="theme-aqua">          → Aqua Launch Light
     <html class="theme-aqua dark">     → Aqua Launch Dark (flagship space)
     <html class="theme-alberti">       → Alberti Light   (alberti_web grey/gold)
     <html class="theme-alberti dark">  → Alberti Dark    (alberti_web navy/gold)

   Aqua + Alberti are gated in app.js (approved water / graduation).
   ══════════════════════════════════════════════════════════════════ */

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  overscroll-behavior: none;
  transition: background 0.35s ease, color 0.35s ease;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ══════════════════ THEME 1/4 — STANDARD LIGHT (default) ══════════════════
   Renaissance Apothecary palette — beige / deep orange / brown, per Kevin's
   direct color call (2026-08-04). Standard is not "no theme" — it's the
   second full theme (apothecary/guild), just like Aqua Launch is a full
   theme (rocket/space) — see app.js's COPY dictionary for the matching
   language + emoji layer. */
:root {
  --font-display: 'Clash Display', Georgia, serif;
  --font-body: 'Satoshi', -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --color-bg: #F0E6D2;
  --color-surface: #F7F0E3;
  --color-surface-2: #EADFC7;
  --color-surface-offset: #E0D3B8;
  --color-surface-dynamic: #D6C6A3;
  --color-divider: #D8C6A0;
  --color-border: #C2A574;

  --color-text: #3B2412;
  --color-text-muted: #6B4F35;
  --color-text-faint: #A38A6D;
  --color-text-inverse: #F7F0E3;

  --color-primary: #C1440E;
  --color-primary-hover: #A83D0C;
  --color-primary-active: #8F330A;
  --color-primary-highlight: #F3D9C0;
  --color-accent: #5C3A21;
  --color-gold: #B08D57;
  --color-cyan: #8A5A2E;

  --action-bg: #3E2723;
  --action-fg: #F0E6D2;

  --shadow-sm: 0 1px 2px rgba(59,36,18,0.08);
  --shadow-md: 0 4px 12px rgba(59,36,18,0.10);
  --shadow-lg: 0 12px 32px rgba(59,36,18,0.16);

  --radius-sm: 0.25rem; --radius-md: 0.5rem; --radius-lg: 1rem; --radius-xl: 1.25rem;

  --hero-bg: var(--color-bg);
  --stars-opacity: 0;
  --glow-opacity: 0;
}

/* ══════════════════ THEME 2/6 — STANDARD DARK ══════════════════
   Candlelit apothecary at night — near-black brown with a burnt-orange glow. */
html.dark:not(.theme-aqua):not(.theme-alberti) {
  --color-bg: #1C120A;
  --color-surface: #241708;
  --color-surface-2: #2C1D0C;
  --color-surface-offset: #33220E;
  --color-surface-dynamic: #3A2712;
  --color-divider: #3D2812;
  --color-border: #4A3018;

  --color-text: #F0E0C8;
  --color-text-muted: #C2A683;
  --color-text-faint: #8A6F4E;
  --color-text-inverse: #1C120A;

  --color-primary: #E2711D;
  --color-primary-hover: #F08A3C;
  --color-primary-active: #C95F12;
  --color-primary-highlight: rgba(226,113,29,0.18);
  --color-accent: #E2711D;
  --color-gold: #D89A4F;
  --color-cyan: #C2822E;

  --action-bg: #E2711D;
  --action-fg: #1C120A;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.55);

  --stars-opacity: 0;
  --glow-opacity: 0.2;
}

/* ══════════════════ THEME 3/6 — AQUA LAUNCH LIGHT ══════════════════
   Sourced from waterstartups_web/styles/theme.css — blue/purple/gold/cyan
   palette, daytime "mission briefing room" read on a warm-white surface */
html.theme-aqua {
  --font-display: 'Clash Display', Georgia, serif;
  --font-body: 'Satoshi', -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --color-bg: #FFFCF8;
  --color-surface: #FFFFFF;
  --color-surface-2: #F4EEE8;
  --color-surface-offset: #EDE6DD;
  --color-surface-dynamic: #E5DDD3;
  --color-divider: #D9CFC4;
  --color-border: #CEC4B8;

  --color-text: #1E1E24;
  --color-text-muted: #6B6271;
  --color-text-faint: #A8A3B0;
  --color-text-inverse: #FFFFFF;

  --color-primary: #2a99ff;
  --color-primary-hover: #1a89ef;
  --color-primary-active: #0a79df;
  --color-primary-highlight: #EBF5FF;
  --color-accent: #310459;
  --color-gold: #ffab08;
  --color-cyan: #00b8c4;

  --action-bg: #310459;
  --action-fg: #FFFFFF;

  --shadow-sm: 0 1px 2px rgba(49,4,89,0.06);
  --shadow-md: 0 4px 12px rgba(49,4,89,0.08);
  --shadow-lg: 0 12px 32px rgba(49,4,89,0.12);

  --radius-sm: 0.25rem; --radius-md: 0.5rem; --radius-lg: 1rem; --radius-xl: 1.5rem;

  --stars-opacity: 0;
  --glow-opacity: 0.15;
}

/* ══════════════════ THEME 4/6 — AQUA LAUNCH DARK (flagship space look) ══════════════════ */
html.theme-aqua.dark {
  --color-bg: #0a0118;
  --color-surface: #12082b;
  --color-surface-2: #170c34;
  --color-surface-offset: #1c1040;
  --color-surface-dynamic: #22134c;
  --color-divider: #2a1a5c;
  --color-border: #372074;

  --color-text: #F3F1FF;
  --color-text-muted: #B3A9D9;
  --color-text-faint: #6E5FA0;
  --color-text-inverse: #0a0118;

  --color-primary: #2a99ff;
  --color-primary-hover: #55b3ff;
  --color-primary-active: #1a89ef;
  --color-primary-highlight: rgba(42,153,255,0.15);
  --color-accent: #ffab08;
  --color-gold: #ffab08;
  --color-cyan: #00f7ff;

  --action-bg: #2a99ff;
  --action-fg: #0a0118;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(10,20,60,0.5);
  --shadow-lg: 0 16px 40px rgba(10,20,60,0.6);

  --hero-bg: linear-gradient(135deg, #1a0230 0%, #0f1a4a 45%, #0d5fa8 80%, #0a9fc0 100%);
  --stars-opacity: 1;
  --glow-opacity: 0.35;
}

/* ══════════════════ THEME 5/6 — ALBERTI LIGHT (alberti_web grey/gold) ══════════════════
   Sourced from alberti_web/styles/theme.css :root — Alberti Grey + Gold primary,
   navy action. Graduation theme after $27 scorecard. */
html.theme-alberti {
  --font-display: 'Clash Display', Georgia, serif;
  --font-body: 'Satoshi', -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --color-bg: #E6E5E6;
  --color-surface: #EAEAE9;
  --color-surface-2: #EEEDED;
  --color-surface-offset: #DEDEDC;
  --color-surface-dynamic: #D5D4D2;
  --color-divider: #CCCBC9;
  --color-border: #C0BFC0;

  --color-text: #030019;
  --color-text-muted: #4A4860;
  --color-text-faint: #908FA0;
  --color-text-inverse: #E6E5E6;

  --color-primary: #E9BC58;
  --color-primary-hover: #D4A840;
  --color-primary-active: #B88C20;
  --color-primary-highlight: #F5ECC8;
  --color-accent: #030019;
  --color-gold: #E9BC58;
  --color-cyan: #4A4860;

  --action-bg: #030019;
  --action-fg: #E6E5E6;

  --shadow-sm: 0 1px 2px rgba(3,0,25,0.06);
  --shadow-md: 0 4px 12px rgba(3,0,25,0.08);
  --shadow-lg: 0 12px 32px rgba(3,0,25,0.12);

  --radius-sm: 0.25rem; --radius-md: 0.5rem; --radius-lg: 1rem; --radius-xl: 1rem;

  --hero-bg: var(--color-bg);
  --stars-opacity: 0;
  --glow-opacity: 0;
}

/* ══════════════════ THEME 6/6 — ALBERTI DARK (alberti_web navy/gold) ══════════════════ */
html.theme-alberti.dark {
  --color-bg: #030019;
  --color-surface: #070522;
  --color-surface-2: #0C0A2B;
  --color-surface-offset: #110E32;
  --color-surface-dynamic: #161239;
  --color-divider: #1E1A45;
  --color-border: #272350;

  --color-text: #E6E5E6;
  --color-text-muted: #9896AA;
  --color-text-faint: #4E4C6A;
  --color-text-inverse: #030019;

  --color-primary: #E9BC58;
  --color-primary-hover: #D4A840;
  --color-primary-active: #B88C20;
  --color-primary-highlight: #1E1800;
  --color-accent: #E9BC58;
  --color-gold: #E9BC58;
  --color-cyan: #9896AA;

  --action-bg: #E9BC58;
  --action-fg: #030019;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);

  --hero-bg: radial-gradient(ellipse at 50% 0%, #110E32 0%, #030019 70%);
  --stars-opacity: 0.35;
  --glow-opacity: 0.25;
}

/* ══════════════════ APP SHELL ══════════════════ */

#app { position: relative; height: 100vh; overflow: hidden; }

.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  background: var(--color-bg);
}
.screen.active { display: flex; }

.topbar {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
}
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; }
.topbar-points {
  font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--color-primary-highlight); color: var(--color-primary);
}

.scroll-area { flex: 1; overflow-y: auto; padding: 16px 16px calc(env(safe-area-inset-bottom,0px) + 96px); -webkit-overflow-scrolling: touch; }

.screen-intro { color: var(--color-text-muted); font-size: 0.88rem; margin-bottom: 14px; line-height: 1.45; }
.section-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-faint); margin: 20px 0 8px; }

/* ══════════════════ BUTTONS ══════════════════ */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: var(--radius-md); font-size: 0.92rem; font-weight: 600; transition: transform 0.12s ease, opacity 0.15s ease, background 0.2s ease; }
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-primary { background: var(--action-bg); color: var(--action-fg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { opacity: 0.92; }
.btn-ghost { background: var(--color-surface-2); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════ LOGIN ══════════════════ */

#screen-login { justify-content: center; align-items: center; background: var(--hero-bg); position: relative; overflow: hidden; }
html:not(.theme-aqua):not(.theme-alberti.dark) #screen-login { background: var(--color-bg); }
html.theme-alberti.dark #screen-login { background: var(--hero-bg); }

.stars {
  position: absolute; inset: 0; opacity: var(--stars-opacity); pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 15%, #fff, transparent),
    radial-gradient(1px 1px at 40% 70%, #fff, transparent),
    radial-gradient(2px 2px at 85% 55%, #fff, transparent),
    radial-gradient(1px 1px at 10% 80%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 40%, #fff, transparent),
    radial-gradient(1px 1px at 90% 85%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 30% 55%, #fff, transparent);
  background-size: 100% 100%;
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: var(--stars-opacity); } to { opacity: calc(var(--stars-opacity) * 0.5); } }

.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 380px; padding: 24px; }
.wordmark { text-align: center; margin-bottom: 32px; }
.wm-shawpty { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; letter-spacing: 0.02em; color: var(--color-text); }
html.theme-aqua.dark .wm-shawpty { color: #fff; text-shadow: 0 0 24px var(--color-cyan); }
.wm-tag { display: block; margin-top: 4px; font-size: 0.85rem; color: var(--color-text-muted); }
html.theme-aqua.dark .wm-tag { color: var(--color-text-muted); }

.login-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow-lg); }
.login-card.hidden { display: none; }
.login-lede { font-weight: 600; margin-bottom: 14px; text-align: center; }
.login-sub { font-size: 0.85rem; color: var(--color-text-muted); text-align: center; margin-bottom: 18px; line-height: 1.45; }

.login-card input {
  width: 100%; padding: 13px 14px; margin-bottom: 12px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text); font-size: 0.95rem;
}
.login-card input:focus { outline: none; border-color: var(--color-primary); }

.login-divider { display: flex; align-items: center; text-align: center; margin: 16px 0; color: var(--color-text-faint); font-size: 0.78rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--color-divider); }
.login-divider span { padding: 0 10px; }

.pulse-ring { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; background: var(--color-primary-highlight); position: relative; }
.pulse-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--color-primary); opacity: 0.35; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.5; } 100% { transform: scale(2.2); opacity: 0; } }

/* ══════════════════ CLAIM ══════════════════ */

.claim-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; overflow-y: auto; }
.claim-icon { font-size: 2.5rem; margin-bottom: 12px; }
.claim-wrap h2 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 8px; }
.claim-copy { color: var(--color-text-muted); font-size: 0.88rem; margin-bottom: 20px; max-width: 320px; line-height: 1.5; }
.claim-card { width: 100%; max-width: 340px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 22px; box-shadow: var(--shadow-md); }
.claim-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 0.88rem; border-bottom: 1px solid var(--color-divider); }
.claim-row:last-child { border-bottom: none; }
.claim-row span { color: var(--color-text-muted); }
.claim-wrap .btn { max-width: 340px; }

#scan-input {
  width: 100%; padding: 12px 4px; border: none; background: none; color: var(--color-text);
  font-size: 0.95rem; text-align: center;
}
#scan-input:focus { outline: none; }
#scan-input::placeholder { color: var(--color-text-faint); }

/* ══════════════════ REVEAL (animated score + blur-until-payment) ══════════════════ */

.reveal-wrap { gap: 4px; }
.reveal-status {
  font-size: 0.85rem; font-weight: 700; color: var(--color-primary); margin-bottom: 18px;
  min-height: 1.2em; letter-spacing: 0.02em;
}
.reveal-ring { margin-bottom: 6px; width: 120px; height: 120px; }
.reveal-ring .rank-score { font-size: 2rem; }
.reveal-tier {
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
  margin-bottom: 22px; opacity: 0; transition: opacity 0.5s ease;
}
.reveal-tier:not(.hidden) { opacity: 1; }

.reveal-blur-card { position: relative; }
.blur-text { filter: blur(5px); user-select: none; color: var(--color-text-faint); }

.unlock-overlay {
  width: 100%; max-width: 340px; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: 22px 20px; box-shadow: var(--shadow-lg); text-align: center;
  animation: unlock-rise 0.4s ease;
}
@keyframes unlock-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.unlock-icon { font-size: 1.8rem; margin-bottom: 8px; }
.unlock-overlay p { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 16px; line-height: 1.5; }
.unlock-overlay .btn-block + .btn-block { margin-top: 8px; }

/* ══════════════════ EARN TRACK (unlock report pieces, one question per hour) ══════════════════ */

.trial-card {
  background: var(--color-primary-highlight); border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg); padding: 16px; margin-bottom: 24px;
}
.trial-card-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; }
.trial-card .btn[disabled] { opacity: 0.55; cursor: default; }
.trial-bonus-line {
  font-size: 0.76rem; color: var(--color-text-muted); margin: -4px 0 10px; font-weight: 600;
}
.trial-card .btn-block + .btn-block { margin-top: 8px; }

.trial-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; z-index: 60;
}
.trial-backdrop.open { opacity: 1; pointer-events: auto; }
.trial-modal {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  padding: 26px 22px; width: 100%; max-width: 340px; text-align: center; box-shadow: var(--shadow-lg);
  transform: translateY(12px); transition: transform 0.25s ease;
}
.trial-backdrop.open .trial-modal { transform: translateY(0); }
.trial-modal-icon { font-size: 1.8rem; margin-bottom: 8px; }
.trial-modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.trial-modal-timer {
  font-size: 0.78rem; font-weight: 700; color: var(--color-primary); margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.trial-modal-question { font-size: 0.92rem; color: var(--color-text-muted); line-height: 1.5; margin-bottom: 18px; }
.trial-modal-actions .btn-block + .btn-block { margin-top: 8px; }

.trial-guess-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 10px 14px;
}
.trial-guess-row input {
  flex: 1; border: none; background: transparent; font-size: 1.3rem; font-weight: 700;
  color: var(--color-text); font-family: var(--font-display); min-width: 0;
}
.trial-guess-row input:focus { outline: none; }
.trial-guess-unit { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }

#trial-story-row { margin-bottom: 14px; }

.trial-compare { margin-bottom: 14px; text-align: left; }
.trial-compare-row {
  display: flex; justify-content: space-between; align-items: baseline; font-size: 0.86rem;
  padding: 7px 0; border-bottom: 1px solid var(--color-border);
}
.trial-compare-row:last-child { border-bottom: none; }
.trial-compare-row span { color: var(--color-text-muted); }
.trial-compare-row b { font-family: var(--font-display); font-size: 1rem; }

.trial-why {
  font-size: 0.86rem; line-height: 1.55; color: var(--color-text); text-align: left;
  background: var(--color-primary-highlight); border-radius: var(--radius-md); padding: 12px 14px;
  margin-bottom: 18px;
}

.quest-card.locked-preview { opacity: 0.85; }
.quest-title.blur-text, .quest-desc.blur-text { filter: blur(4px); user-select: none; }

/* ══════════════════ HOME — RANK CARD ══════════════════ */

.rank-card {
  display: flex; align-items: center; gap: 16px; padding: 18px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md); margin-bottom: 4px;
}
.rank-ring-wrap { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.rank-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--color-divider); stroke-width: 8; }
.ring-fill { fill: none; stroke: var(--color-primary); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 264; stroke-dashoffset: 264; transition: stroke-dashoffset 0.8s ease; }
html.theme-aqua .ring-fill { stroke: var(--color-cyan); }
.rank-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rank-score { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.rank-score-max { font-size: 0.7rem; color: var(--color-text-faint); }
.rank-info { flex: 1; min-width: 0; }
.rank-tier { font-weight: 700; font-size: 0.95rem; }
.rank-label { font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 8px; }
.xp-bar-track { height: 6px; border-radius: 999px; background: var(--color-divider); overflow: hidden; }
.xp-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--color-primary), var(--color-cyan)); border-radius: 999px; transition: width 0.6s ease; }
.xp-bar-caption { font-size: 0.72rem; color: var(--color-text-faint); margin-top: 4px; }

.next-quest-card {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-lg);
  background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); cursor: pointer;
}
.next-quest-card:active { transform: scale(0.99); }
.nq-icon { font-size: 1.6rem; flex-shrink: 0; }
.nq-title { font-weight: 700; font-size: 0.9rem; }
.nq-sub { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }
.nq-reward { margin-left: auto; font-size: 0.78rem; font-weight: 700; color: var(--color-primary); white-space: nowrap; }

.mini-systems { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-sys { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 6px; text-align: center; }
.mini-sys-icon { font-size: 1.1rem; }
.mini-sys-label { font-size: 0.62rem; color: var(--color-text-muted); margin-top: 4px; display: block; }
.mini-sys-pct { font-size: 0.72rem; font-weight: 700; margin-top: 2px; display: block; }

.log-preview { display: flex; flex-direction: column; gap: 8px; }
.log-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--color-surface); border-radius: var(--radius-md); border: 1px solid var(--color-divider); font-size: 0.82rem; }
.log-row-icon { font-size: 0.95rem; }
.log-row-time { margin-left: auto; font-size: 0.7rem; color: var(--color-text-faint); white-space: nowrap; }

/* ══════════════════ MISSIONS — QUEST LIST ══════════════════ */

.quest-card { display: flex; gap: 12px; padding: 14px; margin-bottom: 10px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); transition: opacity 0.3s ease; }
.quest-card.done { opacity: 0.55; }
.quest-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--color-border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; margin-top: 2px; transition: all 0.2s ease; }
.quest-card.done .quest-check { background: var(--color-primary); border-color: var(--color-primary); color: var(--action-fg); }
.quest-body { flex: 1; min-width: 0; }
.quest-title { font-weight: 700; font-size: 0.92rem; }
.quest-card.done .quest-title { text-decoration: line-through; }
.quest-desc { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 3px; line-height: 1.4; }
.quest-meta { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.quest-chip { font-size: 0.68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--color-primary-highlight); color: var(--color-primary); }
.quest-chip.effort-low { background: var(--color-surface-2); color: var(--color-text-muted); }
.quest-cta { margin-top: 10px; }

/* ══════════════════ SHIP ══════════════════ */

.ship-diagram { position: relative; height: 260px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); margin-bottom: 8px; overflow: hidden; }
html.theme-aqua.dark .ship-diagram { background: radial-gradient(ellipse at 50% 100%, rgba(42,153,255,0.15), transparent 70%), var(--color-surface); }
.ship-silhouette { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 3.2rem; opacity: 0.9; }
.system-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.node-ring { position: relative; width: 44px; height: 44px; }
.node-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.node-ring .ring-fill { stroke-width: 4; stroke-dasharray: 113; stroke-dashoffset: 113; }
.node-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.node-label { font-size: 0.62rem; font-weight: 700; color: var(--color-text-muted); background: var(--color-bg); padding: 2px 6px; border-radius: 999px; white-space: nowrap; }
.sys-hull { stroke: #22c55e; } .sys-life { stroke: #f59e0b; } .sys-comms { stroke: var(--color-cyan); } .sys-nav { stroke: #a855f7; }

.system-list { display: flex; flex-direction: column; gap: 8px; }
.system-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; }
.system-row-icon { font-size: 1.3rem; }
.system-row-name { font-weight: 700; font-size: 0.88rem; }
.system-row-sub { font-size: 0.75rem; color: var(--color-text-muted); }
.system-row-pct { margin-left: auto; font-weight: 800; font-size: 0.95rem; }

/* ══════════════════ REWARDS ══════════════════ */

.tier-toggle { display: flex; background: var(--color-surface-2); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.toggle-btn { flex: 1; padding: 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; color: var(--color-text-muted); transition: all 0.2s ease; }
.toggle-btn.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

.reward-card { display: flex; gap: 12px; align-items: center; padding: 14px; margin-bottom: 10px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.reward-card.locked { opacity: 0.55; }
.reward-icon { font-size: 1.7rem; flex-shrink: 0; }
.reward-title { font-weight: 700; font-size: 0.9rem; }
.reward-sub { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }
.reward-cost { margin-left: auto; text-align: right; font-size: 0.72rem; font-weight: 700; color: var(--color-primary); white-space: nowrap; }

/* ══════════════════ PROFILE ══════════════════ */

.profile-header { text-align: center; padding: 12px 0 20px; }
.profile-avatar { font-size: 3rem; margin-bottom: 8px; }
.profile-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.profile-biz { font-size: 0.85rem; color: var(--color-text-muted); }

.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.pstat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px 6px; text-align: center; }
.pstat-num { display: block; font-size: 1.15rem; font-weight: 800; }
.pstat-label { font-size: 0.65rem; color: var(--color-text-muted); }

.badge-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.badge { flex-shrink: 0; width: 68px; text-align: center; }
.badge-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--color-surface); border: 1px solid var(--color-border); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin: 0 auto 4px; }
.badge.locked .badge-icon { opacity: 0.3; }
.badge-label { font-size: 0.62rem; color: var(--color-text-muted); }

.settings-list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 4px 14px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; font-size: 0.86rem; border-bottom: 1px solid var(--color-divider); }
.settings-row:last-of-type { border-bottom: none; }
.settings-row span:first-child { color: var(--color-text-muted); }
.settings-row-toggle { flex-wrap: wrap; gap: 8px; }
.settings-hint { font-size: 0.72rem; color: var(--color-text-faint); padding: 6px 0 12px; line-height: 1.45; }
#btn-logout { margin: 12px 0 4px; }

.seg-toggle { display: flex; flex-wrap: wrap; background: var(--color-surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-btn { padding: 7px 12px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; color: var(--color-text-muted); white-space: nowrap; transition: all 0.2s ease; }
.seg-btn.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.seg-btn.locked { opacity: 0.45; }
.seg-btn.locked.active { opacity: 0.7; }

/* Quick floating toggle (always visible, top-right) */
.quick-toggle {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 14px; z-index: 40;
  width: 38px; height: 38px; border-radius: 50%; background: var(--color-surface);
  border: 1px solid var(--color-border); box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.qt-icon-light { display: none; }
html.dark .qt-icon-dark { display: inline; }
html.dark .qt-icon-light { display: none; }
html:not(.dark) .qt-icon-dark { display: none; }
html:not(.dark) .qt-icon-light { display: inline; }
#screen-login ~ .quick-toggle, .quick-toggle { }

/* ══════════════════ BOTTOM NAV ══════════════════ */

.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: var(--color-surface); border-top: 1px solid var(--color-divider);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: var(--radius-md); font-size: 0.62rem; font-weight: 700; color: var(--color-text-faint); flex: 1; }
.nav-btn .nav-icon { font-size: 1.25rem; }
.nav-btn.active { color: var(--color-primary); }

/* ══════════════════ SYSTEM CONSOLE SHEET ══════════════════ */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  width: 100%; max-width: 480px; max-height: 82vh; background: var(--color-bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.3s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }

.sheet-handle { width: 36px; height: 4px; border-radius: 999px; background: var(--color-border); margin: 10px auto 4px; }
.sheet-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 18px; }
.sheet-title { font-weight: 800; font-size: 1.05rem; }
.sheet-subtitle { font-size: 0.78rem; color: var(--color-text-muted); }
.sheet-close { width: 30px; height: 30px; border-radius: 50%; background: var(--color-surface-2); font-size: 0.9rem; }

.sheet-tabs { display: flex; gap: 4px; padding: 0 14px 10px; border-bottom: 1px solid var(--color-divider); }
.sheet-tab { flex: 1; padding: 9px 4px; border-radius: var(--radius-md); font-size: 0.78rem; font-weight: 700; color: var(--color-text-muted); }
.sheet-tab.active { background: var(--color-primary-highlight); color: var(--color-primary); }

.sheet-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.sheet-pane { display: none; }
.sheet-pane.active { display: block; }

.mini-task-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--color-divider); font-size: 0.86rem; }
.mini-task-row:last-child { border-bottom: none; }
.mini-task-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--color-border); flex-shrink: 0; }
.mini-task-row.done .mini-task-check { background: var(--color-primary); border-color: var(--color-primary); }
.mini-task-row.done span:not(.mini-task-check) { text-decoration: line-through; color: var(--color-text-faint); }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px; }
.kpi-box-label { font-size: 0.68rem; color: var(--color-text-muted); }
.kpi-box-value { font-size: 1.1rem; font-weight: 800; margin-top: 2px; }

.conf-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px; text-align: center; }
.conf-icon { font-size: 2rem; margin-bottom: 8px; }
.conf-copy { font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 14px; line-height: 1.5; }

.chat-history { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; margin-bottom: 10px; }
.chat-msg { max-width: 82%; padding: 9px 12px; border-radius: var(--radius-lg); font-size: 0.85rem; line-height: 1.4; }
.chat-msg.agent { background: var(--color-surface-2); align-self: flex-start; border: 1px solid var(--color-divider); }
.chat-msg.user { background: var(--color-primary); color: var(--action-fg); align-self: flex-end; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; padding: 11px 14px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font-size: 0.88rem; }
.chat-input-row input:focus { outline: none; border-color: var(--color-primary); }

/* ══════════════════ TOAST ══════════════════ */

.toast {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 16px); left: 50%; z-index: 200;
  transform: translate(-50%, -140%); padding: 12px 20px; border-radius: 999px;
  background: var(--action-bg); color: var(--action-fg); font-weight: 700; font-size: 0.85rem;
  box-shadow: var(--shadow-lg); transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); }

/* ══════════════════ MISC ══════════════════ */

.hidden { display: none !important; }

@media (min-width: 560px) {
  #app { max-width: 480px; margin: 0 auto; box-shadow: 0 0 60px rgba(0,0,0,0.15); }
}
