/* HOLD THE HOUSE: the phone layout (2026-11-28, agent PHONE_UI). Loaded after the page's own styles, so rules here win.
   Everything is behind html.tc (touch.js sets it on phones and tablets only): the PC layout does not change.
   The user (iPhone 15 Pro): "the UI on mobile has to be different because it's way too loaded, the screen needs to be clearer".
   The plan (touch.js sets the numbers as CSS variables on <html>, from the screen size and the safe areas):
     top left    : II pause | NIGHT 3 · infected 14 · $400   (one status line)
                   under it: HEALTH (+ BREATH while it is not full, + TRUCK when it matters) and HEAL when hurt
                   the round minimap under II; the house (a chip; it opens into the plan when a window is hit, or on a tap)
     top middle  : NOISE (night), the boss bar, then the captions / hints (one or two lines), all from x = --L
     top right   : LIGHT (night) + the weapon chip (tap = weapons and throwables, hold = last weapon)
     bottom right: the action buttons in the thumb's arc (touch.js slots); bottom left: nothing but the joystick
   Vars: --sl --sr --st --sb safe areas (px) · --k button scale · --mm minimap size · --hm house plan width · --bx x of the bars ·
         --L x of the middle column · --R right edge of the captions (px from the right edge of the screen) */

html.tc #hud { left: 0; right: 0; top: 0; bottom: 0; }
html.tc #hud::before { height: 120px; background: linear-gradient(rgba(0,0,0,.34), rgba(0,0,0,0)); }
html.tc #hud::after { display: none; }

/* ---- the status line: NIGHT 3 · [infected] 14 · $400 */
html.tc #h-tl { left: calc(var(--sl) + 54px); top: var(--st); height: 28px; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
html.tc #h-night { font-size: 20px; letter-spacing: 1px; line-height: 1; }
html.tc #h-left { margin: 0; gap: 4px; align-items: center; }
html.tc #h-left .lbl { display: none; }
html.tc #h-left[style*="hidden"] { display: none; }   /* the day: no infected count (hud.js hides it), so the cash moves up next to THE DAY */
html.tc #h-left .ph-zed { display: inline-flex; width: 18px; height: 18px; }
html.tc #h-left .ph-zed svg { width: 18px; height: 18px; }
html.tc #h-leftn { font-size: 16px; line-height: 1; }
html.tc #h-tl #h-cashbox { position: static; text-align: left; }
html.tc #h-cash { font-size: 20px; line-height: 1; }
html.tc #h-pops .pop { left: 0; right: auto; top: 20px; bottom: auto; font-size: 14px; }
html:not(.tc) .ph-zed { display: none; }

/* ---- HEALTH / BREATH / TRUCK: small bars under the status line (BREATH only while it is not full) */
html.tc #h-bl { left: var(--bx); top: calc(var(--st) + 30px); bottom: auto; width: 150px; }
html.tc #h-bl .bar { margin-top: 3px; gap: 6px; height: 10px; }
html.tc #h-bl .bar:first-child { margin-top: 0; }
html.tc #h-bl .bar span { width: 40px; flex: none; font-size: 9px; letter-spacing: 1px; line-height: 10px; }
html.tc #h-bl .bar > div { height: 7px; }
html.tc #h-bl .bar.full { display: none; }
html.tc #h-truck em { font-size: 10px; }
html.tc #h-items, html.tc #h-br2, html.tc #h-tr { display: none; }

/* ---- the round minimap under the pause button */
html.tc #h-map { left: var(--sl) !important; top: calc(var(--st) + 52px) !important; bottom: auto !important; width: var(--mm) !important; height: var(--mm) !important; box-shadow: 0 0 0 2px rgba(13,16,21,.85), 0 4px 12px rgba(0,0,0,.4) !important; }

/* ---- NOISE (night): a short bar at the top of the middle column; its warning replaces the word NOISE */
html.tc #h-tc { left: var(--L); top: calc(var(--st) + 5px); transform: none; width: var(--nw, 150px); text-align: left; display: flex; flex-direction: column; }
html.tc #h-noise-l { font-size: 9px; letter-spacing: 2px; line-height: 10px; order: 1; }
html.tc #h-noise-w { font-size: 11px; line-height: 10px; min-height: 0; margin: 0; order: 1; letter-spacing: 1px; white-space: nowrap; }
html.tc #h-noise-w:empty { display: none; }
html.tc #h-tc:has(#h-noise-w:not(:empty)) #h-noise-l { display: none; }
html.tc #h-noise { order: 2; height: 6px; margin-top: 3px; }
html.tc #h-noise i { top: -2px; bottom: -2px; }

/* ---- the boss bar: name and bar on one line, under NOISE */
html.tc body #boss-bar { left: var(--L); top: calc(var(--st) + 30px); bottom: auto; transform: none; width: var(--bw, 240px); display: flex; flex-wrap: wrap; align-items: center; text-align: left; }
html.tc body #boss-name { font-size: 13px; letter-spacing: 1.5px; margin-right: 8px; max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.tc body #boss-row { flex: 1; margin-top: 0; gap: 6px; min-width: 60px; }
html.tc body #boss-hp { height: 8px; }
html.tc body #boss-num { font-size: 10px; min-width: 28px; }
html.tc body #boss-segs { flex-basis: 100%; margin-top: 2px; }
html.tc body #boss-card { top: 34%; }

/* ---- captions and hints: under the status line, in the middle column (one or two lines), never over a button or a panel */
html.tc body #h-caption { left: var(--L); right: var(--R); top: calc(var(--st) + 50px); bottom: auto; transform: none; width: fit-content; max-width: none; margin: 0 auto;
  font-size: 13px; line-height: 17px; padding: 3px 10px; background: rgba(0,0,0,.5); }
html.tc.boss-on body #h-caption { top: calc(var(--st) + 60px); }
@media (max-height: 320px) { html.tc body #h-caption { font-size: 12px; line-height: 15px; } }
/* the E prompt: the buttons carry it on phones (TALK HANK, BRACE, HAMMER, DRIVE); only a warning stays ("Clear the hall window first!") */
html.tc #h-prompt { display: none; }
html.tc #h-prompt.tc-keep { display: block; left: var(--L); right: var(--R); top: calc(var(--st) + 50px); bottom: auto; transform: none; width: fit-content; margin: 0 auto; font-size: 13px; padding: 3px 10px; color: #ffb3a8; }
html.tc #h-prompt.tc-keep.on ~ #h-caption.on { top: calc(var(--st) + 78px); }

/* ---- short messages in the middle stay small and high */
html.tc #h-warn { top: 30%; font-size: 22px; }
html.tc #toast { top: 24%; } html.tc #toast-t { font-size: 40px; } html.tc #toast-s { font-size: 15px; }
html.tc #h-grab { top: 30%; font-size: 26px; }

/* ---- the day: START NIGHT is the big button under the right thumb (no weapons in the day); SAVE CODE sits top right (where the weapon chip is at night) */
html.tc #h-day { left: auto; right: calc(var(--sr) + 12px * var(--k)); bottom: calc(var(--sb) + 10px * var(--k)); transform: none; top: auto; }
html.tc #h-day:not(.hidden) { animation-name: phRise; }
html.tc #h-code { position: absolute; top: var(--st); right: var(--sr); min-height: 44px; font-size: 14px; padding: 0 14px; background: rgba(13,16,21,.55); pointer-events: auto; }
html.tc #h-day .btn.big#h-start { display: inline-grid; grid-template-columns: 24px auto; grid-template-rows: auto auto; column-gap: 9px; row-gap: 1px; align-content: center; justify-content: start;
  font-size: 17px; letter-spacing: 1.2px; padding: 0 16px 0 14px; height: calc(58px * var(--k)); min-width: calc(150px * var(--k)); text-align: left; }
html.tc #h-start .hs-ring { width: 24px; height: 24px; grid-row: 1 / span 2; align-self: center; }
html.tc #h-start #h-startt { grid-column: 2; line-height: 1; }
html.tc #h-start small { grid-column: 2; font-size: 10px; letter-spacing: 1.5px; line-height: 1; }

/* ---- the truck: the speed sits where the weapon chip is (no weapons in the cab) */
html.tc body #dr-hud { top: var(--st); right: calc(var(--sr) + 4px); bottom: auto; width: auto; }
html.tc body #dr-speed { font-size: 26px; }
html.tc body #dr-dead { font-size: 13px; }
/* the truck in the DAY (2026-11-28, found by the website's phone check): HORN takes START NIGHT's big slot and the speed takes SAVE CODE's
   corner, so the two pairs sat on top of each other. While he drives, START NIGHT moves to the bottom middle (free there: the joystick
   is on the left, HORN and GET OUT on the right; hsRise is the rise that keeps the -50% shift) and SAVE CODE waits until he gets out. */
html.tc #hud.drv #h-day { right: auto; left: 50%; transform: translateX(-50%); }
html.tc #hud.drv #h-day:not(.hidden) { animation-name: hsRise; }
html.tc #hud.drv #h-code { display: none; }

/* ---- windows (menus, shops, dawn, game over) stay inside the safe area (the Dynamic Island side, the home indicator) */
html.tc #modal { padding: var(--st) var(--sr) var(--sb) var(--sl); box-sizing: border-box; }
html.tc #modal.m-title { padding-left: calc(var(--sl) + 3vw); }
html.tc #modal .panel { max-width: 100%; }
/* game over / dawn on a short screen: everything, buttons included, without scrolling */
html.tc #modal.m-over .res { grid-template-columns: repeat(3, auto); gap: 4px 22px; }
@media (max-height: 440px) {
  html.tc #modal.m-over .panel, html.tc #modal.m-dawn .panel { padding-top: 10px; padding-bottom: 10px; }
  html.tc #modal.m-over .h1, html.tc #modal.m-dawn .h1 { font-size: 30px; line-height: 1.05; }
  html.tc #modal.m-over .t-sub, html.tc #modal.m-dawn .t-sub { font-size: 13px; margin: 3px 0 6px; }
  html.tc #modal.m-over .res, html.tc #modal.m-dawn .res { margin: 4px 0; font-size: 13px; } html.tc #modal .res div { padding: 2px 0; } html.tc #modal .res .tot { font-size: 15px; }
  html.tc #modal.m-over .tip, html.tc #modal.m-dawn .tip { font-size: 12px; line-height: 1.35; margin: 5px 0 8px; padding: 5px 10px; } html.tc #modal .tip-src { font-size: 11px; margin-top: 2px; }
  html.tc #modal.m-dawn .rule { margin: 4px 0 8px; padding: 6px 12px; } html.tc #modal.m-dawn .rule-t { font-size: 18px; } html.tc #modal.m-dawn .rule-fx { font-size: 13px; margin-top: 3px; }
  html.tc #modal.m-over .btn.big { font-size: 18px; padding: 8px 16px; }
}

/* ---- windows: the pause menu in two columns so it fits a short screen */
html.tc .panel.pause { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: min(460px, 86vw); }
html.tc .panel.pause .h2 { grid-column: 1 / -1; margin-bottom: 2px; }
html.tc .panel.pause .btn.big { grid-column: 1 / -1; }
html.tc .panel.pause .btn { min-height: 44px; }
html.tc .panel.pause .btn.ph-fs { border-color: var(--amber); color: var(--amber); }

/* PHONE_QA 2026-11-28: no keyboard key caps in the shops on phones (1-4, U, "Esc or E to close"); the buttons are tapped */
html.tc #shop-panel .shop-key, html.tc #shop-panel .shop-hint { display: none; }
/* settings on a short screen: the sticky BACK spans the panel, so the options scrolling under it don't peek out beside it */
html.tc .panel.settings > .btn.big:last-child { width: 100%; }
