/* ── CSS Custom Properties (Neon Noir — default) ──────────────────────────── */
:root {
  --sv-bg:          #1a1a2e;
  --sv-surface:     #16213e;
  --sv-card:        #0f3460;
  --sv-card-deep:   #0a1830;
  --sv-track:       #0c1e38;
  --sv-border:      #0f3460;
  --sv-border-hi:   #1a4a8a;
  --sv-border-lo:   #1a1a3a;
  --sv-text:        #eeeeee;
  --sv-text-sub:    #cccccc;
  --sv-text-muted:  #aaaaaa;
  --sv-text-dim:    #555555;
  --sv-accent:      #e94560;
  --sv-accent-h:    #c73652;
  --sv-green:       #4ecca3;
  --sv-green-2:     #7ecfcf;
  --sv-amber:       #f9a825;
  --sv-gold:        #e9a560;
  --sv-btn-bg:      #0f3460;
  --sv-btn-bg-h:    #1a4a8a;
  --sv-btn-2-text:  #ffffff;
  --sv-font:        'Segoe UI', system-ui, sans-serif;
  --sv-radius:      12px;
  --sv-radius-sm:   8px;
  --sv-header-grad: linear-gradient(135deg, #16213e, #0f3460);
  --sv-hud-bg:      rgba(10, 18, 40, 0.55);
  --sv-pulse-glow:  rgba(249, 168, 37, 0.4);
  --sv-footer-bg:   rgba(10, 16, 32, 0.92);
  --sv-modal-bg:    #16213e;
  --sv-modal-border: #e94560;
  --sv-panel-shadow: none;
  --sv-card-shadow: none;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Self-hosted custom emoji (00c-emoji.js). Sized to sit inline like a glyph;
   .sv-emoji-fallback is the system-glyph fallback wrapper when our art 404s. */
/* Layout box stays 1em (so line spacing never changes); the glyph is scaled up
   with a transform — bigger/enjoyable next to text without reflowing lines. */
.sv-emoji { height: 1em; width: 1em; margin: 0 .12em; vertical-align: -0.15em; display: inline-block; object-fit: contain; transform: scale(1.3); transform-origin: center; }
.sv-emoji-fallback { font-style: normal; }
html, body {
  font-family: var(--sv-font);
  background: var(--sv-bg);
  color: var(--sv-text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
body { overflow-x: hidden; padding-bottom: 52px; }
[hidden] { display: none !important; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  background: var(--sv-header-grad);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--sv-accent);
}
.header h1 {
  font-size: 1.4rem;
  color: var(--sv-accent);
  display: flex;
  align-items: center;
  gap: 8px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9), 0 0 16px rgba(0,0,0,0.6);
}
.header-logo {
  height: 48px; width: 48px; object-fit: cover;
  border-radius: 10px; image-rendering: pixelated; flex-shrink: 0;
}
.header .bloodline { font-size: 0.85rem; color: var(--sv-text-muted); text-shadow: 0 1px 4px rgba(0,0,0,0.9); }
.header-hud {
  background: var(--sv-hud-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 8px 12px;
  position: relative;
  z-index: 1;
}
.header-hud * { text-shadow: 0 1px 4px rgba(0,0,0,0.85); }

/* ── Main grid ───────────────────────────────────────────────────────────── */
.main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px; padding: 12px;
  width: 100%; max-width: 1400px; margin: 0 auto;
}
@media (min-width: 760px)  { .main { grid-template-columns: 1fr 1fr; gap: 14px; } }
@media (min-width: 1000px) { .main { grid-template-columns: 280px 1fr 300px; gap: 16px; padding: 16px; } }

/* Welcome-gate shared content styles (the gate overlay itself is #welcome-gate,
   styled inline in index_v2.html so it paints first). These also style the login
   form when it is raised above the welcome gate. */
/* Login modal raised above the welcome gate: opaque backdrop matching the gate
   so the un-chosen game still never shows while signing in. */
.modal-overlay.sv-over-welcome {
  background: linear-gradient(135deg, #16213e, #0f3460);
  z-index: 100002;           /* above #welcome-gate (100001) */
}
/* Calm the entry-flow auth modals (login / register / forgot) to the welcome's
   blue+green theme instead of the app's red accent — they're the draw-in screen.
   Scoped to .sv-over-welcome so in-game modals keep the normal app styling. */
.modal-overlay.sv-over-welcome .modal {
  border: 3px solid #1a4a8a;
  box-shadow: 0 0 32px rgba(78,204,163,.18);
}
.modal-overlay.sv-over-welcome .modal h3 { color: #4ecca3; }
.modal-overlay.sv-over-welcome .modal .btn-primary {
  background: #4ecca3; color: #0a1830;
}
.modal-overlay.sv-over-welcome .modal .btn-primary:hover { background: #3bb18c; }
/* Green focus ring on the inputs instead of the red accent border. */
.modal-overlay.sv-over-welcome .modal .auth-form input:focus {
  border-color: #4ecca3;
  box-shadow: 0 0 0 2px rgba(78,204,163,.25);
}
/* Entry-flow accent links (Sign up / Log in cross-links) now use var(--sv-accent)
   in the markup, so they follow the theme — no e94560 override needed here. */
.entry-gate-icon {
  width: 84px; height: 84px; image-rendering: pixelated;
  border: 4px solid #0a1830; border-radius: 10px;
  box-shadow: 0 0 0 4px #1a4a8a, 0 0 26px rgba(78,204,163,.35);
  animation: bl-bob 1.6s ease-in-out infinite; /* same bob as the loader icon */
}
.entry-gate-title {
  font-size: 1.7rem; font-weight: 800; letter-spacing: .06em;
  color: #eee; text-shadow: 3px 3px 0 #0a1830; margin: 0;
}
.entry-gate-tagline {
  color: #7ecfcf; font-size: 0.84rem; line-height: 1.45; margin: 0;
}
.entry-gate-buttons {
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}
.entry-gate-buttons .btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 13px 20px; font-size: 0.95rem; font-weight: 700;
}
.entry-gate-guest { background: #4ecca3; color: #0a1830; }
.entry-gate-guest:hover { background: #3bb18c; }
.entry-gate-signin {
  background: rgba(26,74,138,.4); color: #dbe7ff; border: 1px solid #1a4a8a;
}
.entry-gate-signin:hover { background: rgba(26,74,138,.6); }
.entry-gate-sub { font-size: 0.68rem; font-weight: 500; opacity: 0.85; color: inherit; }
.entry-gate-links { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.entry-gate-dot { color: #4a6b8a; font-size: 0.78rem; }
.entry-gate-link { color: #7ecfcf; font-size: 0.78rem; text-decoration: underline; }
.entry-gate-link:hover { color: #fff; }
@media (prefers-reduced-motion: reduce) { .entry-gate-icon { animation: none; } }

/* ── Panel ───────────────────────────────────────────────────────────────── */
.panel {
  background: var(--sv-surface);
  border-radius: var(--sv-radius);
  padding: 16px;
  border: 1px solid var(--sv-border);
  min-width: 0;
  box-shadow: var(--sv-panel-shadow);
}
.panel h2 {
  font-size: 1rem;
  color: var(--sv-accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sv-border);
}

/* ── Stat rows ───────────────────────────────────────────────────────────── */
.stat-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--sv-border-lo); font-size: 0.9rem; }
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--sv-text-muted); }
.stat-value { font-weight: bold; color: var(--sv-text); }
.stat-value.money   { color: var(--sv-green); }
.stat-value.danger  { color: var(--sv-accent); }
.stat-value.warning { color: var(--sv-amber); }
.stat-value.good    { color: var(--sv-green); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: block; width: 100%; padding: 12px 16px; margin: 6px 0;
  border: none; border-radius: var(--sv-radius-sm); cursor: pointer;
  font-size: 0.9rem; font-weight: bold; min-height: 44px;
  transition: all 0.2s; touch-action: manipulation;
  font-family: var(--sv-font);
}
/* Compact buttons for inline/horizontal rows. The base .btn is full-width
   (mobile-first for modal CTAs) — any button living INSIDE a flex row must add
   .btn-compact or it blows the row out to 100% width and crushes its siblings
   (the "giant Go button" bug, reported 2026-06-10). */
.btn-compact {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; min-height: 34px; padding: 6px 12px; margin: 0;
}
.btn-primary { background: var(--sv-accent); color: #fff; }
.btn-primary:hover { background: var(--sv-accent-h); }
.btn-secondary { background: var(--sv-btn-bg); color: var(--sv-btn-2-text); }
.btn-secondary:hover { background: var(--sv-btn-bg-h); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Belts for the .btn-compact suspenders — a full-width .btn must never blow out
   a flex row:
   1. inside any inline display:flex parent, allow shrink;
   2. a .btn pinned with flex:0 0 auto (no shrink) gets width:auto, otherwise its
      100% width overflows the container (the "giant Go button" failure mode). */
[style*="display:flex"] > .btn { min-width: 0; }
.btn[style*="flex:0 0 auto"],
.btn[style*="flex: 0 0 auto"] { width: auto; }

/* Tappable job-requirement chips (degree/cert → Life-tab listing; skill →
   "which jobs teach this" panel). Inline, with a little extra tap padding. */
.req-link {
  cursor: pointer;
  color: #9fc2ff;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  padding: 1px 2px;
  border-radius: 3px;
}
.req-link:hover, .req-link:active { color: #cfe3ff; background: rgba(74, 144, 226, 0.12); }

/* ── Job list ────────────────────────────────────────────────────────────── */
.job-list { max-height: 400px; overflow-y: auto; }
.job-item {
  padding: 10px; margin: 6px 0;
  background: var(--sv-card);
  border-radius: var(--sv-radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  border: 1px solid transparent;
}
.job-item:hover { border-color: var(--sv-gold); background: color-mix(in srgb, var(--sv-card) 80%, var(--sv-surface)); }
.job-item.locked { opacity: 0.4; cursor: not-allowed; }
.job-item.current { border-color: var(--sv-green); background: color-mix(in srgb, var(--sv-card) 80%, var(--sv-surface)); }
.job-title { font-weight: bold; font-size: 0.9rem; }
.job-salary { font-size: 0.8rem; color: var(--sv-green); }
.job-req { font-size: 0.75rem; color: var(--sv-text-muted); margin-top: 4px; }

/* ── Happiness bars ──────────────────────────────────────────────────────── */
.happiness-bars { margin-top: 8px; }
.happiness-bar { display: flex; align-items: center; margin: 4px 0; font-size: 0.75rem; }
.happiness-bar .label { width: 100px; color: var(--sv-text-muted); }
.happiness-bar .bar { flex: 1; height: 8px; background: var(--sv-card); border-radius: 4px; overflow: hidden; margin: 0 8px; }
.happiness-bar .bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.happiness-bar .value { width: 30px; text-align: right; font-size: 0.75rem; }

/* ── Family panel ────────────────────────────────────────────────────────── */
.family-panel { max-height: 300px; overflow-y: auto; }
.family-member {
  padding: 8px; margin: 4px 0;
  background: var(--sv-card);
  border-radius: var(--sv-radius-sm);
  cursor: pointer; font-size: 0.85rem;
}
.family-member:hover { background: var(--sv-btn-bg-h); }

/* ── Notifications ───────────────────────────────────────────────────────── */
#notification-stack {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 350px; pointer-events: none;
}
.notification {
  padding: 12px 20px; background: var(--sv-accent); color: #fff;
  border-radius: var(--sv-radius-sm); font-size: 0.85rem;
  animation: slideIn 0.3s ease; pointer-events: auto; cursor: pointer;
}
.notification.good    { background: var(--sv-green); color: #000; }
.notification.warning { background: var(--sv-amber); color: #000; }
.notification.dismissing { animation: slideOut 0.25s ease forwards; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }

/* ── Action progress bar ─────────────────────────────────────────────────── */
#action-progress {
  position: fixed; left: 50%; bottom: 64px;
  transform: translate(-50%, 16px);
  width: min(360px, calc(100vw - 24px));
  background: var(--sv-card-deep);
  border: 1px solid var(--sv-border-hi);
  border-radius: var(--sv-radius-sm);
  padding: 10px 12px; opacity: 0;
  pointer-events: none; z-index: 1200;
  transition: opacity 0.16s ease, transform 0.16s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
#action-progress.active { opacity: 1; transform: translate(-50%, 0); }
.action-progress-label { font-size: 0.78rem; color: var(--sv-text-sub); margin-bottom: 6px; }
.action-progress-track { height: 6px; background: var(--sv-card); border-radius: 99px; overflow: hidden; }
.action-progress-bar { width: 12%; height: 100%; background: linear-gradient(90deg, var(--sv-green), var(--sv-green-2)); border-radius: 99px; transition: width 0.08s linear; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 999;
  justify-content: center; align-items: center; padding: 12px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--sv-modal-bg);
  border-radius: var(--sv-radius);
  padding: 20px; max-width: 600px; width: 100%;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px); /* dvh tracks the visible viewport so a tall modal's sticky header (✕) never hides behind mobile browser chrome */
  overflow-y: auto;
  border: 2px solid var(--sv-modal-border);
  -webkit-overflow-scrolling: touch;
}
.modal h3 { color: var(--sv-accent); margin-bottom: 12px; }
.modal p { margin: 8px 0; font-size: 0.9rem; }
.modal .close-btn { float: right; background: none; border: none; color: var(--sv-text-muted); font-size: 1.2rem; cursor: pointer; }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.tab-bar-scroll {
  overflow-x: auto; overflow-y: hidden;
  margin-bottom: 12px;
  scrollbar-width: thin; scrollbar-color: var(--sv-card) transparent;
  padding-bottom: 2px;
}
.tab-bar-scroll::-webkit-scrollbar { height: 4px; }
.tab-bar-scroll::-webkit-scrollbar-thumb { background: var(--sv-card); border-radius: 2px; }
.tab-bar { display: flex; gap: 4px; flex-wrap: nowrap; min-width: max-content; }

/* Desktop tab-bar scroll hints — a fade + chevron appears at an edge when more
   tabs are scrolled off-screen that way (the bar scrolls horizontally). Wrapper
   + toggled classes are added by _initTabScrollHints() in 00-state-time.js. */
.sv-tabscroll { position: relative; }
.sv-tabfade {
  position: absolute; top: 0; bottom: 6px; width: 32px; z-index: 3;
  pointer-events: none; opacity: 0; transition: opacity .18s ease;
  display: flex; align-items: center; color: var(--sv-accent, #9ab);
  font-size: 1.3rem; font-weight: 800;
}
.sv-tabfade-l { left: 0;  justify-content: flex-start; background: linear-gradient(to right, var(--sv-bg) 40%, transparent); }
.sv-tabfade-r { right: 0; justify-content: flex-end;   background: linear-gradient(to left,  var(--sv-bg) 40%, transparent); }
.sv-tabfade-l::after { content: '‹'; }
.sv-tabfade-r::after { content: '›'; }
.sv-tabscroll.can-l .sv-tabfade-l { opacity: 0.9; }
.sv-tabscroll.can-r .sv-tabfade-r { opacity: 0.9; }
.tab {
  padding: 6px 12px; background: var(--sv-card); border: none;
  color: var(--sv-text-muted); cursor: pointer;
  border-radius: 8px 8px 0 0; font-size: 0.75rem;
  white-space: nowrap; flex-shrink: 0;
  font-family: var(--sv-font);
}
.tab.active { background: var(--sv-surface); color: var(--sv-accent); border-bottom: 2px solid var(--sv-accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Work harder button ──────────────────────────────────────────────────── */
.btn-work {
  background: linear-gradient(135deg, #f9a825, #ff6f00);
  color: #000; font-weight: bold;
  animation: pulse 2s infinite;
}
.btn-work:hover { background: linear-gradient(135deg, #ffb300, #ff8f00); transform: scale(1.02); }
.btn-work:active { transform: scale(0.98); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--sv-pulse-glow); }
  50% { box-shadow: 0 0 12px 4px var(--sv-pulse-glow); }
}

/* ── Death screen ────────────────────────────────────────────────────────── */
.death-screen { text-align: center; padding: 40px; }
.death-screen h2 { font-size: 2rem; color: var(--sv-accent); margin-bottom: 16px; }
.death-screen .life-review { font-size: 1.1rem; margin: 16px 0; line-height: 1.6; }
.death-screen .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }

/* ── Life tab drawers ────────────────────────────────────────────────────── */
.life-drawer { border: 1px solid var(--sv-border-hi); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.life-drawer summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  background: var(--sv-card-deep); font-size: 0.9rem; font-weight: bold;
  color: var(--sv-text-sub); display: flex; align-items: center; gap: 8px; user-select: none;
}
.life-drawer summary::-webkit-details-marker { display: none; }
.life-drawer summary::before { content: '▶'; font-size: 0.65rem; color: var(--sv-green); transition: transform 0.2s; }
.life-drawer[open] summary::before { transform: rotate(90deg); }
.life-drawer summary:hover { background: var(--sv-card); }
.life-drawer-body { padding: 12px 14px; }
.life-drawer-body h4 {
  font-size: 0.82rem; color: var(--sv-green-2);
  text-transform: uppercase; letter-spacing: 0.05em; margin: 12px 0 6px;
}
.life-drawer-body h4:first-child { margin-top: 0; }
.life-subdrawer { border: 1px solid var(--sv-border); border-radius: 7px; margin-bottom: 8px; margin-left: 16px; overflow: hidden; }
.life-subdrawer summary {
  list-style: none; cursor: pointer; padding: 8px 12px;
  background: var(--sv-card-deep); font-size: 0.82rem; font-weight: bold;
  color: var(--sv-text-muted); display: flex; align-items: center; gap: 6px; user-select: none;
}
.life-subdrawer summary::-webkit-details-marker { display: none; }
.life-subdrawer summary::before { content: '▶'; font-size: 0.58rem; color: var(--sv-green); transition: transform 0.2s; }
.life-subdrawer[open] summary::before { transform: rotate(90deg); }
.life-subdrawer summary:hover { background: var(--sv-card); }
.life-subdrawer-body { padding: 10px 12px; }

/* ── Activities ──────────────────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item { padding: 10px 12px; background: var(--sv-card); border-radius: var(--sv-radius-sm); border: 1px solid transparent; }
.activity-item:hover { border-color: var(--sv-green); }
.activity-item .act-header { display: flex; justify-content: space-between; align-items: center; }
.activity-item .act-label  { font-weight: bold; font-size: 0.9rem; }
.activity-item .act-cost   { font-size: 0.8rem; color: var(--sv-green); }
.activity-item .act-desc   { font-size: 0.78rem; color: var(--sv-text-muted); margin: 4px 0 6px; }
.activity-item .act-effects { font-size: 0.72rem; color: #9a9; }
.activity-item .act-duration { font-size: 0.72rem; color: var(--sv-green-2); margin-left: 6px; }
.activity-item .act-btn    { padding: 6px 14px; font-size: 0.8rem; min-height: 36px; margin: 0; }
.act-cooldown-bar      { height: 4px; background: var(--sv-card-deep); margin: 4px 0 0; overflow: hidden; border-radius: 2px; }
.act-cooldown-bar-fill { height: 100%; background: linear-gradient(90deg, var(--sv-green), var(--sv-green-2)); transition: width 1s linear; }
.act-cooldown-label    { font-size: 0.68rem; color: var(--sv-text-dim); margin-top: 3px; text-align: right; }

/* ── Nudge banners ───────────────────────────────────────────────────────── */
.nudge-banner { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: var(--sv-radius-sm); margin-bottom: 8px; font-size: 0.82rem; gap: 8px; }
.nudge-banner.work    { background: #2a3a0a; border: 1px solid #8bc34a; color: #c5e1a5; }
.nudge-banner.bedtime { background: #1a1a3a; border: 1px solid #7986cb; color: #c5cae9; }
.nudge-banner.health  { background: #3a1a1a; border: 1px solid #ef5350; color: #ffcdd2; }
.nudge-banner.career  { background: #2a2808; border: 1px solid #ffc107; color: #fff9c4; }
.nudge-banner.finance { background: #08201a; border: 1px solid #26a69a; color: #b2dfdb; }
.nudge-banner.energy  { background: #1a1a2a; border: 1px solid #9575cd; color: #e1bee7; }
.nudge-banner.action-btn { padding: 4px 10px; font-size: 0.75rem; min-height: 28px; background: rgba(255,255,255,0.15); border: none; border-radius: 6px; color: inherit; cursor: pointer; flex-shrink: 0; }

/* ── Progress hooks ─────────────────────────────────────────────────────── */
.progress-hooks { margin: 10px 0 12px; padding: 10px; background: #081826; border: 1px solid #18324a; border-radius: var(--sv-radius-sm); }
.progress-hooks-title { font-size: 0.72rem; color: #8ab; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; font-weight: 700; }
.progress-hook { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; padding: 8px 10px; margin: 0 0 6px; background: #0d2234; border: 1px solid #1f425e; color: var(--sv-text); border-radius: 6px; cursor: pointer; }
.progress-hook:last-child { margin-bottom: 0; }
.progress-hook strong { display: block; font-size: 0.8rem; color: #f2f7ff; }
.progress-hook em { display: block; font-style: normal; font-size: 0.72rem; color: var(--sv-text-muted); margin-top: 2px; }
.progress-hook b { font-size: 0.7rem; color: var(--sv-green); white-space: nowrap; }
.progress-hook:hover { border-color: #2d6f96; background: #102b42; }

/* ── Daily focus goals ───────────────────────────────────────────────────── */
.daily-focus-goals { margin-bottom: 12px; }
.dfg-header { font-size: 0.78rem; font-weight: 700; color: var(--sv-gold); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.dfg-list { display: flex; flex-direction: column; gap: 6px; }
.dfg-goal { display: flex; align-items: flex-start; gap: 10px; background: var(--sv-card); border: 1px solid var(--sv-border); border-radius: var(--sv-radius-sm); padding: 8px 10px; }
.dfg-goal.p1 { border-left: 3px solid var(--sv-accent); }
.dfg-goal.p2 { border-left: 3px solid var(--sv-amber); }
.dfg-goal.p3 { border-left: 3px solid var(--sv-green); }
.dfg-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.dfg-text { flex: 1; min-width: 0; }
.dfg-title { font-size: 0.82rem; font-weight: 600; color: var(--sv-text); }
.dfg-desc { font-size: 0.72rem; color: var(--sv-text-muted); margin-top: 2px; line-height: 1.35; }
.dfg-empty { font-size: 0.75rem; color: var(--sv-text-dim); text-align: center; padding: 8px; }

/* ── Catchup digest modal ────────────────────────────────────────────────── */
.digest-header { font-size: 1.1rem; font-weight: bold; color: var(--sv-accent); margin-bottom: 14px; }
.digest-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.digest-stat { background: var(--sv-card); border-radius: var(--sv-radius-sm); padding: 10px 12px; }
.digest-stat .ds-label { font-size: 0.7rem; color: var(--sv-text-muted); margin-bottom: 2px; }
.digest-stat .ds-value { font-size: 1.1rem; font-weight: 700; }
.ds-pos { color: var(--sv-green); } .ds-neg { color: var(--sv-accent); } .ds-neu { color: var(--sv-text-muted); }
.digest-events { max-height: 160px; overflow-y: auto; margin-bottom: 12px; }
.digest-event { font-size: 0.8rem; padding: 4px 0; border-bottom: 1px solid var(--sv-border-lo); color: var(--sv-text-sub); }
.digest-event:last-child { border-bottom: none; }
.digest-next-action { background: var(--sv-card-deep); border: 1px solid var(--sv-border-hi); border-left: 3px solid var(--sv-gold); border-radius: var(--sv-radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.dna-label { font-size: 0.68rem; font-weight: 700; color: var(--sv-gold); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.dna-text { font-size: 0.85rem; color: var(--sv-text); line-height: 1.4; }

.auth-backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.auth-backup-codes code { display: block; text-align: center; background: var(--sv-card-deep); border: 1px solid var(--sv-border-hi); border-radius: var(--sv-radius-sm); padding: 8px; color: var(--sv-gold); font-size: 0.82rem; letter-spacing: 0.04em; }

/* ── Housing ─────────────────────────────────────────────────────────────── */
.home-card { background: var(--sv-card); border-radius: 10px; padding: 14px; margin-bottom: 12px; border: 1px solid var(--sv-border-hi); }
.home-card .home-name { font-weight: bold; font-size: 1rem; color: var(--sv-text); }
.home-card .home-desc { font-size: 0.82rem; color: var(--sv-text-muted); margin: 6px 0; }
.home-card .home-stats { font-size: 0.78rem; color: var(--sv-green); }
.home-card .amenity-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.amenity-tag { padding: 2px 8px; background: var(--sv-surface); border-radius: 4px; font-size: 0.7rem; color: var(--sv-text-muted); border: 1px solid var(--sv-border); }
.home-option { background: var(--sv-card); border-radius: var(--sv-radius-sm); padding: 10px; margin: 6px 0; cursor: pointer; border: 1px solid transparent; transition: border-color 0.2s; }
.home-option:hover   { border-color: var(--sv-accent); }
.home-option.current { border-color: var(--sv-green); }
.home-option .ho-name { font-weight: bold; font-size: 0.88rem; }
.home-option .ho-cost { font-size: 0.78rem; color: var(--sv-green); }
.home-option .ho-desc { font-size: 0.75rem; color: var(--sv-text-muted); margin-top: 2px; }

/* ── Career Paths ────────────────────────────────────────────────────────── */
.career-category { margin-bottom: 10px; border: 1px solid var(--sv-border); border-radius: var(--sv-radius-sm); overflow: hidden; }
.career-cat-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--sv-card); cursor: pointer; font-weight: 600; font-size: 0.9rem; user-select: none; }
.career-cat-header:hover { background: var(--sv-btn-bg-h); }
.career-chevron { font-size: 0.7rem; color: var(--sv-text-muted); }
.career-path { margin: 6px 0 10px 4px; }
.career-path-name { font-size: 0.82rem; font-weight: 600; color: var(--sv-gold); margin-bottom: 6px; }
.career-path-desc { font-size: 0.72rem; color: var(--sv-text-muted); font-weight: 400; margin-left: 6px; }
.career-branches { display: grid; gap: 8px; }
.career-branch { padding: 6px 0 8px 8px; border-left: 2px solid var(--sv-border-hi); }
.career-branch-label { color: #a0c4ff; font-size: 0.72rem; font-weight: 600; margin-bottom: 5px; }
.career-track { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px; }
.career-arrow { color: var(--sv-text-dim); font-size: 0.8rem; align-self: center; padding: 0 2px; }
.job-node { display: flex; flex-direction: column; align-items: center; background: var(--sv-surface); border: 1px solid var(--sv-border-hi); border-radius: 6px; padding: 5px 8px; cursor: pointer; font-size: 0.75rem; min-width: 76px; max-width: 96px; text-align: center; transition: border-color 0.15s; }
.job-node:hover       { border-color: var(--sv-gold); }
.job-node.active-job  { border-color: var(--sv-green); background: color-mix(in srgb, var(--sv-card) 50%, #002a1a); }
.job-node.held-job    { border-color: #a0c4ff; background: color-mix(in srgb, var(--sv-card) 50%, #001a2a); }
.job-node.unlockable  { border-color: #4a6a4a; }
.job-node.locked-job  { opacity: 0.5; }
.job-tier-badge { font-size: 0.6rem; background: var(--sv-card); padding: 1px 4px; border-radius: 3px; color: var(--sv-text-muted); margin-bottom: 2px; }
.job-node-title { font-size: 0.7rem; line-height: 1.2; color: var(--sv-text-sub); }
.job-detail-panel { background: var(--sv-card-deep); border: 1px solid var(--sv-border-hi); border-radius: 6px; padding: 8px 10px; margin: 2px 0 4px 0; font-size: 0.75rem; flex-basis: 100%; }

/* ── Finance Tab ─────────────────────────────────────────────────────────── */
.finance-section { margin-bottom: 18px; }
.finance-section h3 { margin: 0 0 10px; font-size: 0.92rem; color: var(--sv-gold); }
.finance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.finance-grid.two-col { grid-template-columns: 1fr 1fr; }
.finance-card { background: var(--sv-card); border-radius: var(--sv-radius-sm); padding: 12px; border: 1px solid var(--sv-border-hi); box-shadow: var(--sv-card-shadow); }
.fc-label { font-size: 0.72rem; color: var(--sv-text-muted); margin-bottom: 4px; }
.fc-value { font-size: 1.2rem; font-weight: 700; }
.fc-sub { font-size: 0.65rem; color: var(--sv-text-dim); margin-top: 2px; }
.finance-col-header { font-weight: 600; font-size: 0.78rem; margin-bottom: 6px; }
.finance-row { display: flex; justify-content: space-between; font-size: 0.78rem; padding: 3px 0; border-bottom: 1px solid var(--sv-border-lo); color: var(--sv-text-sub); }
.finance-row.total { font-weight: 600; color: var(--sv-text); border-bottom: none; margin-top: 4px; }
.finance-net-worth { display: flex; justify-content: space-between; align-items: center; background: var(--sv-card); border-radius: var(--sv-radius-sm); padding: 12px; margin-top: 10px; font-weight: 600; }
.utility-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.utility-table th { text-align: left; padding: 4px 8px; color: var(--sv-text-muted); font-size: 0.72rem; border-bottom: 1px solid var(--sv-border-lo); }
.utility-table td { padding: 5px 8px; border-bottom: 1px solid var(--sv-track); vertical-align: middle; }

/* ── Rewarded Ads / Life Credits ─────────────────────────────────────────── */
.ad-reward-card { background: var(--sv-card); border: 1px solid var(--sv-border-hi); border-radius: var(--sv-radius-sm); padding: 10px; font-size: 0.78rem; }
.ad-reward-row  { display: flex; justify-content: space-between; color: var(--sv-text-muted); margin-bottom: 5px; }
.ad-reward-row strong { color: var(--sv-green); }
.ad-reward-note { color: var(--sv-text-dim); font-size: 0.68rem; margin: 4px 0 8px; line-height: 1.35; }
.lc-meter { display: grid; gap: 4px; margin: 6px 0 8px; }
.lc-row { display: grid; grid-template-columns: repeat(10, minmax(12px, 1fr)); gap: 3px; }
.lc-emerald {
  height: 11px;
  border-radius: 3px;
  border: 1px solid rgba(78,204,163,0.35);
  background: rgba(78,204,163,0.08);
  box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
}
.lc-emerald.full {
  background: linear-gradient(180deg, #9cffd8, #23c483 52%, #08784f);
  box-shadow: 0 0 8px rgba(78,204,163,0.55), inset 0 0 7px rgba(255,255,255,0.55);
}
.lc-emerald.partial {
  background: linear-gradient(180deg, rgba(156,255,216,0.55), rgba(35,196,131,0.35));
  box-shadow: inset 0 0 6px rgba(156,255,216,0.35);
}
.lc-emerald.locked {
  border-color: rgba(160,170,185,0.22);
  background: rgba(130,140,150,0.08);
  box-shadow: inset 0 0 3px rgba(0,0,0,0.7);
}
.lc-row-bonus .lc-emerald:not(.locked) { border-color: rgba(152,152,232,0.5); }
.lc-emerald.spent { animation: lcSpend 1.15s ease-out; }
@keyframes lcSpend {
  0% { background: #ecfff6; box-shadow: 0 0 4px #fff, 0 0 20px #4ecca3, inset 0 0 10px #fff; }
  55% { background: #39ffc0; box-shadow: 0 0 18px #4ecca3, inset 0 0 14px #fff; }
  70% { background: #ffffff; box-shadow: 0 0 26px #ffffff, 0 0 18px #4ecca3; }
  100% { background: rgba(78,204,163,0.08); box-shadow: inset 0 0 4px rgba(0,0,0,0.6); }
}
.ad-perk-btn { font-size: 0.72rem; padding: 7px 9px; min-height: 34px; text-align: left; }
.ad-perk-btn span { display: block; color: var(--sv-text-muted); font-weight: normal; font-size: 0.66rem; margin-top: 2px; line-height: 1.25; }
body.ad-playing { overflow: hidden; }

/* ── Schedule Preview ────────────────────────────────────────────────────── */
.schedule-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.schedule-grid { display: grid; grid-template-columns: 60px repeat(7, minmax(40px, 1fr)); gap: 2px; margin: 12px 0; font-size: 0.7rem; min-width: 360px; }
.schedule-header { background: var(--sv-card); padding: 4px; text-align: center; font-weight: bold; color: var(--sv-text-muted); }
.schedule-label  { background: var(--sv-card); padding: 4px; text-align: right; color: var(--sv-text-muted); display: flex; align-items: flex-end; justify-content: flex-end; }
.schedule-cell   { background: var(--sv-bg); padding: 2px; text-align: center; min-height: 20px; }
.schedule-cell.work     { background: #2a4a2a; }
.schedule-cell.conflict { background: #4a2a2a; }
.schedule-cell.new      { background: #2a4a6a; }
.schedule-cell.both     { background: #4a4a2a; }
.schedule-legend { display: flex; gap: 12px; margin: 8px 0; font-size: 0.7rem; }
.schedule-legend span { display: flex; align-items: center; gap: 4px; }
.legend-box { width: 12px; height: 12px; border-radius: 2px; }
.legend-box.existing { background: #2a4a2a; }
.legend-box.new      { background: #2a4a6a; }
.legend-box.conflict { background: #4a2a2a; }
.legend-box.both     { background: #4a4a2a; }
.schedule-summary { margin: 8px 0; padding: 8px; background: var(--sv-card); border-radius: var(--sv-radius-sm); font-size: 0.75rem; }
.schedule-summary .warn  { color: var(--sv-amber); }
.schedule-summary .error { color: var(--sv-accent); }
.schedule-summary .ok    { color: var(--sv-green); }

/* ── Auth widget ─────────────────────────────────────────────────────────── */
.auth-widget { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; }
.auth-widget .auth-name  { color: var(--sv-green); font-weight: 600; }
.auth-name-btn { border: 0; background: transparent; padding: 2px 0; cursor: pointer; font-family: var(--sv-font); }
.auth-name-btn:hover { text-decoration: underline; }
.auth-widget .auth-guest { color: var(--sv-text-dim); }
.auth-btn { padding: 4px 10px; border: 1px solid rgba(255,255,255,0.25); border-radius: 6px; background: rgba(255,255,255,0.08); color: var(--sv-text-sub); cursor: pointer; font-size: 0.75rem; transition: background 0.15s; font-family: var(--sv-font); }
.auth-btn:hover { background: rgba(255,255,255,0.18); }
.auth-icon-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.06); color: var(--sv-text-muted); font-size: 0.9rem; cursor: pointer; font-family: var(--sv-font); transition: transform 0.15s, filter 0.15s; }
.auth-login-icon { background: rgba(46, 204, 113, 0.18); color: #c8f7d4; }
.auth-logout-icon { background: rgba(231, 76, 60, 0.18); color: #ffd7d2; }
.auth-icon-btn:hover { transform: translateY(-1px); filter: brightness(1.12); }
.auth-save-btn { border-color: rgba(78,204,163,0.55); color: #d9fff3; }
.social-auth-block { margin: 8px 0 10px; }
.social-auth-buttons { display: grid; gap: 7px; }
.social-auth-btn { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; border: 1px solid var(--sv-border-hi); background: #f7f7fb; color: #111827; font-weight: 700; cursor: pointer; font-family: var(--sv-font); }
.social-auth-btn span:first-child { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #111; font-weight: 800; }
.social-auth-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(1); }
.social-note { color: #666; font-size: 0.7rem; font-weight: 500; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: #777; font-size: 0.72rem; margin: 10px 0 2px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--sv-border); }
.auth-form label { display: block; font-size: 0.8rem; color: var(--sv-text-muted); margin: 10px 0 4px; }
.auth-form input { width: 100%; padding: 8px 10px; background: var(--sv-card); border: 1px solid var(--sv-border-hi); border-radius: 6px; color: var(--sv-text); font-size: 0.9rem; font-family: var(--sv-font); }
.auth-form .auth-check { display: flex; align-items: center; gap: 8px; color: var(--sv-text-sub); }
.auth-form .auth-check input { width: auto; min-width: 18px; height: 18px; padding: 0; }
.auth-mfa-box { margin-top: 8px; padding: 10px; border: 1px solid var(--sv-border-hi); border-radius: var(--sv-radius-sm); background: rgba(15,52,96,0.45); }
.auth-help { font-size: 0.78rem; color: var(--sv-text-muted); line-height: 1.35; margin: 6px 0; overflow-wrap: anywhere; }
.auth-help code { display: block; margin-top: 4px; color: var(--sv-text); background: var(--sv-card-deep); padding: 6px; border-radius: 4px; }
.auth-form input:focus { outline: none; border-color: var(--sv-accent); }
.auth-form .auth-error { color: var(--sv-accent); font-size: 0.8rem; margin-top: 6px; min-height: 18px; }

/* ── Sky Header ──────────────────────────────────────────────────────────── */
/* z-index 150 keeps the header above the drawer overlay (98) and panel (100) */
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 150; overflow: hidden; transition: background 2s ease, height 0.45s ease; }
/* Expanded "look-around" sky: covers content/footer (≤360) but stays below modals (10000) */
.header.sky-expanded { z-index: 400; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.header.sky-expanded.sky-dragging { cursor: grabbing; }
/* Desktop full-sky: pin the HUD boxes to the TOP corners (default align-items:center floats
   them to mid-height, where they block the view). justify-content:space-between already
   splits them left/right. Mobile uses a different column layout, so scope to desktop. */
@media (min-width: 760px) {
  .header.sky-expanded { align-items: flex-start; align-content: flex-start; }
}
#sky-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.header > * { position: relative; z-index: 1; }
/* Auto-fading hint shown when the sky is expanded */
.sky-look-hint { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 401;
  background: rgba(8,12,28,0.72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  color: #cfe; font: 12px/1.3 system-ui, -apple-system, sans-serif; padding: 6px 14px; border-radius: 14px;
  pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.sky-look-hint.show { opacity: 1; }

/* ── Mobile header: top info strip + bottom sky zone ───────────────────── */
/* Desktop: .hud-strip has display:contents so its children participate
   directly in .header's flex layout — no visual change on wide screens.
   Mobile: .header becomes a flex-column; .hud-strip becomes an opaque info
   bar; .sky-zone is a transparent window where the sky canvas shows. */
.hud-strip { display: contents; }
.sky-zone  { display: none; }

@media (max-width: 759px) {
  .header {
    flex-direction: column;
    padding: 0;
    gap: 0;
    align-items: stretch;
  }
  /* Opaque info bar — readable on top of any sky background */
  .hud-strip {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    background: rgba(8, 15, 35, 0.90);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 6px 8px;
    gap: 6px;
  }
  /* Transparent sky window — canvas shows through */
  .sky-zone {
    display: block;
    height: 120px;
    flex-shrink: 0;
  }
  /* Equal-width columns inside the info strip */
  .header-hud {
    flex: 1 1 0;
    min-width: 0;
    padding: 4px 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .header-logo { display: none; }
  .header h1 { font-size: 1rem; }
  .header h1 .version-badge { display: none; }

  /* Hide side panels; compact stats strip always shown */
  #panel-stats, #panel-jobs { display: none; }
  #compact-stats-bar { display: flex !important; flex-wrap: wrap; }

  /* Lock body scroll entirely on mobile — all scrolling happens inside fixed overlays */
  body { overflow: hidden; }

  /* Tab bar hidden — replaced by mob-nav-grid */
  .tab-bar-scroll { display: none !important; }

  /* Let panel-content handle scrolling — remove inner list height caps */
  .job-list { max-height: none; overflow-y: visible; }

  /* Nudge banners only visible inside an open tab overlay, not on the nav home screen */
  body:not(.mob-tab-open):not(.mob-stats-open) #nudge-banners { display: none; }

  /* Tab content invisible on mobile until full-screen overlay opens */
  .tab-content         { display: none !important; }
  body.mob-tab-open .tab-content.active { display: block !important; }

  /* ── Home screen: flex column exactly fills header→footer ────────────── */
  .main {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--footer-h, 40px) - 4px);
    box-sizing: border-box;
    padding: 4px;
    gap: 4px;
    overflow: hidden;
  }
  #compact-stats-bar { flex: 0 0 auto; }
  body:not(.mob-tab-open):not(.mob-stats-open) #panel-content {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    padding: 4px 12px !important;   /* horizontal gutter so content clears the scrollbar */
  }

  /* ── Mobile nav grid ─────────────────────────────────────────────────── */
  .mob-nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    height: 100%;
    grid-auto-rows: 1fr;
    gap: 5px;
    padding: 5px;
    box-sizing: border-box;
  }
  .mob-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 6px;
    background: var(--sv-surface);
    border: 1px solid var(--sv-border);
    border-radius: var(--sv-radius);
    cursor: pointer;
    color: var(--sv-text);
    transition: background 0.15s, border-color 0.15s;
    min-height: 0;
    overflow: hidden;
    user-select: none;
  }
  .mob-nav-btn:active { background: var(--sv-card-deep); border-color: var(--sv-accent); }
  .mob-nav-icon  { font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
  .mob-nav-label { font-size: 0.68rem; font-weight: 600; color: var(--sv-text-sub); }
  /* Last odd button spans both columns */
  .mob-nav-btn:last-child:nth-child(odd) { grid-column: span 2; max-width: 50%; justify-self: center; width: 100%; }

  /* ── Mobile back bar — sits just below the always-visible site header ── */
  #mob-tab-topbar {
    display: none;
    position: fixed;
    top: var(--header-h, 190px); left: 0; right: 0;
    height: 52px;
    z-index: 400;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    background: var(--sv-surface);
    border-bottom: 1px solid var(--sv-border-hi);
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  }
  body.mob-tab-open #mob-tab-topbar,
  body.mob-stats-open #mob-tab-topbar { display: flex; }

  /* Vitals strip stays visible under any open tab — pinned just below the back
     bar so Health/Energy/Hunger/Happiness are always a glance away (#19). */
  body.mob-tab-open #compact-stats-bar {
    position: fixed;
    top: calc(var(--header-h, 190px) + 52px);
    left: 0; right: 0;
    z-index: 350;            /* above tab content (300), below back bar (400) */
    height: 30px;
    margin: 0;
    padding: 2px 10px;
    gap: 8px;
    background: var(--sv-surface);
    border-bottom: 1px solid var(--sv-border);
    flex-wrap: nowrap;
    /* Scroll horizontally rather than clip on the narrowest phones, so a stat
       is never cut off. Money is abbreviated ($486M) to keep the row short. */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  }
  body.mob-tab-open #compact-stats-bar::-webkit-scrollbar { display: none; }
  body.mob-tab-open #compact-stats-bar .cs-stat { flex: 0 0 auto; }
  body.mob-tab-open #compact-stats-bar .cs-bar { width: 30px; }

  .mob-back-btn {
    padding: 6px 12px;
    background: var(--sv-card);
    border: 1px solid var(--sv-border);
    border-radius: 6px;
    color: var(--sv-text);
    cursor: pointer;
    font-size: 0.88rem;
    flex-shrink: 0;
  }
  .mob-tab-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--sv-text);
    flex: 1;
  }

  /* ── Tab open: panel-content fills screen below header + back bar + vitals ── */
  body.mob-tab-open #panel-content {
    position: fixed;
    top: calc(var(--header-h, 190px) + 52px + 30px);  /* +30px for the pinned vitals strip */
    left: 0; right: 0; bottom: 0;
    z-index: 300;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: var(--sv-bg);
    padding: 0 12px 64px;   /* horizontal gutter so tab content clears the scrollbar */
    border-radius: 0;
    margin: 0;
    border: none;
    box-shadow: none;
  }
  body.mob-tab-open #mob-nav-grid,
  body.mob-stats-open #mob-nav-grid { display: none; }
  body.sv-life-ended #mob-nav-grid { display: none !important; }

  /* ── Stats open: panel-stats fills screen below header + back bar ────── */
  body.mob-stats-open #panel-content { display: none; }
  body.mob-stats-open #panel-stats {
    display: block !important;
    position: fixed;
    top: calc(var(--header-h, 190px) + 52px);
    left: 0; right: 0; bottom: 40px;
    z-index: 300;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: var(--sv-bg);
    padding: 12px 12px 64px;
    border-radius: 0;
    margin: 0;
    border: none;
    box-shadow: none;
  }
}

/* ── Desktop: always hide mobile-only nav elements ───────────────────────── */
/* NOTE: #mob-travel-block ("Go Somewhere") is intentionally NOT hidden here —
   since v3.13.0 the Here tab owns travel on all viewports (the old desktop
   scene picker in the Stats sidebar was removed). The "mob-" prefix is legacy. */
@media (min-width: 760px) {
  .mob-nav-grid, #mob-tab-topbar { display: none !important; }
}
/* Below 760px the skybox shows a pixel-art thermometer, so hide the HUD temp. */
@media (max-width: 759.98px) {
  #temp-display { display: none !important; }
}

/* ── Settings modal sticky header ───────────────────────────────────────── */
.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: -20px; /* counteract .modal padding: 20px */
  margin: -20px -20px 0;
  padding: 14px 20px;
  background: var(--sv-modal-bg);
  border-bottom: 1px solid var(--sv-border-lo);
  z-index: 2;
}
.settings-close-btn {
  float: none !important;
  font-size: 1.3rem;
  background: var(--sv-card) !important;
  border: 1px solid var(--sv-border) !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  color: var(--sv-text-muted) !important;
  cursor: pointer;
  line-height: 1;
}

/* ── Life Stats Bars ─────────────────────────────────────────────────────── */
.lsb-group { margin-bottom: 10px; }
.lsb-group-title { font-size: 0.68rem; color: var(--sv-text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; padding-bottom: 3px; border-bottom: 1px solid var(--sv-border); }
.lsb-row { display: flex; align-items: center; margin: 3px 0; font-size: 0.75rem; gap: 5px; }
.lsb-icon-label { width: 82px; color: var(--sv-text-muted); flex-shrink: 0; font-size: 0.74rem; }
.lsb-bar { flex: 1; height: 13px; background: var(--sv-track); border: 1px solid rgba(160,176,212,0.38); border-radius: 7px; overflow: hidden; min-width: 44px; transition: box-shadow 0.35s ease, border-color 0.35s ease; }
.lsb-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; }
/* Full (100%): a subtle theme-aware glow in the stat's own colour. */
.lsb-bar.lsb-full { border-color: var(--lsb-color, #4ecca3); box-shadow: 0 0 6px var(--lsb-color, #4ecca3); }
/* Critically low/bad: pulsing red outline so it grabs the eye. */
.lsb-bar.lsb-crit { border-color: #e94560; animation: lsb-crit-pulse 1.2s ease-in-out infinite; }
@keyframes lsb-crit-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(233,69,96,0); border-color: rgba(233,69,96,0.55); }
  50%      { box-shadow: 0 0 8px rgba(233,69,96,0.85); border-color: #e94560; }
}
@media (prefers-reduced-motion: reduce) { .lsb-bar.lsb-crit { animation: none; border-color: #e94560; box-shadow: 0 0 6px rgba(233,69,96,0.7); } }
.lsb-value { width: 26px; text-align: right; flex-shrink: 0; font-size: 0.72rem; color: var(--sv-text-sub); }
.lsb-status { font-size: 0.67rem; flex: 0 0 92px; width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.85; }

/* ── Stat change arrows ──────────────────────────────────────────────────── */
.stat-arrow-up { color: var(--sv-green); font-weight: bold; font-size: 0.7rem; letter-spacing: -1px; }
.stat-arrow-dn { color: var(--sv-accent); font-weight: bold; font-size: 0.7rem; letter-spacing: -1px; }

/* ── Version badge ───────────────────────────────────────────────────────── */
.version-badge { font-size: 0.65rem; color: var(--sv-text-dim); cursor: pointer; border: 1px solid var(--sv-border-hi); border-radius: 4px; padding: 2px 6px; }
.version-badge:hover { color: var(--sv-green); border-color: var(--sv-green); }

/* ── Settings button (header) ────────────────────────────────────────────── */
.settings-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; background: rgba(255,255,255,0.06); color: var(--sv-text-muted); cursor: pointer; font-size: 0.9rem; transition: background 0.15s, transform 0.15s; line-height: 1; }
.settings-btn:hover { background: rgba(255,255,255,0.14); color: var(--sv-text); transform: translateY(-1px); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer { position: fixed; bottom: 0; left: 0; right: 0; background: var(--sv-footer-bg); backdrop-filter: blur(4px); border-top: 1px solid var(--sv-border-hi); text-align: center; padding: 8px 16px; font-size: 0.7rem; color: var(--sv-text-dim); z-index: 320; }
.site-footer a { color: var(--sv-text-dim); }

/* ── Ads ─────────────────────────────────────────────────────────────────── */
.ad-slot { overflow: hidden; margin: 14px 0 0; }
.ad-slot:empty { display: none; margin: 0; }

/* ── Activity story modal ────────────────────────────────────────────────── */
.story-modal { max-width: 680px; }
.activity-result-art {
  display: block;
  width: min(100%, 520px);
  height: auto;
  max-height: min(38vh, 360px);
  object-fit: contain;
  margin: 10px auto 14px;
  border: 2px solid color-mix(in srgb, var(--sv-accent) 55%, transparent);
  border-radius: var(--sv-radius-sm);
  background: #111827;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.35), 0 10px 24px rgba(0,0,0,0.25);
}
.story-text { font-size: 0.92rem; line-height: 1.7; color: var(--sv-text-sub); margin: 12px 0; font-style: italic; }
.diary-activity { border-left-color: var(--sv-border-hi) !important; }
.diary-event    { border-left-color: color-mix(in srgb, var(--sv-accent) 40%, transparent) !important; }

/* ── Theme picker cards (settings modal) ─────────────────────────────────── */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.theme-card {
  border-radius: var(--sv-radius-sm); overflow: hidden;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.theme-card:hover    { transform: scale(1.02); }
.theme-card.selected { border-color: var(--sv-green) !important; }
.theme-card-preview  { height: 42px; display: flex; gap: 3px; padding: 5px; }
.theme-card-swatch   { flex: 1; border-radius: 3px; }
.theme-card-label    { padding: 5px 9px 6px; font-size: 0.78rem; font-weight: 700; }
.theme-card-desc     { font-size: 0.65rem; font-weight: 400; opacity: 0.7; margin-top: 1px; }

/* ── Activity mobile layout system ──────────────────────────────────────── */

.work-context-card {
  background: var(--sv-card);
  border: 1px solid var(--sv-border-hi);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 10px;
}
.work-context-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.work-context-title { font-size: 0.92rem; font-weight: 700; color: var(--sv-text); }
.work-context-company { font-size: 0.76rem; color: var(--sv-text-muted); margin-top: 2px; }
.work-context-status {
  flex-shrink: 0;
  border: 1px solid var(--sv-border);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.68rem;
  color: var(--sv-text-muted);
}
.work-context-status.good { color: var(--sv-green); border-color: color-mix(in srgb, var(--sv-green) 45%, transparent); }
.work-context-status.muted { color: var(--sv-text-dim); }
.work-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--sv-text-sub);
}
.work-context-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--sv-green-2);
}

/* Layout toggle buttons (inside the activity toolbar) */
.act-layout-btns { display: flex; gap: 4px; width: 100%; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--sv-border); }
.act-layout-btn  { padding: 4px 9px; font-size: 0.76rem; border-radius: 5px; border: 1px solid var(--sv-border); background: var(--sv-card); color: var(--sv-text-dim); cursor: pointer; transition: background 0.14s, color 0.14s, border-color 0.14s; line-height: 1.4; white-space: nowrap; }
.act-layout-btn:hover  { background: var(--sv-card-deep); color: var(--sv-text); }
.act-layout-btn.active { background: var(--sv-accent); border-color: var(--sv-accent); color: #fff; }

/* ── Feed (accordion) layout ─────────────────────────────────────────────── */
.act-feed-card   { background: var(--sv-card); border-radius: 8px; margin: 4px 0; border-left: 3px solid transparent; overflow: hidden; transition: border-color 0.15s; }
.act-feed-card.expanded { border-left-color: var(--act-cat-color, var(--sv-accent)); }
.act-feed-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; user-select: none; }
.act-art { display: inline-flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; background: #111827; border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 1px 0 rgba(0,0,0,0.35); }
/* Inner art is scaled up + clipped by the frame so the icon fills more of the
   tile (these icons carry emoji-style transparent margins). */
.act-art-inner { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.act-art-feed, .act-art-row { width: 32px; height: 32px; border-radius: 6px; }
.act-feed-label  { flex: 1; font-size: 0.88rem; font-weight: 500; min-width: 0; }
.act-feed-cost   { font-size: 0.75rem; color: var(--sv-green); flex-shrink: 0; }
.act-feed-chevron { font-size: 1.1rem; color: var(--sv-text-dim); transition: transform 0.2s; flex-shrink: 0; line-height: 1; }
.act-feed-body   { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; padding: 0 12px; }
.act-feed-card.expanded .act-feed-body { max-height: 340px; padding-bottom: 10px; }

/* ── Sheet layout (compact rows) ────────────────────────────────────────── */
.act-sheet-row   { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--sv-card); border-radius: 8px; margin: 4px 0; border-left: 3px solid var(--act-cat-color, var(--sv-border)); cursor: pointer; transition: background 0.12s; user-select: none; }
.act-sheet-row:active { background: var(--sv-card-deep); }
.asr-label  { flex: 1; font-size: 0.88rem; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asr-stat   { font-size: 0.68rem; color: var(--act-cat-color, #aaa); border: 1px solid var(--act-cat-color, #555); border-radius: 4px; padding: 1px 5px; flex-shrink: 0; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
.asr-cost   { font-size: 0.72rem; color: var(--sv-green); flex-shrink: 0; }
.asr-cd     { font-size: 0.7rem; color: var(--sv-text-dim); flex-shrink: 0; }

/* ── Grid layout (2-column tiles) ───────────────────────────────────────── */
.act-grid       { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.act-grid-tile  { background: var(--sv-card); border-radius: 10px; padding: 12px 10px 10px; cursor: pointer; border-top: 3px solid var(--act-cat-color, var(--sv-border)); transition: background 0.12s; display: flex; flex-direction: column; gap: 4px; min-height: 82px; user-select: none; }
.act-grid-tile:active { background: var(--sv-card-deep); }
.act-art-grid { width: 48px; height: 48px; border-radius: 8px; margin-bottom: 2px; }
.agt-label  { font-size: 0.83rem; font-weight: 500; line-height: 1.3; flex: 1; }
.agt-stat   { font-size: 0.68rem; color: var(--act-cat-color, #aaa); opacity: 0.85; }
.agt-cost   { font-size: 0.72rem; color: var(--sv-green); margin-top: auto; }

/* ── Deck layout (one card at a time) ───────────────────────────────────── */
.act-deck-nav     { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.act-deck-counter { font-size: 0.8rem; color: var(--sv-text-dim); flex-shrink: 0; }
.act-deck-btn     { padding: 7px 14px; font-size: 0.82rem; flex-shrink: 0; }
.act-deck-card    { background: var(--sv-card); border-radius: 12px; padding: 18px 16px 16px; border-top: 4px solid var(--act-cat-color, var(--sv-border)); }
.act-art-deck     { width: 72px; height: 72px; border-radius: 10px; margin-bottom: 10px; }
.act-deck-cat     { font-size: 0.72rem; padding: 2px 8px; border-radius: 4px; display: inline-block; margin-bottom: 6px; }
.act-deck-do      { width: 100%; padding: 12px; font-size: 1rem; margin-top: 14px; border-radius: 8px; transition: background 0.15s, border-color 0.15s; }

/* ── Bottom sheet (shared by Rows + Grid layouts) ───────────────────────── */
#act-sheet-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.52); z-index: 350; }
#act-sheet-overlay.open { display: block; }
#act-bottom-sheet  { position: fixed; bottom: 0; left: 0; right: 0; background: var(--sv-surface); border-radius: 18px 18px 0 0; padding: 6px 16px 36px; z-index: 360; transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); max-height: 82vh; overflow-y: auto; overscroll-behavior: contain; }
#act-bottom-sheet.open { transform: translateY(0); }
.abs-handle    { width: 44px; height: 4px; background: var(--sv-border); border-radius: 2px; margin: 10px auto 16px; cursor: grab; }
.abs-cat-bar   { height: 3px; border-radius: 2px; margin-bottom: 14px; }
.abs-title-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.abs-art       { width: 56px; height: 56px; border-radius: 8px; }
.abs-title     { font-size: 1.1rem; font-weight: bold; margin: 0; }
.abs-cost      { font-size: 0.85rem; flex-shrink: 0; }
.abs-duration  { font-size: 0.78rem; color: var(--sv-green-2); margin-bottom: 8px; }
.abs-desc      { font-size: 0.88rem; color: var(--sv-text-sub); line-height: 1.55; margin: 6px 0 10px; }
.abs-effects   { font-size: 0.78rem; color: #9a9; margin-bottom: 10px; }
.abs-do-btn    { width: 100%; padding: 14px; font-size: 1rem; border-radius: 10px; margin-top: 12px; }

/* ── Mobile / narrow-screen fixes ───────────────────────────────────────── */
@media (max-width: 480px) {
  /* Modal: reduce excessive padding on small phones */
  .modal { padding: 12px; max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }

  /* Settings modal sticky header: correct offset for 12px modal padding */
  .settings-modal-header { top: -12px; margin: -12px -12px 0; padding: 10px 12px; }

  /* Notification stack: prevent overflow on narrow screens */
  #notification-stack { max-width: calc(100vw - 24px); right: 8px; left: 8px; top: 52px; }

  /* Life stats bars: tighten fixed-width columns so the bar gets room */
  .lsb-icon-label { width: 66px; font-size: 0.68rem; }
  .lsb-status     { flex: 0 0 76px; width: 76px; font-size: 0.62rem; }

  /* Career job nodes: shrink slightly so more fit on narrow screens */
  .job-node      { min-width: 60px; max-width: 76px; padding: 4px 5px; }
  .job-node-title { font-size: 0.64rem; }
  .job-tier-badge { font-size: 0.55rem; }

  /* Grind overlay inner box: reduce padding on small phones */
  #grind-overlay > div { padding: 16px !important; }

  /* Bottom activity sheet: tighten side padding on phones */
  #act-bottom-sheet { padding: 6px 10px 32px; }

  /* Finance balance sheet: stack two-col layout on narrow phones */
  .finance-grid.two-col { grid-template-columns: 1fr; }

  /* Digest stat grid: stack to single column on narrow phones */
  .digest-stat-grid { grid-template-columns: 1fr; }

  /* Utility table: hide effects column to fit name + action on narrow screens */
  .utility-table td:nth-child(2),
  .utility-table th:nth-child(2) { display: none; }
}

/* ── Short-screen modal fixes (landscape phones) ─────────────────────────── */
@media (max-height: 620px) {
  /* Anchor modal to top so tall content scrolls down, not off the bottom */
  .modal-overlay { align-items: flex-start; padding-top: 8px; }
  .modal { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }

  /* Compact modal header/body text so forms take less vertical space */
  .modal h3 { margin-bottom: 6px; }
  .modal > p, .modal p { margin: 4px 0; }

  /* Auth forms: tighter label margins and smaller inputs */
  .auth-form label { margin: 5px 0 2px; font-size: 0.76rem; }
  .auth-form input { padding: 5px 8px; font-size: 0.85rem; }
  .social-auth-btn { min-height: 34px; font-size: 0.85rem; }
  .social-auth-block { margin: 4px 0 6px; }

  /* Story/activity modal: clamp height so it stays fully scrollable */
  .story-modal { max-height: calc(100vh - 24px); overflow-y: auto; }

  /* Bottom sheet: trim safe-area padding on landscape — 36px is too tall */
  #act-bottom-sheet { padding-bottom: 12px; }
}

/* Schedule grid: allow it to shrink below 360px (parent scrolls) */
.schedule-grid { min-width: 320px; }

/* Bottom sheet landscape: more vertical room on short screens */
@media (max-height: 680px) {
  #act-bottom-sheet { max-height: 90vh; }
}

/* Landscape nav: spread 12 buttons across 4 columns on short screens */
@media (max-height: 500px) {
  .mob-nav-grid { grid-template-columns: repeat(4, 1fr); }
}
