/* Cartel Wars. Every colour, font and corner comes from the design tokens that the page sets on :root.
   The values below are Noir Gold, used only if the token block is missing. */

@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: Inter; font-weight: 800; font-display: swap; src: url('/fonts/inter-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: "Playfair Display"; font-weight: 700; font-display: swap; src: url('/fonts/playfair-display-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: "Playfair Display"; font-weight: 900; font-display: swap; src: url('/fonts/playfair-display-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: Oswald; font-weight: 500; font-display: swap; src: url('/fonts/oswald-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: Oswald; font-weight: 700; font-display: swap; src: url('/fonts/oswald-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: "Bebas Neue"; font-weight: 400; font-display: swap; src: url('/fonts/bebas-neue-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: "Special Elite"; font-weight: 400; font-display: swap; src: url('/fonts/special-elite-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Anton; font-weight: 400; font-display: swap; src: url('/fonts/anton-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Cinzel; font-weight: 700; font-display: swap; src: url('/fonts/cinzel-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #0b0a08; --chrome: #0f0c08; --chrome-ink: #efe6cf; --surface: #15120d; --surface-2: #1c1811;
  --line: #2e2617; --line-strong: #5a4826; --ink: #efe6cf; --ink-strong: #fff4d6; --muted: #a89a7c;
  --head-bg: #1f190f; --head-ink: #f6dc8a; --accent: #e2b651; --accent-2: #f6dc8a; --accent-ink: #1b1408; --link: #f0d36a;
  --cash: #8fd14f; --gold: #f1cb5c; --health: #e2554a; --energy: #f1c84a; --stamina: #e8893a; --xp: #6aa9e8;
  --danger: #e15b4a; --ok: #7fbf5a; --warn: #f0b45a; --scene-tint: rgba(10, 8, 4, 0.45);
  --font-body: Inter, system-ui, sans-serif; --font-display: "Playfair Display", Georgia, serif; --radius: 10px;

  --r-sm: calc(var(--radius) * 0.6);
  --r-lg: calc(var(--radius) * 1.4);
  --glass: color-mix(in srgb, var(--surface) 90%, transparent);
  --glass-2: color-mix(in srgb, var(--surface-2) 92%, transparent);
  --soft-line: color-mix(in srgb, var(--line) 70%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  --chrome-2: color-mix(in srgb, var(--chrome-ink) 10%, var(--chrome));
  --chrome-line: color-mix(in srgb, var(--chrome-ink) 22%, transparent);
  --chrome-quiet: color-mix(in srgb, var(--chrome-ink) 62%, transparent);
  --wrap: 1180px;
  --dock-h: 0px;
  --ease: cubic-bezier(0.2, 0.9, 0.3, 1);
  --spring: cubic-bezier(0.2, 1.4, 0.4, 1);
  /* Older names, still used by a few inline styles. */
  --gold-2: var(--accent-2);
  --brass: var(--line-strong);
  --panel: var(--surface);
  --card: var(--surface-2);
  --pay: var(--cash);
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color-scheme: dark;
  scroll-padding-top: 120px;
}
html[data-design="dossier"] { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: transparent;
  color: var(--ink);
  font: 15px/1.45 var(--font-body);
  overflow-x: hidden;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
img { border: 0; max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink-strong); line-height: 1.15; }
h1, h2, h3, h4, .lvl-num, .lvl-top strong, .lu-badge strong { font-variant-numeric: lining-nums; }
.ico { width: 1em; height: 1em; flex: 0 0 auto; vertical-align: -0.125em; }
html[data-case="upper"] :is(.panel > h2, .panel > h3, .stage-title, .boss-copy h2, .tiers a strong, .design-card h3, .scene-title) {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
code { font-size: 0.9em; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
button, input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Texture laid over the whole page. Pure decoration. */
html[data-texture="grain"] body::after,
html[data-texture="paper"] body::after,
html[data-texture="scan"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
html[data-texture="grain"] body::after {
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-texture="paper"] body::after {
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.45 0 0 0 0 0.3 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23p)'/%3E%3C/svg%3E");
}
html[data-texture="scan"] body::after {
  opacity: 0.35;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-strong);
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s var(--ease), filter 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover, .btn:hover { border-color: var(--accent); filter: brightness(1.08); }
button:active, .btn:active { transform: translateY(1px) scale(0.985); }
button:disabled, .btn:disabled { opacity: 0.45; cursor: default; transform: none; filter: none; }
button.primary, a.primary, .btn.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s var(--ease), filter 0.15s, box-shadow 0.15s;
}
a.primary:hover { color: var(--accent-ink); }
html[data-btn="gloss"] :is(button.primary, a.primary, .btn.primary) {
  background: linear-gradient(180deg, var(--accent-2), var(--accent) 48%, color-mix(in srgb, var(--accent) 70%, #000));
  border-color: color-mix(in srgb, var(--accent-2) 70%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 0 rgba(0, 0, 0, 0.5), 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
html[data-btn="flat"] :is(button.primary, a.primary, .btn.primary) {
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent);
}
html[data-btn="block"] :is(button.primary, a.primary, .btn.primary) {
  border: 2px solid color-mix(in srgb, var(--accent) 55%, #000);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 50%, #000);
}
html[data-btn="block"] :is(button.primary, a.primary, .btn.primary):active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 50%, #000); }
html[data-btn="outline"] :is(button.primary, a.primary, .btn.primary) {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}
html[data-btn="outline"] :is(button.primary, a.primary, .btn.primary):hover { background: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled), a.primary:hover, .btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.danger { background: color-mix(in srgb, var(--danger) 22%, var(--surface)); border-color: var(--danger); color: var(--ink-strong); }
button.is-busy { opacity: 0.75; }
.btn-good, .tower button.primary, button.collect-all {
  background: linear-gradient(180deg, color-mix(in srgb, var(--cash) 70%, #fff), var(--cash) 55%, color-mix(in srgb, var(--cash) 60%, #000)) !important;
  color: #0c1a06 !important;
  border-color: color-mix(in srgb, var(--cash) 60%, #fff) !important;
  text-shadow: none !important;
}

/* ---------- Forms ---------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="color"]):not([type="file"]),
select,
textarea {
  width: 100%;
  max-width: 460px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-strong);
  -webkit-text-fill-color: var(--ink-strong);
  caret-color: var(--accent);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; -webkit-text-fill-color: var(--muted); }
input:-webkit-autofill { -webkit-text-fill-color: var(--ink-strong); box-shadow: 0 0 0 1000px var(--surface-2) inset; transition: background-color 99999s; }
select option { background: var(--surface-2); color: var(--ink-strong); }
textarea { max-width: 720px; min-height: 96px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: -3px; }
input[type="file"] { max-width: 100%; color: var(--ink); }
input[type="color"] { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); }
label.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.secret { display: flex; gap: 6px; align-items: center; max-width: 460px; }
.secret input { flex: 1; max-width: none; }
.field { margin: 0 0 12px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; color: var(--ink-strong); }
fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); margin: 12px 0; padding: 10px 12px; }
legend { color: var(--accent-2); padding: 0 6px; }

/* ---------- Scenes: animated places behind jobs, pages and houses ---------- */
.scene { position: relative; overflow: hidden; isolation: isolate; background: #050505; }
.scene > .sc-art, .scene > .fx, .scene > .sc-shade { position: absolute; inset: 0; pointer-events: none; }
.scene > .sc-art {
  z-index: -3;
  background: var(--art) center 35% / cover no-repeat;
  animation: sc-drift 26s ease-in-out infinite alternate;
}
.scene > .fx { z-index: -2; }
.scene > .sc-shade {
  z-index: -1;
  background:
    linear-gradient(180deg, transparent 30%, color-mix(in srgb, var(--bg) 80%, transparent) 100%),
    var(--scene-tint);
}
@keyframes sc-drift { from { transform: scale(1.04) translate3d(-1%, 0, 0); } to { transform: scale(1.12) translate3d(1.5%, -1.5%, 0); } }

/* Rain on a city street, with a car's headlights sweeping past. */
.scene-street-rain .fx1, .scene-alley .fx1 {
  background-image:
    repeating-linear-gradient(104deg, transparent 0 13px, rgba(200, 215, 255, 0.18) 13px 14px, transparent 14px 31px),
    repeating-linear-gradient(98deg, transparent 0 21px, rgba(200, 215, 255, 0.11) 21px 22px, transparent 22px 47px);
  background-size: 120px 120px, 180px 180px;
  animation: fx-rain 0.5s linear infinite;
}
@keyframes fx-rain { to { background-position: -26px 120px, -24px 180px; } }
.scene-street-rain .fx2 {
  background: linear-gradient(100deg, transparent 35%, rgba(255, 240, 200, 0.28) 48%, transparent 60%);
  background-size: 260% 100%;
  animation: fx-sweep 7s ease-in-out infinite;
}
@keyframes fx-sweep { 0%, 55% { background-position: 140% 0; opacity: 0; } 60% { opacity: 1; } 85% { background-position: -60% 0; opacity: 1; } 90%, 100% { opacity: 0; } }
.scene-street-rain .fx3, .scene-harbor .fx3 {
  background: linear-gradient(0deg, rgba(160, 190, 255, 0.12), transparent 30%);
  animation: fx-shimmer 3s ease-in-out infinite alternate;
}
@keyframes fx-shimmer { from { opacity: 0.4; } to { opacity: 1; } }

/* Back alley: steam from a grate and a lamp that will not stay on. */
.scene-alley .fx2, .scene-backroom .fx2, .scene-fire .fx2 {
  background:
    radial-gradient(ellipse 30% 22% at 30% 100%, rgba(230, 230, 240, 0.32), transparent 70%),
    radial-gradient(ellipse 26% 20% at 70% 100%, rgba(230, 230, 240, 0.22), transparent 70%);
  animation: fx-smoke 9s ease-in-out infinite;
}
@keyframes fx-smoke { 0% { transform: translate3d(0, 10%, 0) scale(1); opacity: 0.3; } 50% { opacity: 0.9; } 100% { transform: translate3d(4%, -40%, 0) scale(1.6); opacity: 0; } }
.scene-alley .fx3, .scene-warehouse .fx3 {
  background: radial-gradient(ellipse 40% 50% at 50% 0%, rgba(255, 214, 140, 0.32), transparent 70%);
  animation: fx-flicker 5.3s steps(1) infinite;
}
@keyframes fx-flicker { 0%, 100% { opacity: 1; } 41% { opacity: 0.2; } 43% { opacity: 1; } 77% { opacity: 0.35; } 79% { opacity: 1; } }

/* Neon strip: two signs that pulse and a haze that drifts. */
.scene-neon .fx1 {
  background:
    radial-gradient(ellipse 45% 35% at 15% 25%, rgba(255, 46, 136, 0.45), transparent 70%),
    radial-gradient(ellipse 40% 35% at 85% 30%, rgba(34, 211, 238, 0.4), transparent 70%);
  animation: fx-neon 3.2s ease-in-out infinite;
}
@keyframes fx-neon { 0%, 18%, 22%, 62%, 64%, 100% { opacity: 1; } 20%, 63% { opacity: 0.45; } }
.scene-neon .fx2, .scene-lanterns .fx2, .scene-harbor .fx2, .scene-tropical .fx3 {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07) 30%, transparent 60%, rgba(255, 255, 255, 0.06) 85%, transparent);
  background-size: 200% 100%;
  animation: fx-haze 18s linear infinite;
}
@keyframes fx-haze { to { background-position: -200% 0; } }

/* Docks: a searchlight crosses the water. */
.scene-harbor .fx1 {
  background: conic-gradient(from 200deg at 80% 0%, transparent 0deg, rgba(255, 250, 220, 0.28) 8deg, transparent 18deg);
  transform-origin: 80% 0%;
  animation: fx-search 9s ease-in-out infinite alternate;
}
@keyframes fx-search { from { transform: rotate(-18deg); } to { transform: rotate(22deg); } }

/* Heat: the air ripples and dust hangs in the light. */
.scene-heat .fx1 {
  background: linear-gradient(180deg, rgba(255, 170, 60, 0.28), transparent 55%);
  animation: fx-shimmer 4s ease-in-out infinite alternate;
}
.scene-heat .fx2, .scene-warehouse .fx2, .scene-tropical .fx2 {
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255, 230, 180, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 60% 70%, rgba(255, 230, 180, 0.7), transparent),
    radial-gradient(2px 2px at 80% 20%, rgba(255, 230, 180, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 35% 85%, rgba(255, 230, 180, 0.7), transparent),
    radial-gradient(1px 1px at 90% 55%, rgba(255, 230, 180, 0.8), transparent);
  background-size: 220px 220px;
  animation: fx-motes 14s linear infinite;
}
@keyframes fx-motes { to { background-position: 60px -220px; } }
.scene-heat .fx3 {
  background: linear-gradient(0deg, rgba(255, 190, 110, 0.18), transparent 35%);
  animation: fx-wave 2.4s ease-in-out infinite alternate;
}
@keyframes fx-wave { from { transform: skewX(-1.5deg) scaleY(1); } to { transform: skewX(1.5deg) scaleY(1.04); } }

/* Sirens: red and blue wash across the scene. */
.scene-sirens .fx1 {
  background: linear-gradient(90deg, rgba(255, 40, 40, 0.5), transparent 50%, rgba(40, 90, 255, 0.5));
  animation: fx-siren 1.1s steps(2) infinite;
}
@keyframes fx-siren { 0% { opacity: 0.85; transform: scaleX(1); } 50% { opacity: 0.85; transform: scaleX(-1); } }
.scene-sirens .fx2 {
  background: radial-gradient(ellipse 60% 40% at 50% 100%, rgba(255, 255, 255, 0.14), transparent 70%);
  animation: fx-shimmer 0.55s ease-in-out infinite alternate;
}

/* Fire: a warm flicker and embers rising. */
.scene-fire .fx1 {
  background: radial-gradient(ellipse 70% 55% at 50% 100%, rgba(255, 120, 30, 0.55), transparent 70%);
  animation: fx-burn 0.9s ease-in-out infinite alternate;
}
@keyframes fx-burn { from { opacity: 0.6; transform: scaleY(0.96); } to { opacity: 1; transform: scaleY(1.05); } }
.scene-fire .fx3, .scene-garage .fx1 {
  background-image:
    radial-gradient(2px 2px at 30% 90%, #ffb347, transparent),
    radial-gradient(2px 2px at 55% 80%, #ffd27a, transparent),
    radial-gradient(1.5px 1.5px at 70% 95%, #ff9a3d, transparent),
    radial-gradient(2px 2px at 45% 70%, #ffcf6b, transparent);
  background-size: 160px 200px;
  animation: fx-embers 2.6s linear infinite;
}
@keyframes fx-embers { from { background-position: 0 0; opacity: 1; } to { background-position: 20px -200px; opacity: 0.6; } }

/* Tropical night: fireflies and palm shadows. */
.scene-tropical .fx1 {
  background-image:
    radial-gradient(3px 3px at 20% 40%, rgba(200, 255, 140, 0.9), transparent),
    radial-gradient(3px 3px at 70% 60%, rgba(200, 255, 140, 0.8), transparent),
    radial-gradient(2px 2px at 45% 25%, rgba(200, 255, 140, 0.9), transparent),
    radial-gradient(3px 3px at 85% 35%, rgba(200, 255, 140, 0.7), transparent);
  background-size: 300px 260px;
  animation: fx-flies 7s ease-in-out infinite alternate;
}
@keyframes fx-flies { 0% { background-position: 0 0; opacity: 0.4; } 50% { opacity: 1; } 100% { background-position: 40px -30px; opacity: 0.5; } }

/* Lantern quarter: warm lanterns float up through the mist. */
.scene-lanterns .fx1 {
  background-image:
    radial-gradient(6px 8px at 20% 90%, rgba(255, 160, 60, 0.95), transparent),
    radial-gradient(5px 7px at 50% 95%, rgba(255, 120, 60, 0.9), transparent),
    radial-gradient(6px 8px at 78% 92%, rgba(255, 180, 80, 0.9), transparent);
  background-size: 260px 300px;
  animation: fx-lift 11s linear infinite;
}
@keyframes fx-lift { to { background-position: 30px -300px; } }

/* Rooftops: the city twinkles below. */
.scene-skyline .fx1 {
  background-image:
    radial-gradient(1.5px 1.5px at 10% 70%, #fff3c4, transparent),
    radial-gradient(1.5px 1.5px at 35% 78%, #fff3c4, transparent),
    radial-gradient(1.5px 1.5px at 62% 74%, #cfe3ff, transparent),
    radial-gradient(1.5px 1.5px at 88% 80%, #fff3c4, transparent);
  background-size: 140px 120px;
  animation: fx-twinkle 2.8s ease-in-out infinite alternate;
}
@keyframes fx-twinkle { from { opacity: 0.35; } to { opacity: 1; } }
.scene-skyline .fx2 {
  background: linear-gradient(180deg, rgba(120, 140, 255, 0.18), transparent 50%);
  animation: fx-shimmer 6s ease-in-out infinite alternate;
}

/* Back room: smoke and one lamp swinging over the table. */
.scene-backroom .fx1, .scene-office .fx1 {
  background: radial-gradient(ellipse 45% 60% at 50% 0%, rgba(255, 210, 140, 0.4), transparent 70%);
  transform-origin: 50% 0%;
  animation: fx-swing 4.5s ease-in-out infinite alternate;
}
@keyframes fx-swing { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.scene-office .fx2 {
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.32) 0 10px, transparent 10px 22px);
  transform: skewY(-8deg) scale(1.3);
  animation: fx-shimmer 8s ease-in-out infinite alternate;
}

/* Casino: rows of bulbs chase around the frame. */
.scene-casino .fx1 {
  background:
    radial-gradient(circle, rgba(255, 236, 160, 0.95) 0 2px, transparent 3px) 0 0 / 22px 22px repeat-x,
    radial-gradient(circle, rgba(255, 236, 160, 0.95) 0 2px, transparent 3px) 11px 100% / 22px 22px repeat-x;
  animation: fx-chase 0.8s linear infinite;
}
@keyframes fx-chase { to { background-position: 22px 0, -11px 100%; } }
.scene-casino .fx2 {
  background: radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 200, 90, 0.2), transparent 70%);
  animation: fx-shimmer 1.6s ease-in-out infinite alternate;
}

/* Vault: a red laser scans and the strip light hums. */
.scene-vault .fx1 {
  background: linear-gradient(180deg, transparent 48%, rgba(255, 40, 40, 0.75) 50%, transparent 52%);
  animation: fx-laser 3.4s ease-in-out infinite alternate;
}
@keyframes fx-laser { from { transform: translateY(-40%) rotate(-6deg); } to { transform: translateY(40%) rotate(6deg); } }
.scene-vault .fx2 {
  background: linear-gradient(180deg, rgba(140, 200, 255, 0.16), transparent 40%);
  animation: fx-flicker 6s steps(1) infinite;
}

/* Chop shop: welding sparks under a buzzing tube light. */
.scene-garage .fx2 {
  background: radial-gradient(ellipse 22% 20% at 40% 70%, rgba(170, 220, 255, 0.55), transparent 70%);
  animation: fx-weld 0.35s steps(2) infinite;
}
@keyframes fx-weld { 0% { opacity: 1; } 50% { opacity: 0.2; } }
.scene-garage .fx3 {
  background: linear-gradient(180deg, rgba(220, 255, 240, 0.16), transparent 30%);
  animation: fx-flicker 4.1s steps(1) infinite;
}

/* Warehouse: a flashlight beam crosses the stacks. */
.scene-warehouse .fx1 {
  background: radial-gradient(ellipse 18% 30% at 50% 50%, rgba(255, 245, 210, 0.38), transparent 70%);
  animation: fx-torch 6s ease-in-out infinite alternate;
}
@keyframes fx-torch { from { transform: translateX(-35%); } to { transform: translateX(35%); } }

/* The page backdrop sits behind everything, softly. */
#backdrop { position: fixed; inset: 0; z-index: -10; }
#backdrop > .sc-art { opacity: 0.55; }
#backdrop > .sc-shade {
  background:
    radial-gradient(ellipse at 50% 0%, transparent, color-mix(in srgb, var(--bg) 70%, transparent) 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 35%, transparent), var(--bg) 92%);
}
body.board-admin #backdrop { display: none; }

/* Scenes only move while they are on screen, and never on low-power devices. */
.scene > .sc-art, .scene > .fx { animation-play-state: paused; }
.scene.is-live > .sc-art, .scene.is-live > .fx { animation-play-state: running; }
html.lite .scene > .fx, html.lite #backdrop > .fx { display: none; }
html.lite .scene > .sc-art { animation: none; transform: scale(1.04); }
html.lite #page > * { animation: none; }

/* ---------- Chrome: top bar, vitals, navigation ---------- */
#preview-bar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  margin: 0;
}
#preview-bar button { min-height: 32px; padding: 4px 12px; }
#chrome {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  color: var(--chrome-ink);
}
#topbar, .vitals, #nav { width: min(var(--wrap), calc(100% - 24px)); margin-left: auto; margin-right: auto; }
#topbar {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 0 6px;
  min-height: 52px;
}
#topbar .logo { text-decoration: none; margin-right: auto; min-width: 0; display: flex; align-items: center; }
#topbar .word {
  display: block;
  font: 900 28px/1 var(--font-display);
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--accent);
  background: linear-gradient(180deg, var(--accent-2), var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #000));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
}
html[data-case="upper"] #topbar .word { text-transform: uppercase; }
.util { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: flex-end; }
.util > a { color: var(--chrome-ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.util > a:hover { color: var(--accent-2); }
.travel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--chrome-line);
  background: var(--chrome-2);
  color: var(--chrome-ink);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, transform 0.15s;
}
.travel-btn .ico { width: 15px; height: 15px; color: var(--accent); }
.travel-btn:hover, .travel-btn.on { border-color: var(--accent); color: var(--chrome-ink); transform: translateY(-1px); }
.lvl-top { display: none; }
button.menu-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chrome-2);
  border: 1px solid var(--chrome-line);
  color: var(--chrome-ink);
}
.menu { position: relative; flex: 0 0 auto; }
.menu-word { display: none; }
.submenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  animation: drop-in 0.18s var(--ease);
}
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.util .submenu, #nav .nav-set > .menu:last-child .submenu { left: auto; right: 0; }
.submenu a, .submenu button {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  text-align: left;
  text-decoration: none;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: var(--r-sm);
  box-shadow: none;
  font-weight: 600;
}
.submenu a.active, .submenu a:hover, .submenu button:hover { background: var(--accent-soft); color: var(--ink-strong); filter: none; }
.submenu form { margin: 0; }
.badge, #note-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  animation: badge-pop 0.4s var(--spring);
}
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }
#note-count:empty { display: none; }

.vitals {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(70px, 0.6fr) repeat(4, minmax(90px, 1fr)) auto;
  gap: 6px;
  padding: 0 0 8px;
}
.stat, button.stat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 46px;
  padding: 6px 10px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
a.stat:hover, button.stat:hover { border-color: var(--accent); transform: translateY(-1px); color: inherit; }
.stat .ico { width: 16px; height: 16px; flex: 0 0 16px; }
.stat.cash .ico { color: var(--cash); }
.stat.gold .ico { color: var(--gold); }
.stat.health .ico { color: var(--health); }
.stat.energy .ico { color: var(--energy); }
.stat.stamina .ico { color: var(--stamina); }
.stat.xp .ico { color: var(--xp); }
.stat .stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; gap: 1px; }
.stat strong { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.cash strong { color: var(--cash); font-size: 16px; }
.stat.gold strong { color: var(--gold); }
.stat.health strong { color: var(--health); }
.stat.energy strong { color: var(--energy); }
.stat.stamina strong { color: var(--stamina); }
.stat.xp strong { color: var(--xp); }
.stat .tick { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vitals .k, .lvl-top .k {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.vitals .face.sm { width: 26px; height: 26px; max-width: 26px; max-height: 26px; border-radius: 50%; border: 1px solid var(--accent); object-fit: cover; flex: 0 0 auto; margin: 0; padding: 0; }
.stat.lvl {
  justify-content: center;
  min-width: 52px;
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}
.stat .lvl-num { font: 900 24px/1 var(--font-display); color: var(--accent-ink); }
.bar { position: relative; height: 6px; width: 56px; background: color-mix(in srgb, var(--ink) 12%, transparent); border-radius: 999px; overflow: hidden; }
.vitals .bar { position: absolute; left: 8px; right: 8px; bottom: 4px; width: auto; height: 3px; }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 0.6s var(--ease); }
.bar.xp > span { background: var(--xp); }
.bar.health > span { background: var(--health); }
.bar.energy > span { background: var(--energy); }
.bar.stamina > span { background: var(--stamina); }
.bar.is-full > span { box-shadow: 0 0 8px currentColor; }
.bar[hidden] { display: none; }
.bar.slim { display: inline-block; width: 72px; vertical-align: middle; margin-right: 6px; }

#nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 0 8px;
}
.nav-set { display: contents; }
.nav-phone { display: none; }
#nav .nav-set > a, button.nav-drop {
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--chrome-line);
  background: transparent;
  color: var(--chrome-ink);
  font: 700 14px/1.1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button.nav-drop::after { content: ""; width: 7px; height: 7px; margin-left: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
#nav .nav-set > a:hover, button.nav-drop:hover { border-color: var(--accent); color: var(--chrome-ink); filter: none; }
#nav .nav-set > a.active, button.nav-drop.active, .menu.is-open > button.nav-drop {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

#dock { display: none; }
.dock-short { display: none; }

/* ---------- Page ---------- */
#wrap, .panel, .cols, .cols > * { min-width: 0; max-width: 100%; }
#wrap { width: min(var(--wrap), calc(100% - 24px)); margin: 14px auto 40px; }
#page { width: 100%; }
#page > * { animation: rise-in 0.5s var(--ease) both; }
#page > *:nth-child(2) { animation-delay: 0.05s; }
#page > *:nth-child(3) { animation-delay: 0.1s; }
#page > *:nth-child(4) { animation-delay: 0.15s; }
#page > *:nth-child(5) { animation-delay: 0.2s; }
#page > *:nth-child(n+6) { animation-delay: 0.25s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

#toast { position: fixed; z-index: 80; left: 50%; bottom: calc(18px + var(--dock-h)); transform: translateX(-50%); width: min(460px, calc(100% - 24px)); pointer-events: none; }
#toast .flash { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); margin: 0; animation: toast-in 0.35s var(--spring); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
.flash {
  padding: 10px 12px;
  margin: 0 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  border-left-width: 4px;
  background: var(--surface);
  color: var(--ink-strong);
}
.flash.success { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.flash.error { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.flash.info { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }

.panel {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel > h2, .panel > h3 {
  margin: 0;
  padding: 11px 14px;
  background: var(--head-bg);
  color: var(--head-ink);
  border-bottom: 1px solid var(--line);
  font: 700 17px/1.2 var(--font-display);
}
.panel .body { padding: 14px; overflow-x: auto; }
.panel .body > :first-child { margin-top: 0; }
.panel .body > :last-child { margin-bottom: 0; }
.panel .body h3 { margin: 16px 0 6px; font-size: 16px; color: var(--accent-2); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cols > .panel { margin: 0 0 14px; }

.table-scroll { overflow-x: auto; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; min-width: 0; }
table.data th, table.data td { border-bottom: 1px solid var(--soft-line); padding: 9px 10px; text-align: left; vertical-align: middle; }
table.data th { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tr.is-locked { color: var(--muted); }
table.data tr.category th { background: var(--head-bg); color: var(--head-ink); text-transform: none; font-size: 14px; letter-spacing: 0; }
.row-actions, .quick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quick a, .chip, .filters a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-strong);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: border-color 0.15s, transform 0.15s;
}
.chip { min-height: 26px; padding: 2px 10px; font-size: 12px; }
.chip.is-gold { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.quick a:hover, .filters a:hover { border-color: var(--accent); transform: translateY(-1px); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.filters a.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.statgrid > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.statgrid strong { display: block; margin-top: 2px; color: var(--ink-strong); font: 800 20px/1.15 var(--font-body); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.rarity-common { color: var(--ink); }
.rarity-uncommon { color: var(--ok); }
.rarity-rare { color: var(--xp); }
.rarity-epic { color: #c79bff; }
.rarity-legendary { color: var(--gold); font-weight: 700; }
input.qty { width: 5em; max-width: 6em; }
form.inline { display: inline; }
.searchline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.searchline input { flex: 1 1 200px; max-width: none; }
.skill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-row form { margin: 0; }
.pager { margin-top: 10px; }
.empty { padding: 8px 0; color: var(--muted); }
nav.panel .body { display: flex; flex-wrap: wrap; gap: 6px 12px; }
nav.panel .body a { white-space: nowrap; }
.steps { padding-left: 1.3rem; }
.steps li { margin: 0.45rem 0; }
.secure-note { border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); padding: 10px 12px; }
.is-focus { outline: 2px solid var(--accent); scroll-margin-top: 140px; }
.wall-label { margin: 14px 0 8px; color: var(--accent-2); letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; font-weight: 700; }

/* Pictures */
#page img { max-height: 120px; object-fit: cover; }
.section-banner { display: none; }
.mark, .face, .face.sm, .portrait, .job-art, .result-art, .item-art, .req-icon, .crew img, .district img, .portrait-choice img {
  object-fit: cover;
  background: var(--surface-2);
  flex: 0 0 auto;
}
.face, .face.sm { width: 30px; height: 30px; max-width: 30px; max-height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); vertical-align: middle; margin-right: 4px; }
#page .face.lg { width: 104px; height: 104px; max-width: 104px; max-height: 104px; border-radius: var(--radius); }
#page img[width="180"] { width: 180px; height: 180px; max-width: 180px; max-height: 180px; border-radius: var(--radius); }

/* Guided tour */
.tour {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: tour-glow 2.4s ease-in-out infinite alternate;
}
@keyframes tour-glow { from { box-shadow: 0 0 0 2px var(--accent-soft); } to { box-shadow: 0 0 0 7px var(--accent-soft); } }
.tour-k { margin: 0 0 2px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.tour h2 { margin: 0 0 4px; font-size: 20px; }
.tour p { margin: 0 0 10px; }
.tour form { margin: 0; }

/* ---------- Jobs ---------- */
.job-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin: 0 0 10px; }
.job-tools .city-tag { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.job-tools .city-tag strong { color: var(--ink-strong); }
.tiers {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  padding: 2px 2px 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.tiers a {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 96px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--ink);
  text-decoration: none;
  scroll-snap-align: start;
  touch-action: manipulation;
  transition: transform 0.15s, border-color 0.15s, background 0.2s;
}
.tiers a strong { font-size: 14px; }
.tiers a small { font-size: 11px; color: var(--muted); }
.tiers a:hover { border-color: var(--accent); transform: translateY(-2px); }
.tiers a.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }
.tiers a.on small { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.stage-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 10px; font-size: 24px; }
.stage-title span { color: var(--muted); font: 600 14px var(--font-body); text-transform: none; letter-spacing: 0; }
.job-note { margin: 0 0 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink-strong); }

#job-board { display: flex; flex-direction: column; gap: 10px; }
.job-card {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.job-card:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); transform: translateY(-2px); }
.job-card.is-done { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.job-scene { min-height: 150px; }
.job-scene .scene-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.job-scene .scene-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.job-scene .mastery-ring {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.job-card.is-done .job-scene .mastery-ring { background: var(--gold); color: #1a1206; }
.job-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: start;
  padding: 12px 14px;
  min-width: 0;
}
.job-main { min-width: 0; }
.job-main h3, .job-identity h3 { margin: 0 0 4px; font-size: 20px; overflow-wrap: anywhere; }
.job-blurb { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.mastery { height: 7px; max-width: 260px; background: color-mix(in srgb, var(--ink) 12%, transparent); border-radius: 999px; overflow: hidden; }
.mastery > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, #000), var(--accent-2)); transition: width 0.8s var(--ease); }
.mastery.is-full > span { background: linear-gradient(90deg, var(--gold), #fff3b8); }
.mastery-label, .lock-note { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.pips { display: inline-flex; gap: 3px; margin-right: 5px; vertical-align: middle; }
.pips i { width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid var(--line-strong); background: transparent; }
.pips i.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 6px var(--accent-soft); }
.job-nums { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; padding: 0; list-style: none; }
.job-nums li { min-width: 0; }
.job-nums span { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.job-nums strong { display: block; font-size: 18px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink-strong); white-space: nowrap; }
.job-nums .pay { color: var(--cash); }
.job-nums .en { color: var(--energy); }
.job-nums .xpn { color: var(--xp); }
.job-act { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 128px; }
.job-act form { margin: 0; }
.job-act button, .job-act a { width: 100%; min-height: 48px; }
button.do-job { font-size: 16px; }
.job-body .job-nums, .job-reqs, .job-extra { grid-column: 1 / -1; min-width: 0; }
.job-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; color: var(--muted); font-size: 13px; }
.reqs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.reqs li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.reqs li.short { border-color: var(--danger); animation: need-pulse 1.8s ease-in-out infinite; }
@keyframes need-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 30%, transparent); } }
.req-copy { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.req-copy strong { color: var(--ink-strong); }
.req-copy span, .req-name { color: var(--muted); font-size: 12px; }
#page .req-icon, #page .job-card .req-icon { width: 36px; height: 36px; max-width: 36px; max-height: 36px; border-radius: var(--r-sm); object-fit: cover; }
.reqs form { margin: 0; }
.reqs form button { min-height: 38px; white-space: nowrap; }
.reqs .met, p.met { color: var(--ok); }
.reqs .short, p.short, .short { color: var(--warn); }
.energy-gap { margin: 6px 0 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.status { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border: 1px solid; border-radius: 999px; white-space: nowrap; }
.status.is-open { color: var(--ok); }
.status.is-locked { color: var(--warn); }
.status.is-done { color: var(--gold); }
.job-result { border-color: var(--accent); }
.job-result .body { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.job-result .flash { margin: 0; flex: 1 1 240px; }
button.repeat { min-height: 46px; padding: 8px 18px; }
.job-result.is-win { animation: win-glow 1.4s ease-out 1; }
@keyframes win-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cash) 60%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }

.boss-card {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) auto;
  grid-template-areas: "art copy fight" "art meta fight";
  gap: 6px 16px;
  align-items: center;
  padding: 0 16px 0 0;
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
}
.boss-card .boss-stage { grid-area: art; align-self: stretch; min-height: 210px; }
.boss-card .boss-stage img.boss-art {
  position: absolute;
  inset: auto 0 0 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 190px;
  max-height: 190px;
  object-fit: cover;
  object-position: center 18%;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  box-shadow: 0 0 0 2px var(--danger), 0 -8px 30px rgba(0, 0, 0, 0.5);
  animation: boss-breathe 4s ease-in-out infinite;
}
@keyframes boss-breathe { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.03); } }
.boss-copy { grid-area: copy; min-width: 0; padding-top: 14px; }
.boss-meta { grid-area: meta; min-width: 0; padding-bottom: 14px; }
.boss-fight { grid-area: fight; display: flex; flex-direction: column; gap: 6px; min-width: 128px; }
.boss-fight form { margin: 0; }
.boss-fight button, .boss-fight a { width: 100%; min-height: 50px; }
.boss-fight button.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 70%, #fff), var(--danger) 55%, color-mix(in srgb, var(--danger) 60%, #000)); color: #fff; border-color: transparent; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.boss-kicker { margin: 0; color: var(--danger); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.boss-copy h2 { margin: 2px 0 4px; font-size: 26px; }
.boss-copy p { margin: 0 0 4px; color: var(--muted); }
.boss-risk { color: var(--danger) !important; font-weight: 800; }
.boss-pay { margin: 0 0 2px; color: var(--cash); font: 800 22px/1.1 var(--font-body); }
.boss-xp { margin: 0 0 8px; color: var(--xp); font-weight: 700; }
.boss-requires { display: flex; gap: 14px; margin: 0 0 8px; padding: 0; list-style: none; }
.boss-icons { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; padding: 0; list-style: none; }
.boss-slot { position: relative; display: flex; flex-direction: column; align-items: center; width: 60px; gap: 2px; padding: 4px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.boss-slot.short { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); animation: need-pulse 1.8s ease-in-out infinite; }
#page .boss-card .req-icon { width: 46px; height: 46px; max-width: 46px; max-height: 46px; }
.boss-slot .qty { font-size: 11px; font-weight: 800; }
.boss-slot .short { font-size: 10px; text-align: center; }

/* The job running overlay plays the job's own scene. */
#job-work {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
#job-work[hidden] { display: none !important; }
.job-work-card {
  width: min(460px, 100%);
  border-radius: var(--r-lg);
  border: 1px solid var(--accent);
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: work-in 0.35s var(--spring);
}
@keyframes work-in { from { transform: scale(0.9) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.job-work-card .scene { height: 210px; }
.job-work-card .work-copy { padding: 14px 16px 16px; }
.job-work-card .work-copy p { margin: 0 0 4px; }
.job-work-card .work-name { font: 800 22px/1.15 var(--font-display); color: var(--ink-strong); }
.job-work-card .work-verb { color: var(--muted); }
.job-work-card .work-verb::after { content: "…"; animation: dots 1s steps(4) infinite; display: inline-block; width: 1em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1em; } }
.job-meter { height: 10px; margin-top: 10px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.job-meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, #000), var(--accent-2)); animation: job-load 0.9s linear forwards; }
@keyframes job-load { to { width: 100%; } }

/* What a job paid flies up off the button. */
.pop-layer { position: fixed; inset: 0; z-index: 95; pointer-events: none; overflow: hidden; }
.pop-gain {
  position: absolute;
  transform: translate(-50%, -50%);
  font: 900 26px/1 var(--font-body);
  color: var(--cash);
  text-shadow: 0 2px 0 #000, 0 0 14px color-mix(in srgb, var(--cash) 60%, transparent);
  white-space: nowrap;
  animation: gain-up 1.5s var(--ease) forwards;
}
.pop-gain.xp { color: var(--xp); font-size: 17px; text-shadow: 0 2px 0 #000; animation-delay: 0.12s; }
.pop-gain.bad { color: var(--danger); }
@keyframes gain-up { 0% { opacity: 0; transform: translate(-50%, -20%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 30% { transform: translate(-50%, -70%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -260%); } }
.pop-coin {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4b8, var(--gold) 45%, color-mix(in srgb, var(--gold) 55%, #000));
  box-shadow: 0 0 6px var(--gold);
  animation: coin-fly 0.95s ease-in forwards;
}
@keyframes coin-fly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  30% { transform: translate(var(--sx), var(--sy)) scale(1.1); }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.4); opacity: 0.9; }
}
.shake { animation: shake 0.45s ease; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
[data-cash].is-tick, [data-purse].is-tick { animation: cash-bump 0.5s var(--spring); display: inline-block; }
@keyframes cash-bump { 40% { transform: scale(1.22); color: var(--accent-2); } }

/* Level-up and other big moments. */
#roll {
  position: relative;
  z-index: 2;
  width: min(640px, 100%);
  margin: 0 auto 12px;
  padding: 12px 16px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--ink-strong);
  box-shadow: var(--shadow);
  font-weight: 700;
  animation: toast-in 0.35s var(--spring);
}
#roll.is-win { border-color: var(--ok); }
#roll.is-loss { border-color: var(--danger); animation: shake 0.45s ease; }

#page.no-intro > * { animation: none; }
.level-up {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(4, 3, 2, 0.9);
  overflow: hidden;
  animation: fade-in 0.25s ease;
}
.level-up > * { position: relative; }
.level-up h2 { margin: 0; font-size: 32px; animation: rise-in 0.5s var(--ease) 0.5s both; }
.level-up p { margin: 0; max-width: 420px; color: var(--ink); animation: rise-in 0.5s var(--ease) 0.65s both; }
.level-up button { min-width: 220px; animation: rise-in 0.5s var(--ease) 0.8s both; }
.lu-rays {
  position: absolute !important;
  left: 50%;
  top: 50%;
  width: 1200px;
  height: 1200px;
  margin: -640px 0 0 -600px;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--accent-soft) 0 10deg, transparent 10deg 20deg);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lu-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff4b8, var(--gold) 42%, color-mix(in srgb, var(--gold) 50%, #000));
  color: #2a1d08;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.4), 0 0 0 10px var(--gold), 0 0 70px var(--gold);
  animation: badge-in 0.75s var(--spring) 0.1s both;
}
.lu-badge span { font: 800 13px var(--font-body); letter-spacing: 0.22em; text-transform: uppercase; }
.lu-badge strong { font: 900 70px/1 var(--font-display); }
@keyframes badge-in { from { transform: scale(0) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
.lu-confetti {
  position: absolute !important;
  top: -20px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  background: hsl(var(--hue) 85% 60%);
  animation: confetti 2.8s linear infinite;
}
@keyframes confetti { to { transform: translateY(110vh) rotate(720deg); } }

/* Dialogs */
.refill-dialog {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.62);
  animation: fade-in 0.2s ease;
}
.refill-dialog[hidden] { display: none; }
#confirm, #share { z-index: 96; }
.refill-card {
  width: min(460px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--accent);
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  animation: work-in 0.3s var(--spring);
}
.refill-card h2 { margin: 0 0 8px; }
.refill-card h3 { margin: 12px 0 4px; font-size: 15px; color: var(--accent-2); }
.refill-card p { margin: 0 0 8px; }
.refill-card form { margin: 0 0 8px; }
.refill-drink { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; align-items: center; margin: 0 0 8px; }
.refill-drink img { width: 48px; height: 48px; max-width: 48px; max-height: 48px; border-radius: var(--r-sm); object-fit: cover; }
.stage-plate { margin: 8px 0 0; padding: 16px 14px; text-align: center; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.stage-plate b { display: block; color: var(--accent); font-size: 16px; margin-bottom: 4px; }
.stage-plate p { margin: 0; color: var(--muted); }

/* ---------- Home: the street and the house ---------- */
.street {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.district {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 132px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease), border-color 0.2s;
}
.district:hover { transform: translateY(-4px) scale(1.01); border-color: var(--accent); color: #fff; }
.district .scene-title { position: relative; z-index: 1; font: 800 18px/1.1 var(--font-display); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }
.district .scene-title small { display: block; font: 600 12px var(--font-body); color: rgba(255, 255, 255, 0.82); text-transform: none; letter-spacing: 0; }
.district .bubble, .house-bubble {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  animation: bob 1.2s ease-in-out infinite alternate;
}
.district .bubble.cash, .house-bubble { background: var(--cash); color: #0c1a06; }
.district .bubble.alert { background: var(--danger); color: #fff; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-6px); } }
.district.is-closed { filter: grayscale(0.9) brightness(0.65); }
.district.is-closed .scene-title small::before { content: "Opens at "; }

.house {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  min-height: 260px;
  border-radius: var(--radius);
}
.house-scene { min-height: 260px; }
.house-scene .house-name {
  position: absolute;
  left: 16px;
  bottom: 14px;
  right: 16px;
  z-index: 1;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}
.house-scene .house-name p { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-2); }
.house-scene .house-name h2 { margin: 2px 0 0; font-size: 30px; color: #fff; }
.house-scene .house-name span { font-size: 14px; color: rgba(255, 255, 255, 0.86); }
.house-info { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.house-info .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.owned-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; }
.owned-chip {
  position: relative;
  flex: 0 0 170px;
  min-height: 104px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: #fff;
  text-decoration: none;
  scroll-snap-align: start;
  transition: transform 0.2s var(--ease);
}
.owned-chip:hover { transform: translateY(-3px); color: #fff; }
.owned-chip b { position: relative; z-index: 1; font-size: 14px; text-shadow: 0 1px 6px #000; }
.owned-chip small { position: relative; z-index: 1; font-size: 12px; color: rgba(255, 255, 255, 0.86); }
.owned-chip .house-bubble { top: 8px; right: 8px; font-size: 11px; padding: 2px 8px; }

.district-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

/* ---------- Living City ---------- */
.living-street, .living-office { margin: 0 0 14px; }
.living-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  touch-action: pan-y;
}
#page .living-stage .ls-art { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: cover; }
.living-stage .ls-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.living-stage .ls-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 25%, transparent 55%, rgba(0, 0, 0, 0.82)); }
.living-stage.is-walking .ls-art, .living-stage.is-walking .ls-fx { animation: ls-walk 0.6s var(--ease); }
@keyframes ls-walk { from { opacity: 0.2; transform: scale(1.08); } to { opacity: 1; transform: none; } }
.ls-plate { position: absolute; left: 20px; right: 20px; bottom: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: #fff; }
.ls-plate h2 { margin: 0; color: #fff; font-size: clamp(24px, 3.4vw, 40px); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9); }
.ls-plate p { margin: 0; color: rgba(255, 255, 255, 0.88); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
.ls-plate .primary { margin-top: 8px; }
.ls-plate .primary.is-locked { filter: grayscale(1); opacity: 0.8; }
.ls-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-2) !important; }
.ls-bubble { padding: 4px 12px; border-radius: 999px; background: var(--cash); color: #0c1a06; font-weight: 800; font-size: 13px; animation: bob 1.2s ease-in-out infinite alternate; }
.ls-arrow {
  position: absolute;
  top: 42%;
  width: 52px;
  height: 52px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 30px;
  line-height: 1;
}
.ls-arrow.prev { left: 14px; }
.ls-arrow.next { right: 14px; }
.ls-arrow:hover { background: rgba(0, 0, 0, 0.7); border-color: var(--accent); }
.ls-stops { display: flex; gap: 8px; margin-top: 10px; padding: 2px 2px 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
.ls-stops a {
  position: relative;
  flex: 0 0 132px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  scroll-snap-align: start;
  transition: border-color 0.15s, transform 0.15s;
}
#page .ls-stops img { width: 100%; height: 66px; max-height: 66px; object-fit: cover; border-radius: calc(var(--r-sm) - 2px); }
.ls-stops a.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ls-stops a:hover { transform: translateY(-2px); }
.ls-stops a.is-locked { opacity: 0.55; }
.ls-stops a.is-locked img { filter: grayscale(1); }
.ls-stops a i { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--cash); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5); }
.ls-spot { position: absolute; z-index: 2; display: flex; align-items: center; gap: 6px; transform: translate(-50%, -50%); color: #fff; text-decoration: none; font-size: 12px; font-weight: 700; }
.ls-spot i { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: spot-ping 2s ease-out infinite; flex: none; }
@keyframes spot-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 80%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
.ls-spot span { padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.72); border: 1px solid rgba(255, 255, 255, 0.2); white-space: nowrap; }
.ls-spot:hover span { background: var(--accent); color: var(--accent-ink); }
.house.is-compact { display: block; min-height: 0; }

/* In Living City, a job plays out full screen in its own painting. */
html[data-layout="living"] #job-work { padding: 0; background: #000; }
html[data-layout="living"] .job-work-card { width: 100%; height: 100%; max-width: none; border: 0; border-radius: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; animation: fade-in 0.3s ease; }
html[data-layout="living"] .job-work-card .scene { height: auto; }
html[data-layout="living"] .job-work-card .scene > .sc-art { animation-duration: 8s; }
html[data-layout="living"] .job-work-card .work-copy { width: min(720px, 100%); margin: 0 auto; padding: 16px 18px 22px; }
html[data-layout="living"] .work-name { font-size: clamp(24px, 4vw, 36px); }
.work-steps { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 8px 0 0; padding: 0; list-style: none; }
.work-steps li { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 700; animation: step-on 0.4s ease both; }
.work-steps li::before { content: "○ "; }
.work-steps li.done { color: var(--ok); }
.work-steps li.done::before { content: "✓ "; }
@keyframes step-on { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Shop, inventory, businesses, properties ---------- */
.biz-grid, .item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.biz-card, .item-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass-2);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.biz-card:hover, .item-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.biz-card.is-best, .item-card.is-equipped { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.biz-card h3, .item-card h3 { margin: 0; font-size: 17px; text-transform: none; letter-spacing: 0; }
.biz-card p, .item-card p { margin: 0; }
#page .biz-card img, #page .biz-art, #page .biz-preview { width: 100%; height: 130px; max-height: 130px; object-fit: cover; border-radius: var(--r-sm); display: block; }
#page .item-art { width: 72px; height: 72px; max-width: 72px; max-height: 72px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.item-card form, .biz-card form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.uses { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icon-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; margin: 0 0 10px; }
.icon-tile {
  position: relative;
  padding: 8px 6px 10px;
  text-align: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--glass-2);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.icon-tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.icon-tile.is-equipped { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#page .icon-tile img { width: 76px; height: 76px; max-width: 76px; max-height: 76px; border-radius: var(--r-sm); object-fit: cover; }
.icon-tile .stack { position: absolute; top: 6px; right: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; }
.icon-tile h3 { margin: 6px 0 2px; font-size: 13px; line-height: 1.2; font-family: var(--font-body); }
.icon-tile p { margin: 0; font-size: 11px; }
.icon-tile .row-actions { justify-content: center; margin-top: 6px; }
.icon-tile button { min-height: 34px; padding: 4px 10px; font-size: 12px; }

.skyline-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.skyline-bar p { flex: 1 1 260px; margin: 0; }
.skyline-wrap { display: flex; align-items: center; gap: 6px; }
.skyline { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 2px 14px; flex: 1; }
.tower {
  flex: 0 0 220px;
  scroll-snap-align: start;
  padding: 0 0 10px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass-2);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.tower:hover { transform: translateY(-3px); border-color: var(--accent); }
.tower > :not(.tower-scene):not(img) { margin-left: 10px; margin-right: 10px; }
.tower-scene { height: 150px; margin-bottom: 8px; }
#page .tower img { width: 100%; height: 150px; max-height: 150px; object-fit: cover; object-position: center top; display: block; margin-bottom: 8px; }
.tower h3 { margin: 6px 10px 2px; font-size: 16px; }
.tower form { margin: 8px 10px 0; }
.tower form button { width: 100%; }
.sky-arrow { min-width: 40px; min-height: 48px; padding: 0 8px; font-size: 22px; line-height: 1; border-radius: 999px; }
.upgrade-card { margin: 8px 10px 0; text-align: left; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); padding: 8px; }
.upgrade-card summary { cursor: pointer; color: var(--accent-2); font-weight: 700; list-style: none; }
.upgrade-card summary::-webkit-details-marker { display: none; }
.hq-brass { box-shadow: inset 0 0 0 2px #e2b657; }
.hq-oxblood { box-shadow: inset 0 0 0 2px #8a2a34; }
.hq-midnight { box-shadow: inset 0 0 0 2px #2a4d7a; }

/* ---------- Gear: shop and inventory cards ---------- */
.gear-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gear-card {
  --r: #8a8478;
  position: relative;
  gap: 8px;
  padding: 0 0 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--r) 55%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--r) 14%, var(--surface-2)), var(--surface-2) 45%);
}
.gear-card > :not(.gear-art) { margin-left: 12px; margin-right: 12px; }
.gear-card.r-common { --r: #8a8478; }
.gear-card.r-uncommon { --r: #5fae4a; }
.gear-card.r-rare { --r: #4a8fd6; }
.gear-card.r-epic { --r: #a35ad6; }
.gear-card.r-legendary { --r: #e0a83a; }
.gear-card.r-epic, .gear-card.r-legendary { box-shadow: 0 0 0 1px color-mix(in srgb, var(--r) 40%, transparent), 0 10px 30px color-mix(in srgb, var(--r) 22%, transparent); }
.gear-card:hover { border-color: var(--r); }
.gear-card.is-locked { opacity: 0.72; }
.gear-art { position: relative; aspect-ratio: 1 / 1; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--r) 30%, #15130f), #0a0908 75%); overflow: hidden; }
#page .gear-art img { width: 100%; height: 100%; max-height: none; object-fit: cover; display: block; transition: transform 0.5s var(--ease); }
.gear-card:hover .gear-art img { transform: scale(1.05); }
.gear-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.55)); pointer-events: none; }
.gear-card.r-legendary .gear-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 236, 170, 0.28) 50%, transparent 65%);
  background-size: 250% 100%;
  animation: shine 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.gear-type, .gear-rarity, .gear-count {
  position: absolute;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.gear-type { left: 8px; top: 8px; background: rgba(0, 0, 0, 0.65); color: #fff; }
.gear-rarity { left: 8px; bottom: 8px; background: var(--r); color: #0b0a08; text-transform: uppercase; }
.gear-count { right: 8px; top: 8px; background: var(--accent); color: var(--accent-ink); }
.panel .body .gear-card > h3 { margin: 4px 12px 0; font-size: 18px; color: var(--ink-strong); }
.gear-card > p { font-size: 13px; }
.gear-stats { display: grid; gap: 5px; }
.gear-stat { display: grid; grid-template-columns: 60px 34px 1fr; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.gear-stat b { color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.gear-stat i { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.gear-stat s { display: block; height: 100%; border-radius: inherit; background: var(--danger); }
.gear-stat.def s { background: var(--xp); }
.gear-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; }
.gear-chips span { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); }
.gear-chips .hp { color: var(--health); }
.gear-chips .en { color: var(--energy); }
.gear-chips .st { color: var(--stamina); }
.gear-desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gear-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 12px; }
.gear-meta .on { color: var(--accent); font-weight: 800; }
.gear-card .price { margin-top: auto; font: 800 20px var(--font-body); color: var(--cash); }
.gear-card form { flex-wrap: nowrap; }
.gear-card form button.primary { flex: 1; }
.gear-card details.gift summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.gear-card details.gift form { margin-top: 6px; flex-wrap: wrap; }
.gear-card details.gift select { flex: 1 1 120px; }
.art-admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.item-frame { aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--line-strong); }
#page .item-frame img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
@media (max-width: 760px) {
  .gear-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gear-card > :not(.gear-art) { margin-left: 8px; margin-right: 8px; }
  .panel .body .gear-card > h3 { margin: 4px 8px 0; font-size: 15px; }
  .gear-stat { grid-template-columns: 48px 28px 1fr; }
  .gear-card form { flex-wrap: wrap; }
  .gear-card .qty { width: 100%; max-width: none; }
  .art-admin { grid-template-columns: 1fr; }
}
@media (max-width: 380px) { .gear-grid { grid-template-columns: 1fr; } }

/* ---------- Gate: login and register ---------- */
body.gate #wrap { width: min(1080px, calc(100% - 24px)); margin-top: 24px; }
.gate-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 420px); gap: 14px; align-items: stretch; }
.gate-pitch .city, #page .city { width: 100%; height: 220px; max-height: 220px; object-fit: cover; display: block; }
.gate-pitch .crew { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 0; }
.gate-pitch .crew img, .crew img { width: 52px; height: 52px; max-width: 52px; max-height: 52px; flex: 0 0 52px; object-fit: cover; border-radius: 50%; border: 2px solid var(--accent); }
.auth-card, .gate-pitch { height: 100%; }
.auth-card { display: flex; flex-direction: column; }
.auth-card .body { flex: 1; }
.auth-card input[type="text"], .auth-card input[type="email"], .auth-card input[type="password"], .auth-card .secret { max-width: none; }
.pitch-list { margin: 0; padding-left: 20px; }
.pitch-list li { margin: 0 0 6px; }
fieldset.portrait-choice { border: 0; margin: 0; padding: 0; }
fieldset.portrait-choice legend { font-weight: 700; padding: 0; margin-bottom: 6px; width: 100%; color: var(--ink-strong); }
.portrait-choice { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.portrait-choice label { border: 2px solid var(--line); border-radius: var(--r-sm); padding: 3px; background: var(--surface-2); cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.portrait-choice label:hover { transform: translateY(-2px); }
.portrait-choice label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.portrait-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.portrait-choice img { width: 58px; height: 58px; max-width: 58px; max-height: 58px; display: block; border-radius: calc(var(--r-sm) - 2px); }

/* ---------- Misc game pages ---------- */
#wheel { position: relative; width: 260px; max-width: 100%; margin: 12px auto 0; }
#wheel-rotor {
  width: 240px;
  height: 240px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 50%;
  border: 8px solid var(--accent);
  background: conic-gradient(
    color-mix(in srgb, var(--accent) 70%, #000) 0 45deg, var(--surface-2) 45deg 90deg,
    color-mix(in srgb, var(--accent) 45%, #000) 90deg 135deg, var(--surface) 135deg 180deg,
    var(--accent) 180deg 225deg, var(--surface-2) 225deg 270deg,
    color-mix(in srgb, var(--accent) 55%, #000) 270deg 315deg, var(--surface) 315deg 360deg);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), inset 0 0 0 10px rgba(0, 0, 0, 0.25), 0 0 30px var(--accent-soft);
}
.wheel-pointer { position: absolute; left: 50%; top: -4px; width: 0; height: 0; margin-left: -10px; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 18px solid var(--accent-2); z-index: 1; filter: drop-shadow(0 2px 2px #000); }
.wheel-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 0; list-style: none; }
.studio-text { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; }
.studio-image { max-width: min(480px, 100%); border-radius: var(--r-sm); }
#invite-emails { width: 100%; min-height: 160px; max-height: 280px; }
.class-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 12px; }
.class-card.is-on { box-shadow: inset 0 0 0 2px var(--accent); }
.class-card dl { margin: 8px 0; }
.class-card dt { color: var(--accent); font-size: 12px; font-weight: 700; }
.class-card dd { margin: 0 0 8px; }
.seat-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 8px 0; }
.city-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.city-card, .crew-seat { position: relative; padding: 14px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass-2); overflow: hidden; }
.city-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.city-card .city-scene { height: 140px; margin: -14px -14px 12px; }
.city-art { display: block; width: calc(100% + 28px); height: 140px; max-height: 140px !important; object-fit: cover; margin: -14px -14px 12px; }
.fight-acts form { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 2px 6px 2px 0; align-items: center; }
.fight-acts input[type="number"] { width: 6rem; }
.class-pick { display: block; margin: 6px 0; }

/* ---------- Admin ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 0 0 12px; }
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--accent-soft), transparent 60%), var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  animation: rise-in 0.5s var(--ease) both;
}
.kpi strong { color: var(--ink-strong); font: 800 30px/1.1 var(--font-body); font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; }
.kpi.is-alert { border-color: var(--danger); }
.kpi.is-alert strong { color: var(--danger); }
.kpis .kpi:nth-child(2) { animation-delay: 0.05s; }
.kpis .kpi:nth-child(3) { animation-delay: 0.1s; }
.kpis .kpi:nth-child(4) { animation-delay: 0.15s; }
.kpis .kpi:nth-child(5) { animation-delay: 0.2s; }
.kpis .kpi:nth-child(6) { animation-delay: 0.25s; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); vertical-align: 1px; animation: live-ping 1.6s ease-out infinite; }
@keyframes live-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feed li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); animation: rise-in 0.4s var(--ease) both; }
.feed li small { color: var(--muted); }

body.board-admin { --wrap: 1400px; }
body.board-admin #chrome, body.board-admin #wrap { margin-left: 236px; }
body.board-admin #wrap { width: auto; padding: 0 20px; }
body.board-admin #topbar, body.board-admin .vitals, body.board-admin #nav { width: calc(100% - 40px); }
body.board-admin nav.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  width: 236px;
  overflow: auto;
  padding: 16px 12px 28px;
  background: var(--chrome);
  border-right: 1px solid var(--line);
}
body.board-admin nav.rail::before { content: "Control room"; display: block; padding: 0 10px 12px; font: 800 18px var(--font-display); color: var(--accent); }
body.board-admin nav.rail a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
body.board-admin nav.rail a.active, body.board-admin nav.rail a:hover { background: var(--accent-soft); color: var(--ink-strong); box-shadow: inset 3px 0 0 var(--accent); }
body.board-admin nav.rail .group { margin: 16px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 0 0 14px; }
.design-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; transition: border-color 0.2s, transform 0.2s; }
.design-card.is-on { border-color: var(--ok); }
.design-card.is-default { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.design-card:hover { transform: translateY(-2px); }
.design-copy { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.design-copy h3 { margin: 0; font-size: 18px; }
.design-copy p { margin: 0; font-size: 13px; }
.design-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.design-acts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.design-acts .btn, .design-acts button { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.design-mock { padding: 10px; background: var(--p-bg); font-family: var(--p-body); }
.dm-chrome { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--p-radius); background: var(--p-chrome); color: var(--p-accent); font: 700 13px var(--p-display); }
.dm-chrome b { flex: 1; }
.dm-chrome i { width: 26px; height: 8px; border-radius: 4px; background: var(--p-surface-2); }
.dm-panel { margin-top: 8px; border-radius: var(--p-radius); background: var(--p-surface); border: 1px solid var(--p-line); overflow: hidden; }
.dm-head { padding: 5px 8px; background: var(--p-head-bg); color: var(--p-head-ink); font: 700 12px var(--p-display); }
.dm-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--p-line); }
.dm-art { width: 26px; height: 26px; border-radius: calc(var(--p-radius) * 0.5); background: linear-gradient(135deg, var(--p-surface-2), var(--p-muted)); }
.dm-copy { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.dm-copy b { color: var(--p-ink-strong); font-size: 12px; font-family: var(--p-display); }
.dm-copy em { color: var(--p-cash); font-style: normal; font-size: 11px; font-weight: 700; }
.dm-btn { padding: 4px 8px; border-radius: calc(var(--p-radius) * 0.6); background: var(--p-accent); color: var(--p-accent-ink); font-size: 11px; font-weight: 800; }
.dm-bars { display: grid; gap: 4px; padding: 6px 8px 8px; }
.dm-bars s { display: block; height: 4px; border-radius: 2px; background: var(--p-energy); }
.dm-bars s + s { background: var(--p-xp); }
.upload-box { padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); max-width: 640px; }
.upload-box label { display: block; font-weight: 700; margin-bottom: 4px; }
.upload-note { margin: 0; min-height: 1.4em; font-weight: 600; }
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 0 0 14px; }
.token-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.token-field code { font-size: 11px; }
.token-pair { display: flex; gap: 6px; }
.token-pair input:not([type="color"]) { flex: 1; }


/* ---------- Wide screens ---------- */
@media (min-width: 1600px) { :root { --wrap: 1360px; } }
@media (min-width: 2200px) { :root { --wrap: 1560px; } body { font-size: 16px; } }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .vitals { grid-template-columns: minmax(140px, 1.4fr) minmax(64px, 0.6fr) repeat(4, minmax(0, 1fr)); }
  .vitals .stat.lvl { display: none; }
  .lvl-top {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
  }
  .lvl-top strong { font: 900 18px/1 var(--font-display); color: var(--accent-ink); }
  .street { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .boss-card { grid-template-columns: 170px minmax(0, 1fr) auto; }
}
@media (max-width: 980px) {
  .job-card { grid-template-columns: 170px minmax(0, 1fr); }
  .class-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .gate-grid { grid-template-columns: 1fr; }
  .house { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body.board-admin #chrome, body.board-admin #wrap { margin-left: 0; }
  body.board-admin #wrap { padding: 0; width: min(100% - 24px, var(--wrap)); }
  body.board-admin #topbar { width: calc(100% - 24px); }
  body.board-admin nav.rail {
    position: sticky;
    top: 0;
    width: auto;
    display: flex;
    gap: 4px;
    padding: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    z-index: 35;
  }
  body.board-admin nav.rail::before, body.board-admin nav.rail .group { display: none; }
  body.board-admin nav.rail a { white-space: nowrap; flex: 0 0 auto; }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  :root { --dock-h: calc(64px + env(safe-area-inset-bottom)); }
  body { font-size: 15px; }
  #topbar, .vitals, #nav, #wrap, body.gate #wrap { width: calc(100% - 16px); }
  #topbar { gap: 6px; padding: 6px 0 4px; min-height: 46px; }
  body.in-game #topbar { flex-wrap: nowrap; }
  #topbar .logo { overflow: hidden; }
  #topbar .word { font-size: 21px; }
  .travel-btn { min-height: 34px; padding: 4px 10px; font-size: 12px; max-width: 130px; }
  .travel-btn span { overflow: hidden; text-overflow: ellipsis; }
  body.gate #topbar { flex-wrap: wrap; }
  body.gate .util { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; gap: 0 14px; scrollbar-width: none; }
  body.in-game .util { flex: 0 0 auto; flex-wrap: nowrap; }
  .who { display: none; }
  .menu-word { display: inline; }
  button.menu-btn { min-height: 34px; padding: 4px 12px; font-size: 13px; }
  .lvl-top { min-height: 34px; padding: 0 10px; }

  .vitals {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding-bottom: 6px;
  }
  .vitals .stat.cash { grid-column: 1 / 3; }
  .vitals .stat.gold { grid-column: 3 / 5; }
  .vitals .face { display: none; }
  .stat, button.stat, a.stat { min-height: 40px; padding: 4px 6px 7px; gap: 4px; }
  .vitals .stat.health .ico, .vitals .stat.energy .ico, .vitals .stat.stamina .ico, .vitals .stat.xp .ico { display: none; }
  .stat strong { font-size: 13px; }
  .stat.cash strong { font-size: 15px; }
  .stat .tick { font-size: 10px; }
  .vitals .bar { left: 6px; right: 6px; bottom: 3px; }

  #nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 0 0 6px; }
  .nav-desk { display: none; }
  .nav-phone { display: contents; }
  #nav .menu { min-width: 0; }
  #nav .nav-set > a, #nav button.nav-drop { width: 100%; min-height: 36px; padding: 6px 4px; font-size: 13px; justify-content: center; }
  #nav .submenu { left: 0; right: auto; min-width: 180px; }
  #nav .nav-set > .menu:nth-child(3n) .submenu, #nav .nav-set > .menu:last-child .submenu { left: auto; right: 0; }

  #dock {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    padding: 4px 4px env(safe-area-inset-bottom);
    background: var(--chrome);
    border-top: 1px solid var(--line);
  }
  #dock a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 58px;
    padding: 4px 2px;
    border-radius: var(--r-sm);
    color: var(--chrome-quiet);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    transition: color 0.15s, background 0.15s;
  }
  #dock a .ico { width: 22px; height: 22px; transition: transform 0.25s var(--spring); }
  #dock a.active { color: var(--chrome-ink); background: color-mix(in srgb, var(--accent) 30%, transparent); }
  #dock a.active .ico { color: var(--accent); }
  #dock a.active .ico { transform: translateY(-2px) scale(1.12); }
  .dock-long { display: none; }
  .dock-short { display: inline; }
  body.in-game { padding-bottom: var(--dock-h); }
  .job-act, .job-tools, .tiers { scroll-margin-bottom: calc(var(--dock-h) + 20px); }

  .panel { border-radius: var(--r-sm); }
  .panel .body { padding: 12px; }
  .cols { display: block; }
  .gate-pitch .city, #page .city { height: 160px; max-height: 160px; }
  .biz-grid, .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .street { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .district { min-height: 112px; }

  .job-card { grid-template-columns: 1fr; }
  .job-scene { min-height: 120px; }
  .job-body { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px 12px; gap: 6px 10px; }
  .job-main h3 { font-size: 18px; }
  .job-act { min-width: 112px; }
  .job-nums strong { font-size: 16px; }
  .reqs li { width: 100%; }
  .reqs form { margin-left: auto; }

  .boss-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "art art" "copy fight" "meta meta";
    padding: 0;
  }
  .boss-card .boss-stage { min-height: 170px; }
  .boss-card .boss-stage img.boss-art { width: 120px; height: 155px; max-height: 155px; }
  .boss-copy { padding: 10px 0 0 12px; }
  .boss-copy h2 { font-size: 22px; }
  .boss-fight { padding: 10px 12px 0 0; min-width: 112px; }
  .boss-meta { padding: 0 12px 12px; }
  .boss-copy p:not(.boss-kicker):not(.boss-risk) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  .tower { flex-basis: 78%; }
  .sky-arrow { display: none; }
  .house-scene { min-height: 210px; }
  .house-scene .house-name h2 { font-size: 24px; }
  .house-info .statgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .house-info .statgrid > div { padding: 7px 8px; font-size: 12px; }
  .house-info .statgrid strong { font-size: 16px; }

  table.data th:nth-child(n+4):not(:last-child), table.data td:nth-child(n+4):not(:last-child) { display: none; }
  button, .btn, input, select { min-height: 42px; }
  #nav .nav-set > a, #nav button.nav-drop, button.menu-btn, button.stat, a.stat { min-height: 0; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="color"]):not([type="file"]), select, textarea { max-width: none; font-size: 16px; }
  .secret { max-width: none; }
  .refill-dialog { place-items: end center; padding: 10px 10px calc(var(--dock-h) + 10px); }
  .design-grid { grid-template-columns: 1fr; }
  .living-stage.ls-tall { aspect-ratio: 4 / 5; max-height: 66vh; }
  #backdrop > .fx, #backdrop > .sc-art { animation: none; }
  #backdrop > .fx { display: none; }
  .ls-arrow { width: 42px; height: 42px; font-size: 24px; top: 38%; }
  .ls-arrow.prev { left: 8px; }
  .ls-arrow.next { right: 8px; }
  .ls-plate { left: 14px; right: 14px; bottom: 14px; }
  .ls-plate .primary { width: 100%; }
  .ls-stops a { flex-basis: 108px; }
  #page .ls-stops img { height: 54px; max-height: 54px; }
  .ls-spot span { font-size: 11px; padding: 3px 7px; }
}

/* Small phones */
@media (max-width: 380px) {
  #topbar .word { font-size: 18px; }
  .travel-btn span { display: none; }
  .travel-btn { padding: 4px 8px; }
  .job-body { grid-template-columns: 1fr; }
  .job-act { min-width: 0; }
  .boss-card { grid-template-columns: 1fr; grid-template-areas: "art" "copy" "fight" "meta"; }
  .boss-copy { padding: 10px 12px 0; }
  .boss-fight { padding: 8px 12px 0; }
  .biz-grid, .item-grid { grid-template-columns: 1fr; }
  #dock a { font-size: 10px; }
  .stat .tick { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
html.lite .gear-card .gear-art::before { animation: none; }
