/* ==========================================================================
   KIPSCITY — Global UI styles
   Fully responsive, safe-area aware, works portrait/landscape on phones,
   tablets, laptops, desktops and ultrawide. No external fonts/assets.
   ========================================================================== */

:root {
  /* Brand palette */
  --c-bg: #0b0f1a;
  --c-bg-2: #121829;
  --c-panel: rgba(18, 24, 41, 0.82);
  --c-panel-solid: #121829;
  --c-stroke: rgba(255, 255, 255, 0.10);
  --c-stroke-strong: rgba(255, 255, 255, 0.22);
  --c-text: #eef2ff;
  --c-text-dim: #aab4cf;
  --c-accent: #4f9dff;
  --c-accent-2: #7c5cff;
  --c-good: #44d07b;
  --c-warn: #ffc34d;
  --c-bad: #ff5d6c;

  /* Spacing scale (fluid) */
  --gap: clamp(6px, 1.4vmin, 14px);
  --pad: clamp(8px, 1.8vmin, 18px);
  --radius: clamp(10px, 1.6vmin, 18px);

  /* Typography (fluid, no web fonts to stay dependency-free) */
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-sm: clamp(11px, 1.5vmin, 14px);
  --fs-md: clamp(13px, 1.9vmin, 17px);
  --fs-lg: clamp(18px, 3vmin, 28px);
  --fs-xl: clamp(28px, 6vmin, 56px);

  /* Safe-area insets (notches / rounded corners) */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  /* On-screen control sizing */
  --joystick-size: clamp(96px, 26vmin, 200px);
  --btn-size: clamp(46px, 8.5vmin, 78px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.4;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #05070d;
  touch-action: none;
}

/* ---- UI overlay root --------------------------------------------------- */
.ui-root {
  position: fixed;
  inset: 0;
  pointer-events: none; /* children opt-in via .ui-interactive */
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  z-index: 10;
}
.ui-root .ui-interactive,
.ui-root button,
.ui-root input,
.ui-root select,
.ui-root .panel,
.ui-root .joystick-zone,
.ui-root .touch-btn {
  pointer-events: auto;
}

/* ---- Buttons ----------------------------------------------------------- */
button {
  font-family: inherit;
  font-size: var(--fs-md);
  color: var(--c-text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--c-stroke-strong);
  border-radius: var(--radius);
  padding: 0.6em 1.1em;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
button:hover {
  border-color: var(--c-accent);
}
button:active {
  transform: scale(0.97);
}
button.primary {
  background: linear-gradient(180deg, var(--c-accent), var(--c-accent-2));
  border-color: transparent;
  font-weight: 700;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Generic panel ----------------------------------------------------- */
.panel {
  background: var(--c-panel);
  border: 1px solid var(--c-stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   Boot screen
   ========================================================================== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, #16203a 0%, var(--c-bg) 60%);
  transition: opacity 0.6s ease;
}
.boot-screen.boot-hidden {
  opacity: 0;
  pointer-events: none;
}
.boot-card {
  text-align: center;
  padding: var(--pad);
  width: min(86vw, 460px);
}
.boot-logo {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.boot-sub {
  margin-top: 0.3em;
  color: var(--c-text-dim);
  letter-spacing: 0.3em;
  font-size: var(--fs-sm);
}
.boot-progress {
  margin: 1.5em auto 0.8em;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.boot-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2));
  transition: width 0.25s ease;
}
.boot-status {
  color: var(--c-text-dim);
  font-size: var(--fs-sm);
  min-height: 1.4em;
}

/* ==========================================================================
   Fatal error
   ========================================================================== */
.fatal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 13, 0.92);
  padding: var(--pad);
}
.fatal[hidden] {
  display: none;
}
.fatal-card {
  max-width: min(92vw, 520px);
  text-align: center;
  padding: calc(var(--pad) * 1.5);
  background: var(--c-panel-solid);
  border: 1px solid var(--c-bad);
  border-radius: var(--radius);
}
.fatal-card h1 {
  margin: 0 0 0.4em;
  font-size: var(--fs-lg);
  color: var(--c-bad);
}
.fatal-card p {
  color: var(--c-text-dim);
  word-break: break-word;
  white-space: pre-wrap;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: var(--c-bg);
}

/* ==========================================================================
   HUD
   ========================================================================== */
.hud {
  position: absolute;
  inset: 0;
}
.hud-topleft {
  position: absolute;
  top: calc(var(--safe-t) + var(--gap));
  left: calc(var(--safe-l) + var(--gap));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  max-width: min(46vw, 340px);
  /* Sit above the touch joystick zone (which spans the left half) so the HUD
     panels/buttons here — e.g. the status toggle — stay tappable on phones.
     Empty gaps keep pointer-events:none, so the joystick still works around. */
  z-index: 6;
}
.hud-topright {
  position: absolute;
  top: calc(var(--safe-t) + var(--gap));
  right: calc(var(--safe-r) + var(--gap));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--gap);
  z-index: 6;
}

.clock {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  padding: 0.4em 0.8em;
  font-variant-numeric: tabular-nums;
}
.clock .time {
  font-size: var(--fs-lg);
  font-weight: 700;
}
.clock .day {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
}
.weather {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35em 0.7em;
  font-size: var(--fs-sm);
}

/* Stat bars (energy, hunger, thirst, hygiene, health, mood) */
.stats {
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 0.6);
  padding: var(--pad);
}
.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
  /* It's a <button>: strip the default button chrome so it reads as a header,
     but keep a comfortable tap target. */
  width: 100%;
  margin: 0;
  padding: 0.2em 0.1em;
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  min-height: 2.2em;
}
.stats-head:hover {
  border-color: transparent;
}
.stats-title {
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}
.stats-chevron {
  flex: 0 0 auto;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
  line-height: 1;
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--c-stroke-strong);
}
.stat-rows {
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 0.6);
}
/* Collapsed: hide the bars, leaving just the compact header (close option). */
.stats.collapsed .stat-rows {
  display: none;
}
.stat {
  display: grid;
  grid-template-columns: 1.6em 1fr;
  align-items: center;
  gap: 0.6em;
}
.stat .ico {
  font-size: var(--fs-md);
  text-align: center;
  opacity: 0.9;
}
.stat .track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}
.stat .fill {
  position: absolute;
  inset: 0;
  width: 100%;
  transform-origin: left center;
  border-radius: 999px;
  transition: transform 0.4s ease, background 0.4s ease;
}

/* Minimap */
.minimap {
  width: clamp(96px, 20vmin, 168px);
  height: clamp(96px, 20vmin, 168px);
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 2px solid var(--c-stroke-strong);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.08s ease;
}
.minimap:hover {
  border-color: var(--c-accent);
}
.minimap:active {
  transform: scale(0.97);
}
.minimap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
/* "Tap to open full map" affordance, sat inside the circular minimap. */
.map-badge {
  position: absolute;
  bottom: 7%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.4em;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: var(--fs-sm);
  line-height: 1;
  color: var(--c-text);
  background: rgba(8, 12, 20, 0.62);
  border: 1px solid var(--c-stroke-strong);
  pointer-events: none;
}

/* Top-center notification toast */
.toasts {
  position: absolute;
  top: calc(var(--safe-t) + var(--gap));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  align-items: center;
  width: min(90vw, 520px);
  pointer-events: none;
}
.toast {
  padding: 0.6em 1em;
  font-size: var(--fs-sm);
  text-align: center;
  animation: toast-in 0.25s ease, toast-out 0.4s ease forwards;
  animation-delay: 0s, 3.2s;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* Bottom system buttons (menu, etc.) */
.hud-system {
  position: absolute;
  top: calc(var(--safe-t) + var(--gap));
  left: 50%;
  transform: translateX(-50%);
  display: none; /* shown on desktop; on touch use the menu button cluster */
}

/* ==========================================================================
   On-screen touch controls
   ========================================================================== */
.touch-controls {
  position: absolute;
  inset: 0;
  display: none; /* toggled on for touch / coarse pointers */
}
.touch-controls.active {
  display: block;
}
.joystick {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--joystick-size);
  height: var(--joystick-size);
  margin-left: calc(var(--joystick-size) / -2);
  margin-top: calc(var(--joystick-size) / -2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-stroke);
  touch-action: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.joystick .nub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42%;
  height: 42%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid var(--c-stroke-strong);
  transform: translate(-50%, -50%);
  will-change: transform;
}
/* Console-style action diamond: symbols only (language-independent).
   A 3x3 grid keeps the four buttons in a clean, never-overlapping diamond
   regardless of button size / aspect ratio / safe-area insets. */
.action-cluster {
  position: absolute;
  /* Lifted higher so it clears the bottom branding/credit and the safe area. */
  bottom: calc(var(--safe-b) + 8vmin);
  right: calc(var(--safe-r) + 5vmin);
  display: grid;
  /* Full-button tracks give the four buttons clear breathing room (not cramped)
     while each button itself stays small. */
  grid-template-columns: repeat(3, var(--btn-size));
  grid-template-rows: repeat(3, var(--btn-size));
  place-items: center;
}
.touch-btn {
  width: var(--btn-size);
  height: var(--btn-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  /* Symbols need to be bold and large enough to read at a glance. */
  font-size: calc(var(--btn-size) * 0.44);
  font-weight: 700;
  line-height: 1;
  color: var(--sym, #eef2ff);
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.18));
  border: 2px solid var(--sym, var(--c-stroke-strong));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.06s ease, background 0.12s ease;
}
.touch-btn.pressed,
.touch-btn:active {
  background: var(--sym, rgba(79, 157, 255, 0.5));
  color: #0b0f1a;
  transform: scale(0.92);
}

/* PlayStation-inspired symbol colors (universally recognized) */
.touch-btn.sym-triangle { --sym: #4fd6a3; } /* enter / exit vehicle */
.touch-btn.sym-circle   { --sym: #ff5d6c; } /* run / sprint        */
.touch-btn.sym-square   { --sym: #f06ad0; } /* use / interact      */
.touch-btn.sym-cross    { --sym: #6aa8ff; } /* jump                */

/* Diamond placement on the 3x3 grid */
.touch-btn.pos-top    { grid-area: 1 / 2 / 2 / 3; }
.touch-btn.pos-left   { grid-area: 2 / 1 / 3 / 2; }
.touch-btn.pos-right  { grid-area: 2 / 3 / 3 / 4; }
.touch-btn.pos-bottom { grid-area: 3 / 2 / 4 / 3; }

/* ==========================================================================
   Modal screens (menus / character creator)
   ========================================================================== */
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 13, 0.6);
  display: grid;
  place-items: center;
  padding: var(--pad);
}
.modal {
  width: min(96vw, 720px);
  max-height: 90vh;
  overflow: auto;
  padding: calc(var(--pad) * 1.4);
}
.modal h2 {
  margin-top: 0;
  font-size: var(--fs-lg);
}
.menu-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.menu-list button {
  width: 100%;
  text-align: left;
  font-size: var(--fs-md);
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.4em 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  margin-bottom: var(--gap);
}
.field label {
  color: var(--c-text-dim);
  font-size: var(--fs-sm);
}
select,
input[type="range"],
input[type="text"] {
  font-family: inherit;
  font-size: var(--fs-md);
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-stroke-strong);
  border-radius: calc(var(--radius) * 0.6);
  padding: 0.5em 0.7em;
}

.brand-credit {
  position: absolute;
  bottom: calc(var(--safe-b) + 6px);
  /* Bottom-left: keeps the "KIPS TECHNOLOGY" credit readable and clear of the
     bottom-right action buttons. */
  left: calc(var(--safe-l) + 12px);
  font-size: clamp(9px, 1.2vmin, 12px);
  color: var(--c-text-dim);
  opacity: 0.5;
  letter-spacing: 0.18em;
  pointer-events: none;
}

/* ==========================================================================
   Responsive tuning across aspect ratios & orientations
   ========================================================================== */

/* Portrait phones: stack HUD tighter, enlarge touch targets */
@media (orientation: portrait) and (max-width: 820px) {
  :root { --btn-size: clamp(46px, 12vmin, 70px); }
  .hud-topleft { max-width: 64vw; }
  .minimap { width: clamp(84px, 24vmin, 140px); height: clamp(84px, 24vmin, 140px); }
}

/* Short landscape (phones held sideways): keep controls compact & off-center */
@media (orientation: landscape) and (max-height: 480px) {
  :root { --joystick-size: clamp(84px, 28vmin, 140px); --btn-size: clamp(42px, 11vmin, 64px); }
  .stats { padding: calc(var(--pad) * 0.7); }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 1280px) {
  :root { --fs-md: clamp(14px, 1.7vmin, 18px); }
}

/* Large desktop / ultrawide: cap UI scale so it doesn't get huge */
@media (min-width: 1600px) {
  :root {
    --gap: 12px;
    --pad: 16px;
    --radius: 16px;
    --fs-sm: 13px;
    --fs-md: 16px;
    --fs-lg: 26px;
    --fs-xl: 52px;
  }
}

/* Fine pointers (mouse) hide on-screen sticks by default */
@media (pointer: fine) and (hover: hover) {
  .touch-controls { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}


/* ==========================================================================
   Character creator (side panel; preview stays visible behind it)
   ========================================================================== */
.creator-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(92vw, 380px);
  border-radius: 0;
  border-left: 1px solid var(--c-stroke);
  overflow-y: auto;
  padding: calc(var(--safe-t) + var(--pad)) calc(var(--safe-r) + var(--pad)) calc(var(--safe-b) + var(--pad)) var(--pad);
}
.creator-panel h2 {
  margin-top: 0;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  padding: 0;
}
.swatch.sel {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 2px rgba(79, 157, 255, 0.4);
}

/* Phones: compact the creator so swatches/controls are easy to pick and the
   3D preview stays visible beside the panel. */
@media (max-width: 920px) {
  .creator-panel {
    width: min(62vw, 340px);
    padding: calc(var(--safe-t) + var(--gap)) calc(var(--safe-r) + var(--gap)) calc(var(--safe-b) + var(--gap)) var(--gap);
  }
  .creator-panel .field {
    margin-bottom: calc(var(--gap) * 0.5);
    gap: 0.2em;
  }
  .creator-panel h2 {
    font-size: var(--fs-md);
    margin-bottom: calc(var(--gap) * 0.4);
  }
  .creator-panel .swatch {
    width: 26px;
    height: 26px;
    border-radius: 6px;
  }
  .creator-panel select,
  .creator-panel input[type="text"],
  .creator-panel input[type="range"] {
    font-size: var(--fs-sm);
    padding: 0.35em 0.5em;
  }
}
@media (orientation: portrait) and (max-width: 560px) {
  .creator-panel { width: min(96vw, 420px); }
}

/* ==========================================================================
   Vehicle HUD (speedometer + fuel) shown while driving
   ========================================================================== */
.vehicle-hud {
  position: absolute;
  bottom: calc(var(--safe-b) + var(--gap));
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: var(--gap);
  padding: 0.5em 1em;
  font-variant-numeric: tabular-nums;
}
.vehicle-hud.active {
  display: flex;
}
.vehicle-hud .speed {
  font-size: var(--fs-lg);
  font-weight: 800;
}
.vehicle-hud .unit {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
}
.vehicle-hud .gauge {
  width: clamp(60px, 14vmin, 120px);
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.vehicle-hud .gauge > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--c-good), var(--c-warn));
  transform-origin: left center;
}

/* ==========================================================================
   Contextual interaction prompt
   ========================================================================== */
.prompt {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 16vmin);
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 0.6em;
  padding: 0.5em 1em;
  font-size: var(--fs-md);
  white-space: nowrap;
}
.prompt.active {
  display: flex;
}
.prompt .key {
  display: inline-grid;
  place-items: center;
  min-width: 1.8em;
  height: 1.8em;
  padding: 0 0.4em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--c-stroke-strong);
  font-weight: 700;
}


/* ---------------------------------------------------------------------------
   Inventory / Shop / Quests (Stage 9)
--------------------------------------------------------------------------- */

/* HUD quest tracker (top-left, under the class hint) */
.quest-tracker {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  padding: 0.4em 0.7em;
  max-width: min(46vw, 320px);
  border-left: 3px solid var(--c-accent);
}
.quest-tracker .qt-title {
  font-size: var(--fs-sm);
  font-weight: 700;
}
.quest-tracker .qt-obj {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
}

/* Small colored category chip shared by inventory + shop rows */
.item-chip {
  flex: 0 0 auto;
  width: 1.1em;
  height: 1.1em;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

/* Inventory + shop rows */
.inv-list,
.shop-list {
  max-height: min(46vh, 420px);
  overflow-y: auto;
}
.inv-row,
.shop-row {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.5em 0.2em;
  border-bottom: 1px solid var(--c-stroke);
}
.inv-name {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-qty {
  flex: 0 0 auto;
  color: var(--c-text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 2.2em;
  text-align: right;
}
.inv-use,
.shop-buy {
  flex: 0 0 auto;
  padding: 0.3em 0.8em;
  font-size: var(--fs-sm);
}
.inv-empty {
  color: var(--c-text-dim);
  padding: 0.8em 0.2em;
  text-align: center;
}
.shop-money {
  color: var(--c-text-dim);
  margin-bottom: 0.4em;
  font-variant-numeric: tabular-nums;
}

/* Quest panel cards */
.quest-list {
  max-height: min(50vh, 460px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6em;
}
.quest-card {
  padding: 0.7em 0.8em;
  border: 1px solid var(--c-stroke);
  border-radius: var(--radius-sm, 8px);
  background: rgba(255, 255, 255, 0.03);
}
.quest-card.done {
  opacity: 0.6;
}
.quest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quest-title {
  font-weight: 700;
}
.quest-status {
  color: var(--c-good);
  font-weight: 700;
}
.quest-desc {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
  margin: 0.2em 0 0.4em;
}
.quest-obj {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  padding: 0.1em 0;
}
.quest-obj.done {
  color: var(--c-good);
}
.quest-prog {
  color: var(--c-text-dim);
  font-variant-numeric: tabular-nums;
}


/* Jobs panel: secondary line under a job title (wage / shift) */
.job-meta {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
  margin-top: 0.1em;
}


/* ==========================================================================
   Phone hub (Stage 10 — Economy, Skills & Social Life)
   A clean dark-glass "device" that hubs banking, skills, contacts, cooking
   and the calendar. Fully original styling.
   ========================================================================== */
.phone-scrim {
  z-index: 50;
}
.phone {
  width: min(94vw, 392px);
  height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0e1422, #0a0e18);
  border: 1px solid var(--c-stroke-strong);
  border-radius: clamp(20px, 4vmin, 34px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 0 0 2px rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.phone-statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6em;
  padding: 0.5em 1em;
  background: rgba(255, 255, 255, 0.03);
  font-variant-numeric: tabular-nums;
}
.phone-clock {
  font-size: var(--fs-sm);
  font-weight: 700;
}
.phone-brand {
  font-size: var(--fs-sm);
  letter-spacing: 0.22em;
  color: var(--c-text-dim);
}
.phone-close {
  width: 1.9em;
  height: 1.9em;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--c-stroke-strong);
  color: var(--c-text);
  line-height: 1;
}
.phone-appbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.9em;
  border-bottom: 1px solid var(--c-stroke);
}
.phone-back {
  width: 1.9em;
  height: 1.9em;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--c-stroke-strong);
  color: var(--c-text);
  font-size: var(--fs-md);
  line-height: 1;
}
.phone-title {
  font-size: var(--fs-md);
  font-weight: 700;
}
.phone-screen {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--pad);
}
.phone-navbar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0.4em;
  border-top: 1px solid var(--c-stroke);
}
.phone-home-btn {
  width: 2.6em;
  height: 2.6em;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--c-stroke-strong);
  color: var(--c-text);
  font-size: var(--fs-md);
}

/* Home screen — app icon grid */
.phone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--pad);
}
.phone-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  background: none;
  border: none;
  padding: 0.3em 0;
  color: var(--c-text);
}
.phone-icon-badge {
  width: clamp(46px, 14vw, 62px);
  height: clamp(46px, 14vw, 62px);
  border-radius: 28%;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 6vw, 28px);
  color: #0b0f1a;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}
.phone-icon-label {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
}
.phone-tagline {
  margin-top: var(--pad);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
  opacity: 0.7;
}

/* App content */
.phone-app {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.phone-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--c-stroke);
  border-radius: calc(var(--radius) * 0.8);
  padding: 0.7em 0.85em;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}
button.phone-card {
  text-align: left;
  color: var(--c-text);
  cursor: pointer;
}
.phone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6em;
  font-size: var(--fs-md);
}
.phone-row-l {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--c-text-dim);
}
.phone-row-r {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.phone-row.big .phone-row-r {
  font-size: var(--fs-lg);
}
.phone-row.good .phone-row-r {
  color: var(--c-good);
}
.phone-row.bad .phone-row-r {
  color: var(--c-bad);
}
.phone-sub {
  font-size: var(--fs-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}
.phone-hint {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
}
.phone-desc {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
  opacity: 0.85;
}
.phone-empty {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
  font-style: italic;
}
.phone-locked {
  font-size: var(--fs-sm);
  color: var(--c-warn);
}
.phone-tag {
  align-self: flex-start;
  font-size: var(--fs-sm);
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: rgba(79, 157, 255, 0.18);
  color: var(--c-accent);
}
.phone-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.phone-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* Buttons inside the phone */
.phone-btn {
  width: 100%;
  font-size: var(--fs-md);
  padding: 0.55em 0.7em;
  border-radius: calc(var(--radius) * 0.6);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-stroke-strong);
  color: var(--c-text);
}
.phone-btn.good {
  background: linear-gradient(180deg, rgba(68, 208, 123, 0.25), rgba(68, 208, 123, 0.12));
  border-color: rgba(68, 208, 123, 0.5);
}
.phone-btn.bad {
  background: linear-gradient(180deg, rgba(255, 93, 108, 0.22), rgba(255, 93, 108, 0.1));
  border-color: rgba(255, 93, 108, 0.5);
}
.phone-btn.ghost {
  background: none;
  border: none;
  color: var(--c-text-dim);
  width: auto;
  padding: 0.2em 0;
}
.phone-btn.small {
  width: auto;
  padding: 0.35em 0.7em;
  font-size: var(--fs-sm);
}
.phone-btn:disabled {
  opacity: 0.4;
}
.phone-quick {
  display: flex;
  gap: 0.5em;
}
.phone-quick .phone-btn {
  flex: 1 1 0;
}

.skill-dot {
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  display: inline-block;
}
.contact-name {
  font-size: var(--fs-lg);
  font-weight: 700;
}
.gift-row {
  border-top: 1px solid var(--c-stroke);
  padding-top: 0.4em;
}
.cal-day {
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* HUD phone button mirrors the menu button */
.hud-phone-btn {
  width: 2.6em;
  height: 2.6em;
  padding: 0;
  font-size: var(--fs-lg);
  line-height: 1;
}


/* Phone in-app tab strip (wardrobe closet/shop/looks) */
.phone-tabs {
  display: flex;
  gap: 0.4em;
  margin-bottom: var(--gap);
}
.phone-tab {
  flex: 1 1 0;
  padding: 0.45em 0.5em;
  font-size: var(--fs-sm);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-stroke-strong);
  color: var(--c-text-dim);
}
.phone-tab.active {
  background: linear-gradient(180deg, var(--c-accent), var(--c-accent-2));
  border-color: transparent;
  color: #fff;
}
