
      :root {
        --gold: #f2b544;
        --gold-dim: #c78f2a;
        --pink: #ff4d8d;
        --ink: #07070d;
        --panel: rgba(13, 15, 24, 0.88);
        --panel-solid: #10121d;
        --line: rgba(255, 255, 255, 0.13);
        --text: #f4f1ea;
        --muted: #a9a5ba;
        --good: #57d977;
        --warn: #ffb02e;
        --bad: #ff5d5d;
      }
      html, body { height: 100%; }
      body {
        margin: 0;
        background: var(--ink);
        color: var(--text);
        font-family: "Archivo", system-ui, -apple-system, sans-serif;
        overflow: hidden;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
      }
      button { font-family: inherit; cursor: pointer; }
      #stage { position: fixed; inset: 0; overflow: hidden; }
      body.rotated #stage {
        inset: auto; left: 50%; top: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
      }
      #scene { position: fixed; inset: 0; touch-action: none; }
      #scene canvas { display: block; }

      /* ---------- Top HUD ---------- */
      #hud {
        position: fixed; top: 0; left: 0; right: 0;
        display: flex; align-items: flex-start; gap: 10px;
        padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
        pointer-events: none;
        z-index: 20;
      }
      .hud-box {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: 6px 12px;
        backdrop-filter: blur(6px);
      }
      #cash-box { pointer-events: auto; }
      #cash-label { font-size: 10px; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
      #cash {
        font-family: "Bebas Neue", sans-serif;
        font-size: 34px; line-height: 0.95; color: var(--gold);
        letter-spacing: 0.03em;
      }
      #cash.bump { animation: cashBump 0.35s ease; }
      #cash.shake { animation: cashShake 0.35s ease; }
      @keyframes cashBump { 30% { transform: scale(1.13); } }
      @keyframes cashShake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
      #clock-box { text-align: center; }
      #night-label { font-size: 10px; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
      #clock { font-family: "Bebas Neue", sans-serif; font-size: 26px; line-height: 1; color: var(--text); }
      #night-progress { height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; margin-top: 5px; overflow: hidden; }
      #night-progress-fill { height: 100%; width: 0%; background: var(--pink); border-radius: 2px; }
      #stats-box { margin-left: auto; text-align: right; }
      #boss-level { font-family: "Bebas Neue", sans-serif; font-size: 20px; color: var(--pink); line-height: 1; letter-spacing: 0.05em; }
      #boss-level.champion { color: var(--gold); text-shadow: 0 0 12px rgba(242,181,68,0.65); }
      #lifetime { font-size: 11px; color: var(--muted); margin-top: 3px; }
      #lifetime b { color: var(--text); }
      #hud-buttons { display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
      .icon-btn {
        width: 40px; height: 40px; border-radius: 10px;
        background: var(--panel); border: 1px solid var(--line);
        color: var(--text); font-size: 18px; line-height: 1;
        display: flex; align-items: center; justify-content: center;
        backdrop-filter: blur(6px);
      }
      .icon-btn:active { transform: scale(0.94); }

      /* ---------- Ticker ---------- */
      #ticker {
        position: fixed; left: 12px; bottom: 178px; z-index: 15;
        display: flex; flex-direction: column-reverse; gap: 4px;
        max-width: min(78vw, 430px); pointer-events: none;
      }
      .tick {
        background: rgba(10, 11, 18, 0.78);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 5px 10px;
        font-size: 12.5px; line-height: 1.35;
        animation: tickIn 0.25s ease;
      }
      .tick.old { opacity: 0.55; }
      .tick b { color: var(--gold); }
      @keyframes tickIn { from { opacity: 0; transform: translateY(6px); } }

      /* ---------- Crew panel ---------- */
      #crew-wrap {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
        padding: 0 10px calc(8px + env(safe-area-inset-bottom));
        pointer-events: none;
      }
      #crew-bar {
        display: flex; align-items: center; gap: 8px;
        pointer-events: auto; margin-bottom: 6px;
      }
      #crew-toggle {
        background: var(--panel); border: 1px solid var(--line); color: var(--text);
        border-radius: 9px; padding: 7px 12px; font-weight: 700; font-size: 13px;
        backdrop-filter: blur(6px);
      }
      #hire-btn {
        margin-left: auto;
        background: linear-gradient(180deg, var(--gold), var(--gold-dim));
        border: none; color: #221600; font-weight: 800; font-size: 13.5px;
        border-radius: 9px; padding: 8px 14px;
        box-shadow: 0 2px 10px rgba(242, 181, 68, 0.35);
      }
      #hire-btn:disabled { filter: grayscale(0.8); opacity: 0.45; box-shadow: none; }
      #hire-btn:active { transform: scale(0.97); }
      #crew-panel {
        pointer-events: auto;
        display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
        gap: 8px; max-height: 30vh; overflow-y: auto;
        -webkit-overflow-scrolling: touch;
      }
      #crew-panel.hidden { display: none; }
      .card {
        background: var(--panel); border: 1px solid var(--line);
        border-radius: 10px; padding: 8px 10px;
        backdrop-filter: blur(6px);
      }
      .card-top { display: flex; align-items: baseline; gap: 6px; }
      .card-name { font-family: "Bebas Neue", sans-serif; font-size: 19px; letter-spacing: 0.04em; }
      .card-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; align-self: center; }
      .card-status { font-size: 11.5px; color: var(--muted); margin-top: 1px; min-height: 15px; }
      .card-status.hungry { color: var(--warn); font-weight: 700; }
      .card-status.out { color: #8ecbff; }
      .hunger-track { height: 7px; background: rgba(255,255,255,0.12); border-radius: 4px; margin-top: 6px; overflow: hidden; }
      .hunger-fill { height: 100%; border-radius: 4px; background: var(--good); transition: width 0.3s linear; }
      .hunger-fill.mid { background: var(--warn); }
      .hunger-fill.low { background: var(--bad); }
      .card-bottom { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
      .card-kept { font-size: 11px; color: var(--muted); }
      .card-kept b { color: var(--text); }
      .feed-btn {
        margin-left: auto; flex: none;
        background: #2c5d34; border: 1px solid #4c9a5b; color: #dff5e2;
        font-weight: 700; font-size: 12px; border-radius: 8px; padding: 6px 10px;
      }
      .feed-btn:disabled { opacity: 0.4; }
      .feed-btn:active { transform: scale(0.95); }

      /* ---------- Floating money text ---------- */
      #float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 18; overflow: hidden; }
      .float-text {
        position: absolute; transform: translate(-50%, -50%);
        font-family: "Bebas Neue", sans-serif; color: var(--gold);
        text-shadow: 0 2px 8px rgba(0,0,0,0.8), 0 0 14px rgba(242,181,68,0.5);
        animation: floatUp 2s ease-out forwards; white-space: nowrap;
      }
      .float-text .kept { display: block; font-family: "Archivo", sans-serif; font-size: 12px; font-weight: 700; color: #ffd9a8; text-align: center; }
      @keyframes floatUp {
        0% { opacity: 0; margin-top: 8px; }
        12% { opacity: 1; }
        100% { opacity: 0; margin-top: -64px; }
      }

      /* ---------- Speech bubbles (multiple, one per conversation) ---------- */
      #bubble-layer { position: fixed; inset: 0; pointer-events: none; z-index: 19; overflow: hidden; }
      .bubble {
        position: absolute; transform: translate(-50%, -100%);
        max-width: 220px; background: #f7f4ec; color: #17171f;
        border-radius: 14px; padding: 7px 11px 8px;
        font-size: 13px; line-height: 1.35; font-weight: 600;
        box-shadow: 0 6px 18px rgba(0,0,0,0.45);
        animation: bubblePop 0.18s ease;
      }
      .bubble .bname {
        display: block; font-size: 9.5px; letter-spacing: 0.14em;
        font-weight: 800; color: #a5760a; margin-bottom: 2px;
      }
      .bubble.driver { background: #22222e; color: #f4f1ea; }
      .bubble.driver .bname { color: var(--gold); }
      .bubble.angry { background: #ffe3e3; }
      .bubble.angry .bname { color: #b02a2a; }
      .bubble.warm { background: #e4f6e4; }
      @keyframes bubblePop { from { opacity: 0; margin-top: 6px; } }

      /* ---------- Toast ---------- */
      #toast {
        position: fixed; top: 22%; left: 50%; transform: translateX(-50%);
        background: rgba(10, 11, 18, 0.92); border: 1px solid var(--gold-dim);
        color: var(--text); border-radius: 10px; padding: 10px 16px;
        font-size: 14px; font-weight: 600; z-index: 40; text-align: center;
        max-width: 86vw; opacity: 0; pointer-events: none; transition: opacity 0.2s;
      }
      #toast.show { opacity: 1; }

      /* ---------- Raid fade + level intro ---------- */
      #fade-black {
        position: fixed; inset: 0; background: #000; z-index: 44;
        opacity: 0; pointer-events: none; transition: opacity 2s ease;
      }
      #level-intro {
        position: fixed; top: 16%; left: 50%; transform: translateX(-50%);
        z-index: 36; text-align: center; pointer-events: none;
        opacity: 0; transition: opacity 0.6s ease; width: 92%;
      }
      #level-intro.show { opacity: 1; }
      #level-intro .li-kicker { font-size: 12px; letter-spacing: 0.3em; color: var(--pink); font-weight: 800; }
      #level-intro .li-name {
        font-family: "Bebas Neue", sans-serif; font-size: clamp(40px, 9vw, 72px);
        color: var(--gold); line-height: 1; letter-spacing: 0.05em;
        text-shadow: 0 3px 0 #7a4d00, 0 8px 30px rgba(0,0,0,0.9);
      }
      #level-intro .li-sub { color: #ffd9ec; font-size: 14px; font-weight: 600; margin-top: 4px; text-shadow: 0 2px 8px rgba(0,0,0,0.9); }

      /* ---------- Overlays ---------- */
      .overlay {
        position: fixed; inset: 0; z-index: 50;
        display: flex; align-items: center; justify-content: center;
        background: radial-gradient(ellipse at 50% 32%, rgba(38, 24, 54, 0.88) 0%, rgba(5, 5, 10, 0.96) 72%);
        padding: 18px;
      }
      .overlay.hidden { display: none; }
      #summary-screen { background: rgba(0,0,0,0.55); }
      #title-screen { overflow-y: auto; -webkit-overflow-scrolling: touch; }
      .title-card { text-align: center; max-width: 520px; width: 100%; margin: auto; padding: 10px 0 16px; }
      .game-title {
        font-family: "Bebas Neue", sans-serif;
        font-size: clamp(64px, 17vw, 118px);
        line-height: 0.9; margin: 0; color: var(--gold);
        letter-spacing: 0.04em;
        text-shadow: 0 0 22px rgba(255, 77, 141, 0.55), 0 4px 0 #7a4d00, 0 8px 26px rgba(0,0,0,0.9);
      }
      .game-sub { color: #ffd9ec; font-size: clamp(14px, 4vw, 18px); margin: 10px 0 4px; font-weight: 600; }
      .how-to {
        color: var(--muted); font-size: 13.5px; line-height: 1.55;
        margin: 14px auto 22px; max-width: 430px; text-align: left;
        background: rgba(255,255,255,0.04); border: 1px solid var(--line);
        border-radius: 12px; padding: 12px 16px;
      }
      .how-to b { color: var(--text); }
      .big-btn {
        background: linear-gradient(180deg, var(--gold), var(--gold-dim));
        border: none; color: #221600; font-family: "Bebas Neue", sans-serif;
        font-size: 30px; letter-spacing: 0.08em; border-radius: 12px;
        padding: 12px 44px 8px; box-shadow: 0 4px 22px rgba(242, 181, 68, 0.4);
      }
      .big-btn:active { transform: scale(0.97); }
      .small-link {
        display: inline-block; margin-top: 18px; background: none; border: none;
        color: var(--muted); font-size: 12.5px; text-decoration: underline;
      }
      .summary-card {
        background: var(--panel-solid); border: 1px solid var(--line);
        border-radius: 16px; padding: 24px 26px; max-width: 400px; width: 100%;
        text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,0.6);
      }
      .summary-card h2 {
        font-family: "Bebas Neue", sans-serif; font-size: 40px; margin: 0 0 4px;
        color: var(--gold); letter-spacing: 0.05em; font-weight: 400;
      }
      .summary-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
      .sum-row { display: flex; justify-content: space-between; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
      .sum-row span:first-child { color: var(--muted); }
      .sum-row.total { border-bottom: none; font-weight: 800; font-size: 17px; }
      .sum-row.total span:first-child { color: var(--text); }
      .sum-row .pos { color: var(--good); }
      .sum-row .neg { color: var(--bad); }
      .summary-card .big-btn { margin-top: 18px; font-size: 25px; padding: 10px 30px 6px; width: 100%; }
      #pause-card h2 { color: var(--text); }
      .menu-btn {
        display: block; width: 100%; margin-top: 10px; padding: 11px;
        background: rgba(255,255,255,0.06); border: 1px solid var(--line);
        color: var(--text); border-radius: 10px; font-size: 15px; font-weight: 700;
      }
      .menu-btn.danger { color: var(--bad); border-color: rgba(255,93,93,0.4); }
      #load-error {
        display: none; color: var(--warn); font-size: 13px; margin-top: 14px; line-height: 1.5;
      }
      .crown { font-size: 54px; line-height: 1; }
      #ceremony-screen .summary-card { border-color: var(--gold-dim); box-shadow: 0 0 44px rgba(242,181,68,0.35), 0 18px 50px rgba(0,0,0,0.6); }
      #ceremony-screen h2 { font-size: 44px; }
      #tilt-hint {
        display: none;
        margin: 0 auto 16px; width: fit-content; max-width: 92%;
        background: rgba(10, 11, 18, 0.88); border: 1px solid var(--gold-dim);
        color: var(--text); border-radius: 999px; padding: 8px 16px;
        font-size: 13px; font-weight: 600; white-space: nowrap;
        overflow: hidden; text-overflow: ellipsis;
      }
      body.rotated #tilt-hint { display: block; }
      @media (max-width: 560px) {
        #cash { font-size: 28px; }
        #clock { font-size: 21px; }
        #boss-level { font-size: 16px; }
        #stats-box { display: none; }
        #ticker { bottom: 196px; }
      }
      @media (orientation: landscape) and (max-height: 520px) {
        #hud { padding-top: calc(5px + env(safe-area-inset-top)); }
        #cash { font-size: 25px; }
        #clock { font-size: 19px; }
        #boss-level { font-size: 15px; }
        #stats-box { display: block; }
        .icon-btn { width: 34px; height: 34px; font-size: 15px; }
        #crew-panel { max-height: 24vh; }
        #ticker { bottom: auto; top: 86px; max-width: 40vw; }
        .overlay { overflow-y: auto; }
        .game-title { font-size: clamp(44px, 11vh, 76px); }
        .game-sub { margin: 6px 0 2px; }
        .how-to { margin: 8px auto 12px; padding: 9px 14px; font-size: 12.5px; line-height: 1.45; }
        .big-btn { font-size: 24px; padding: 8px 34px 5px; }
        .small-link { margin-top: 10px; }
        .summary-card { padding: 14px 20px; }
        .summary-card h2 { font-size: 30px; }
        .sum-row { padding: 4px 2px; font-size: 13.5px; }
        .summary-card .big-btn { margin-top: 10px; }
        #level-intro { top: 10%; }
        #title-screen { align-items: flex-start; overflow-y: auto; }
        .title-card { margin: 0 auto; padding: 6px 0 12px; max-width: 600px; }
        .game-title { font-size: 38px; }
        .game-sub { font-size: 13px; margin: 4px 0 2px; }
        .how-to { font-size: 11.8px; line-height: 1.4; padding: 8px 12px; margin: 6px auto 8px; max-width: 560px; }
        #tilt-hint { margin-bottom: 8px; padding: 6px 12px; font-size: 12px; }
        .big-btn { font-size: 22px; padding: 7px 30px 4px; }
        .small-link { margin-top: 8px; font-size: 12px; }
        #load-error { font-size: 12px; margin-top: 8px; }
      }
      body.rotated #hud { padding-top: calc(5px + env(safe-area-inset-top)); }
      body.rotated #cash { font-size: 25px; }
      body.rotated #clock { font-size: 19px; }
      body.rotated #boss-level { font-size: 15px; }
      body.rotated #stats-box { display: block; }
      body.rotated .icon-btn { width: 34px; height: 34px; font-size: 15px; }
      body.rotated #crew-panel { max-height: 24vw; }
      body.rotated #ticker { bottom: auto; top: 86px; max-width: 40vh; }
      body.rotated .overlay { overflow-y: auto; }
      body.rotated .game-title { font-size: clamp(44px, 11vw, 76px); }
      body.rotated .game-sub { margin: 6px 0 2px; }
      body.rotated .how-to { margin: 8px auto 12px; padding: 9px 14px; font-size: 12.5px; line-height: 1.45; }
      body.rotated .big-btn { font-size: 24px; padding: 8px 34px 5px; }
      body.rotated .small-link { margin-top: 10px; }
      body.rotated .summary-card { padding: 14px 20px; }
      body.rotated .summary-card h2 { font-size: 30px; }
      body.rotated .sum-row { padding: 4px 2px; font-size: 13.5px; }
      body.rotated .summary-card .big-btn { margin-top: 10px; }
      body.rotated #level-intro { top: 10%; }
      body.rotated #title-screen { align-items: flex-start; overflow-y: auto; }
      body.rotated .title-card { margin: 0 auto; padding: 6px 0 12px; max-width: 600px; }
      body.rotated .game-title { font-size: 38px; }
      body.rotated .game-sub { font-size: 13px; margin: 4px 0 2px; }
      body.rotated .how-to { font-size: 11.8px; line-height: 1.4; padding: 8px 12px; margin: 6px auto 8px; max-width: 560px; }
      body.rotated #tilt-hint { margin-bottom: 8px; padding: 6px 12px; font-size: 12px; }
      body.rotated .big-btn { font-size: 22px; padding: 7px 30px 4px; }
      body.rotated .small-link { margin-top: 8px; font-size: 12px; }
      body.rotated #load-error { font-size: 12px; margin-top: 8px; }
      @media (prefers-reduced-motion: reduce) {
        .float-text, .tick, .bubble { animation: none; }
        #fade-black { transition: opacity 0.4s ease; }
      }
    