/* HerpDerp skin as in the other Puddlehold games: Jersey 10 at its design size (56/3 px) or
   twice that, wooden panels from panel.png, ink outline on light text. */
@font-face {
  font-family: 'Jersey 10';
  src: url(/assets/Jersey10.woff2) format('woff2'), url(../assets/ui/Jersey10.ttf) format('truetype');
  font-display: swap;
}
:root {
  --wood: #6e3f1c;
  --wood-dark: #3a2210;
  --wood-light: #8f5a2c;
  --gold: #ffd43a;
  --ink: #2b1a0e;
  --text: #fff6dc;
  --muted: #eed9a8;
  /* Readable text (15.11.2026): sans face for all text at --px, big numbers at --nx2;
     Jersey 10 (--title) only for gold titles, at --tpx or --px2. */
  --px: 16px;
  --tpx: 18.667px;
  --px2: 37.333px;
  --nx2: 28px;
  --hud: 1;
  --hud-s: calc(var(--hud) * .8); /* bottom bar and minimap a size smaller than the top bar */
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --title: 'Jersey 10', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --ink-outline: 1px 0 0 #2b1a0e, -1px 0 0 #2b1a0e, 0 1px 0 #2b1a0e, 0 -1px 0 #2b1a0e, 1px 1px 0 #2b1a0e, -1px 1px 0 #2b1a0e, 1px -1px 0 #2b1a0e, -1px -1px 0 #2b1a0e;
}
@media (max-height: 500px) { :root { --hud: .75; } }
@media (min-width: 1600px) and (min-height: 860px) { :root { --hud: 1.25; } }
@media (min-width: 2400px) and (min-height: 1300px) { :root { --hud: 1.5; } }
* { box-sizing: border-box; font-size: var(--px); font-weight: 600; letter-spacing: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: var(--font); font-synthesis: none; -webkit-font-smoothing: antialiased; }
/* gold titles keep the pixel face */
h1, h2, .hero-name, #stud .tabs b, #lands .tabs b { font-family: var(--title); font-weight: 400; -webkit-font-smoothing: none; }
.hero-name, h2 { font-size: var(--tpx); }
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; image-rendering: pixelated; }
/* HerpDerp v6: light haze at the top, soft dark edge and a warm wash over the world. */
#atmosphere {
  position: fixed; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(206,214,222,.14) 0%, rgba(206,214,222,.05) 18%, rgba(206,214,222,0) 36%),
    radial-gradient(ellipse 78% 72% at 50% 55%, rgba(20,12,4,0) 60%, rgba(20,12,4,.26) 100%),
    linear-gradient(rgba(255,186,96,.06), rgba(255,186,96,.06));
}
#hurt-edge { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; background: radial-gradient(ellipse at center, rgba(200,20,10,0) 40%, rgba(200,20,10,.7) 78%, rgba(120,0,0,.95) 100%); }
.hidden { display: none !important; }
.out { text-shadow: var(--ink-outline); }

/* Big panels: the shared 9-slice board (96 px, 36 px corners, as in menu.css and Siege). */
.wood { border: 12px solid transparent; border-image-source: url(../assets/ui/panel.png); border-image-slice: 36 fill; border-image-width: 36px; border-image-repeat: round; image-rendering: pixelated; }
/* Small HUD panels: flat wood slab with ink outline and flat drop shadow (Lords .hpanel, Survivor .banner). */
.slab { background: var(--wood); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.3), inset 0 2px 0 var(--wood-light); }
#hud { position: fixed; inset: 0; pointer-events: none; }
/* Top bar as in Lords and Siege: floating strip with rounded ends and gold studs. */
#topbar {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%) scale(calc(var(--hud) * .85)); transform-origin: top center;
  display: flex; align-items: center; gap: 20px; padding: 6px 30px 7px; white-space: nowrap;
  background: var(--wood); border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 26px 26px;
  box-shadow: 0 6px 0 rgba(0,0,0,.28), inset 0 2px 0 var(--wood-light), inset 0 -3px 0 var(--wood-dark);
}
/* Frankfurt time and weather under the top bar */
#clock { position: absolute; left: 50%; top: 60px; transform: translateX(-50%); font-size: var(--px); color: var(--text); text-shadow: var(--ink-outline); white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
#topbar::before, #topbar::after { content: ''; position: absolute; bottom: 8px; width: 9px; height: 9px; background: var(--gold); border: 2px solid var(--ink); transform: rotate(45deg); }
#topbar::before { left: 9px; }
#topbar::after { right: 9px; }
.tb-item { display: flex; align-items: center; gap: 6px; }
.tb-item img { width: 28px; height: 28px; display: block; image-rendering: pixelated; }
.tb-item b { font-size: var(--nx2); line-height: 1; color: var(--gold); text-shadow: var(--ink-outline); font-variant-numeric: tabular-nums; min-width: 2ch; }
#forks { gap: 4px; }
.tb-item .of { color: var(--muted); text-shadow: var(--ink-outline); margin-left: -4px; }
/* Bottom bar as in Siege (style.css #bottom + herpderp.css skin): portrait, name and bars,
   weapon slots with ammo, purse; the minimap sits in its own corner frame on the right. */
#bottom {
  /* frameless at the lower left edge (13.11.): the pieces carry their own ink outlines */
  position: absolute; bottom: 10px; left: 12px; transform: scale(var(--hud-s)); transform-origin: bottom left;
  display: flex; gap: 10px; align-items: center; pointer-events: auto;
}
.portrait-box { width: 72px; height: 72px; flex: none; border: 3px solid var(--ink); border-radius: 10px; background: #2a1a10; box-shadow: 0 4px 0 rgba(0,0,0,.3); overflow: hidden; }
.portrait-box canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.vitals { width: 230px; }
.hero-name { color: var(--gold); text-shadow: var(--ink-outline); line-height: 1; margin-bottom: 2px; }
.bar { position: relative; height: 22px; background: #2a1708; border: 3px solid var(--ink); border-radius: 11px; margin: 3px 0; overflow: hidden; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.bar.thin { height: 10px; border-width: 2px; border-radius: 5px; }
.bar .fill { height: 100%; width: 0; border-radius: 8px; box-shadow: inset 0 2px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.25); transition: width .15s; }
.bar .fill.hp { background: linear-gradient(#ff7a60, #d42a1c); }
.bar .fill.vest { background: linear-gradient(#c89a62, #8a5a2a); }
.bar .fill.st { background: linear-gradient(#ffe06a, #d9a01a); }
.bar .fill.st.low { background: linear-gradient(#ff9a60, #c8401c); }
.bar span { position: absolute; inset: 0; text-align: center; line-height: 16px; color: var(--text); text-shadow: var(--ink-outline); white-space: nowrap; }
#stam.off .fill { width: 0 !important; }
#stam.off span { color: var(--muted); }
.abilities { display: flex; gap: 6px; padding: 6px; border-radius: 8px; background: rgba(0,0,0,.25); }
.slot { position: relative; width: 52px; height: 52px; display: grid; place-items: center; cursor: pointer; border: 3px solid var(--ink); border-radius: 12px; background: #5a3a1c; box-shadow: 0 3px 0 rgba(0,0,0,.3); border-image-source: url(../assets/ui/slot.png); border-image-slice: 8 fill; border-image-width: 8px; }
.slot img { width: 28px; height: 28px; image-rendering: pixelated; }
.slot .charges { position: absolute; right: 3px; bottom: 0; color: var(--text); text-shadow: var(--ink-outline); line-height: 1; }
.slot .hk { position: absolute; left: -4px; top: -6px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 3px; background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; line-height: 1; }
.slot.armed { border-color: #fff; box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(0,0,0,.3); }
.slot.empty img { filter: grayscale(.8) brightness(.6); }
.slot.empty .charges { color: #ff8a6a; }
.side { display: flex; flex-direction: column; gap: 6px; min-width: 96px; }
.gold { display: flex; align-items: center; gap: 6px; }
.gold img { width: 28px; height: 28px; image-rendering: pixelated; }
.gold b { font-size: var(--nx2); line-height: 1; color: var(--gold); text-shadow: var(--ink-outline); font-variant-numeric: tabular-nums; }
#mini-corner { position: absolute; right: 12px; bottom: 10px; pointer-events: auto; transform: scale(var(--hud-s)); transform-origin: bottom right; }
#minimap { display: block; width: 228px; height: 190px; border: 3px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 rgba(0,0,0,.3); cursor: pointer; background: #1d2a12; }
@media (max-width: 1100px) { #mini-corner { display: none; } }
/* Hint: on its own wood card at the large design size, so it reads on busy ground. */
#hint {
  /* left/right 0 + fit-content: a left: 50% box would shrink to half the screen and wrap */
  position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(92px * var(--hud-s) + 14px); transform: scale(var(--hud)); transform-origin: bottom center;
  max-width: min(900px, 80vw); padding: 2px 14px 4px; text-align: center; font-size: var(--px); line-height: 1.1;
  color: var(--text); text-shadow: var(--ink-outline);
}
/* town crier and ballad singer: who speaks in gold, the line below */
#news { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: min(620px, 86vw); top: 96px; padding: 2px 12px 4px; text-align: center; font-size: 15px; line-height: 1.1; color: var(--text); text-shadow: var(--ink-outline); pointer-events: none; opacity: 0; transition: opacity .4s; }
#news b { display: block; color: var(--gold); font-weight: normal; }
#banner { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; top: 22%; transform: scale(var(--hud)); max-width: 92vw; padding: 3px 16px 5px; text-align: center; font-size: var(--px2); line-height: 1.05; text-shadow: var(--ink-outline); color: var(--gold); transition: opacity .3s; opacity: 0; }
/* current job: top right under the system buttons */
#mission { position: absolute; right: 12px; top: 64px; transform: scale(var(--hud)); transform-origin: top right; display: flex; align-items: center; gap: 8px; padding: 4px 12px 6px; max-width: min(520px, 60vw); }
#mission img { width: 28px; height: 28px; image-rendering: pixelated; }
#mission span { text-shadow: var(--ink-outline); }
#mission b { font-size: var(--nx2); line-height: 1; color: var(--gold); text-shadow: var(--ink-outline); font-variant-numeric: tabular-nums; min-width: 2ch; }
#mission.late b { color: #ff8a6a; }
/* map button top left; the map itself on the shared wood board */
#tMap { position: fixed; left: 12px; top: 8px; display: flex; align-items: center; gap: 6px; padding: 4px 12px 6px; font-family: var(--font); color: var(--text); text-shadow: var(--ink-outline); cursor: pointer; pointer-events: auto; transform: scale(var(--hud)); transform-origin: top left; }
#tMap img { width: 28px; height: 28px; image-rendering: pixelated; }
#map { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,12,4,.55); z-index: 30; }
#map .box { padding: 8px; text-align: center; max-height: 100vh; max-height: 100dvh; overflow-y: auto; box-sizing: border-box; }
#mapCv { display: block; width: min(calc((100vh - 170px) * 16 / 9), 88vw); height: auto; aspect-ratio: 16 / 9; border: 3px solid var(--ink); border-radius: 6px; }
#map p { margin: 4px 0 0; text-shadow: var(--ink-outline); color: var(--muted); }
/* standing with the three gangs under the map */
#gangs { display: flex; gap: 14px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
#gangs .gang { display: flex; align-items: center; gap: 6px; text-align: left; min-width: 180px; }
#gangs canvas { width: 40px; height: 40px; image-rendering: pixelated; }
#gangs .gang > div { flex: 1; }
#gangs b { display: block; text-shadow: var(--ink-outline); font-weight: normal; }
#gangs span { display: block; font-size: .85em; color: var(--muted); text-shadow: var(--ink-outline); }
#gangs .bar.rep { margin: 2px 0 0; }
#gangs .fill.st0 { background: linear-gradient(#ff7a60, #b3201a); }
#gangs .fill.st1 { background: linear-gradient(#ffb067, #c8641c); }
#gangs .fill.st2 { background: linear-gradient(#d8cdb5, #8f846c); }
#gangs .fill.st3 { background: linear-gradient(#a6e07a, #4f9a2c); }
#gangs .fill.st4 { background: linear-gradient(#ffe48a, #d39b1c); }
@media (max-height: 520px) {
  #mapCv { width: min(calc((100vh - 120px) * 16 / 9), 88vw); }
  #gangs { gap: 8px; margin-top: 3px; font-size: .8em; }
  #gangs .gang { min-width: 130px; gap: 4px; }
  #gangs canvas { width: 28px; height: 28px; }
  #map p { font-size: .75em; }
}
/* stud farm and Moritaten on the wood board, like the map */
#map .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#map .row button { margin-top: 6px; padding: 0 14px; font-family: var(--font); color: var(--text); text-shadow: var(--ink-outline); background: none; cursor: pointer; }
#mapMinus, #mapPlus { min-width: 2.4em; }
#mapCv { touch-action: none; cursor: grab; }
#stud .box { width: min(760px, 94vw); max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; padding: 8px 12px; }
#stud .tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
#stud .tabs b { font-size: var(--px2); line-height: 1; color: var(--gold); text-shadow: var(--ink-outline); margin-right: auto; }
#stud button { font-family: var(--font); color: var(--text); text-shadow: var(--ink-outline); background: none; cursor: pointer; padding: 0 10px; }
#stud .tabs [data-tab] { border: 0; border-bottom: 3px solid transparent; color: var(--muted); }
#stud .tabs [data-tab].on { color: var(--gold); border-bottom-color: var(--gold); }
#stud button:disabled { opacity: .45; cursor: default; }
#stud, #lands { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,12,4,.55); z-index: 60; }
#lands .box { width: min(620px, 94vw); max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; padding: 8px 12px; }
#lands .tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
#lands .tabs b { font-size: var(--px2); line-height: 1; color: var(--gold); text-shadow: var(--ink-outline); margin-right: auto; }
#lands button { font-family: var(--font); color: var(--text); text-shadow: var(--ink-outline); background: none; cursor: pointer; padding: 0 10px; }
#lands button:disabled { opacity: .45; cursor: default; }
#landsBody { overflow-y: auto; text-shadow: var(--ink-outline); }
#landsBody p { margin: 4px 0; }
#landsBody .land { display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin: 6px 0; border: 3px solid rgba(43,26,14,.6); border-radius: 6px; background: rgba(43,26,14,.25); }
#landsBody .land.on { border-color: var(--gold); background: rgba(255,212,58,.15); }
#landsBody .land.shut { opacity: .6; }
#landsBody .land > div { flex: 1; min-width: 0; }
#landsBody .land b, #landsBody .land span { display: block; line-height: 1.05; }
#landsBody .land b { color: var(--gold); }
#landsBody .msg { color: var(--gold); }
#landsBody .away { color: var(--muted); font-size: .85em; }
#landsBody .land span { font-size: .9em; }
#landsBody .picks { display: flex; flex-direction: column; gap: 4px; flex: none; }
#landsBody .land.end, #landsBody .land.grade { border-color: var(--gold); }
#landsBody .row { display: flex; gap: 10px; flex-wrap: wrap; }
#landsBody .row b { color: var(--gold); }
#studBody { overflow-y: auto; text-shadow: var(--ink-outline); }
#studBody p { margin: 4px 0; }
#studBody .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#studBody .msg { color: var(--gold); }
#studBody .away { color: var(--muted); font-size: .85em; }
#studBody .horses { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 6px; }
#studBody .horse { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 3px solid rgba(43,26,14,.6); border-radius: 6px; background: rgba(43,26,14,.25); cursor: pointer; }
#studBody .horse.on { border-color: var(--gold); background: rgba(255,212,58,.15); }
#studBody .horse.foal { cursor: default; opacity: .8; }
#studBody .horse > div { flex: 1; min-width: 0; }
#studBody .horse b, #studBody .horse span { display: block; line-height: 1.05; }
#studBody .horse b { color: var(--gold); }
#studBody .horse span { font-size: .85em; color: var(--muted); }
#studBody .horse .trait { color: #a6e07a; }
#studBody canvas { flex: none; }
#studBody .book { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
#studBody .cell { display: flex; flex-direction: column; align-items: center; padding: 4px; border: 3px solid rgba(43,26,14,.6); border-radius: 6px; background: rgba(43,26,14,.25); text-align: center; }
#studBody .cell span { font-size: .8em; line-height: 1.05; }
#studBody .cell.missing canvas { filter: brightness(0) opacity(.35); }
#studBody .cell.missing span { color: var(--muted); }
#studBody .legend > div { margin: 6px 0; }
#studBody .legend b { display: block; color: var(--gold); }
#studBody .legend span { display: block; font-style: italic; }
/* legend rank and craft (fame.js), own band (band.js) */
#studBody .fame { margin: 2px 0 6px; }
#studBody .fame .fill { background: linear-gradient(#ffe06a, #d9a01a); }
#studBody .craft { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 6px; }
#studBody .branch { display: flex; flex-direction: column; gap: 3px; padding: 4px 6px; border: 3px solid rgba(43,26,14,.6); border-radius: 6px; background: rgba(43,26,14,.25); }
#studBody .branch b { color: var(--gold); }
#studBody .branch span { font-size: .8em; line-height: 1.05; color: var(--muted); }
#studBody .branch span.have { color: #a6e07a; }
#studBody .branch button { align-self: flex-start; margin-top: 2px; border: 2px solid var(--gold); border-radius: 4px; }
@media (max-height: 520px) {
  #stud .box { padding: 4px 8px; }
  #stud .tabs b { font-size: var(--tpx); }
  #studBody .horse { padding: 2px 4px; }
  #studBody canvas { width: 54px; height: 39px; }
  #map .row button { margin-top: 3px; font-size: .8em; }
}
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: #1d2a12; z-index: 50; }

/* touch: left half steers (thumb stick without a drawn stick), buttons right */
/* thumb arc at the lower right: the context button biggest in the corner, shoot left of it,
   jump or gallop above; slot-style tiles as in the bottom bar */
#touch { position: fixed; right: calc(12px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); width: 196px; height: 196px; display: none; pointer-events: auto; transform: scale(var(--hud)); transform-origin: bottom right; }
.tbtn { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; cursor: pointer;
  background: var(--wood); border: 3px solid var(--ink); border-radius: 50%; box-shadow: 0 4px 0 rgba(0,0,0,.3), inset 0 2px 0 var(--wood-light); color: var(--text); font-family: var(--font); font-size: 13px; line-height: 1; text-shadow: var(--ink-outline); }
.tbtn img { width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; }
.tbtn span { pointer-events: none; white-space: nowrap; }
/* clear gaps between the buttons, so a thumb never hits two (13.11.) */
#tAct { right: 0; bottom: 0; width: 96px; height: 96px; font-size: 14px; }
#tAct img { width: 44px; height: 44px; }
#tFire { right: 114px; bottom: 2px; width: 70px; height: 70px; }
#tRun { right: 14px; bottom: 114px; width: 70px; height: 70px; }
.tbtn span { max-width: 92%; overflow: hidden; text-overflow: clip; }
.tbtn.idle { opacity: .72; }
.tbtn.idle img { filter: grayscale(.7); }
.tbtn:active { filter: brightness(1.3); }
.tbtn.on { filter: brightness(1.2); box-shadow: 0 0 0 4px var(--gold), 0 4px 0 rgba(0,0,0,.3); }
/* floating thumb stick where the left thumb lands (as in Survivor) */
#stick { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 3px solid rgba(43, 26, 14, .7); background: rgba(255, 241, 194, .15); pointer-events: none; z-index: 5; }
#stick .knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255, 212, 58, .7); border: 3px solid #2b1a0e; }
#stick.gallop .knob { background: rgba(255, 140, 40, .85); }
/* phones: compact bottom bar at the left, buttons right, hint above the bar */
@media (pointer: coarse) {
  #touch { display: block; }
  #mini-corner { display: none; }
  #bottom { left: calc(8px + env(safe-area-inset-left)); bottom: calc(6px + env(safe-area-inset-bottom)); transform: scale(var(--hud)); gap: 6px; }
  .portrait-box { width: 44px; height: 44px; border-radius: 8px; }
  .vitals { width: 140px; }
  .hero-name { display: none; }
  .bar { height: 18px; margin: 2px 0; } .bar span { line-height: 12px; }
  .abilities { padding: 3px; gap: 4px; } .slot { width: 40px; height: 40px; } .slot .hk { display: none; } .slot img { width: 24px; height: 24px; }
  .side { min-width: 0; } .gold b { font-size: var(--px); }
  #hint { bottom: calc(62px * var(--hud)); left: 8px; right: auto; margin: 0; max-width: calc(100vw - 240px); transform: none; font-size: 15px; padding: 2px 10px 3px; }
  #tMap { left: calc(12px + env(safe-area-inset-left)); }
}
/* upright phone: the buttons sit above the bottom bar instead of on it */
@media (pointer: coarse) and (orientation: portrait) {
  #touch { bottom: calc(64px * var(--hud) + 14px + env(safe-area-inset-bottom)); }
  #hint { max-width: calc(100vw - 30px); bottom: calc(64px * var(--hud) + 210px); }
}
@media (max-width: 640px) { #mission { top: auto; right: auto; left: 12px; bottom: 112px; transform-origin: bottom left; max-width: calc(100vw - 140px); } #tMap span { display: none; } #topbar { flex-wrap: wrap; justify-content: center; white-space: normal; max-width: calc(100vw - 64px); gap: 4px 12px; } .abilities .slot:not(.armed) { display: none; } }
/* upright phones: the job panel stays left of the shoot button; lying phones: the news between the panels */
@media (pointer: coarse) and (orientation: portrait) and (max-width: 640px) { #mission { max-width: calc(100vw - 220px); } }
@media (max-height: 520px) { #news { max-width: calc(100vw - 480px); min-width: 300px; font-size: 13px; } }
@media (max-width: 760px), (max-height: 500px) {
  #banner { font-size: var(--px); padding: 2px 10px 4px; }
  #topbar { gap: 12px; padding: 4px 24px 5px; }
}

#title { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,12,4,.55); z-index: 40; }
#title .box { max-width: min(560px, 94vw); padding: 10px 18px; text-align: center; max-height: 94vh; max-height: 94dvh; overflow-y: auto; }
#title h1 { font-size: var(--px2); margin: 4px 0; color: var(--gold); text-shadow: var(--ink-outline); }
#title p { margin: 6px 0; text-shadow: var(--ink-outline); }
#title .keys { color: var(--muted); }
#title button { font-family: var(--font); font-size: 22px; font-weight: 700; color: var(--text); text-shadow: var(--ink-outline); padding: 0 22px; margin-top: 8px; background: none; cursor: pointer; }
#runBox.late b { color: #ff8a6a; }
#title .row, #result .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* end of a classic run: score, naming a high score place, the list */
#result { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,12,4,.55); z-index: 60; }
#result .box { width: min(520px, 94vw); max-height: 94vh; max-height: 94dvh; overflow-y: auto; padding: 8px 16px; text-align: center; }
#result h1 { font-size: var(--px2); margin: 4px 0; color: var(--gold); text-shadow: var(--ink-outline); }
#result h2 { font-size: var(--tpx); margin: 8px 0 2px; color: var(--gold); text-shadow: var(--ink-outline); }
#result p { margin: 4px 0; text-shadow: var(--ink-outline); }
#rScore { font-size: var(--nx2); font-weight: 700; color: var(--text); }
#result .keys { color: var(--muted); }
#result button { font-family: var(--font); color: var(--text); text-shadow: var(--ink-outline); padding: 0 14px; background: none; cursor: pointer; margin-top: 6px; }
#rNick { font-family: var(--font); font-size: var(--px); width: 10em; padding: 2px 6px; color: var(--ink); background: #fff6dc; border: 3px solid var(--ink); border-radius: 4px; user-select: text; -webkit-user-select: text; }
#rTop { margin: 0 auto; padding: 0; list-style: none; max-width: 320px; text-shadow: var(--ink-outline); counter-reset: r; }
#rTop li { display: flex; justify-content: space-between; gap: 10px; counter-increment: r; }
#rTop li::before { content: counter(r) "."; min-width: 2em; text-align: right; color: var(--muted); }
#rTop li b { flex: 1; text-align: left; font-weight: normal; }
#rTop li.off::before { content: none; }
#rTop li.off b { text-align: center; color: var(--muted); }
@media (max-height: 520px) { #result h1 { font-size: var(--tpx); } #rScore { font-size: var(--px); } #result .box { padding: 4px 12px; } }
/* Mehrspieler: name, open a town, join by code or from the list */
#mp { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,12,4,.55); z-index: 60; }
#mp .box { width: min(520px, 94vw); max-height: 94vh; max-height: 94dvh; overflow-y: auto; padding: 8px 16px; text-align: center; }
#mp h1 { font-size: var(--px2); margin: 4px 0; color: var(--gold); text-shadow: var(--ink-outline); }
#mp h2 { font-size: var(--tpx); margin: 8px 0 2px; color: var(--gold); text-shadow: var(--ink-outline); }
#mp p, #mp label { margin: 4px 0; text-shadow: var(--ink-outline); }
#mp .keys { color: var(--muted); }
#mp .row { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 4px 0; }
#mp button { font-family: var(--font); color: var(--text); text-shadow: var(--ink-outline); padding: 0 14px; background: none; cursor: pointer; }
#mp button:disabled { opacity: .5; cursor: default; }
#mp input { font-family: var(--font); font-size: var(--px); width: 9em; padding: 2px 6px; color: var(--ink); background: #fff6dc; border: 3px solid var(--ink); border-radius: 4px; user-select: text; -webkit-user-select: text; }
#mpMsg { min-height: 1.2em; color: #ffd27a; }
#mpRooms { margin: 0 auto; padding: 0; list-style: none; max-width: 360px; text-shadow: var(--ink-outline); }
#mpRooms li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#mpRooms li b { flex: 1; text-align: left; font-weight: normal; }
#mpRooms li.off b { text-align: center; color: var(--muted); }
#roomBox { cursor: pointer; pointer-events: auto; }
#mpModes button { opacity: .6; }
#mpModes button.on { opacity: 1; color: var(--gold); }
#mpRooms li i { font-style: normal; color: var(--muted); }
/* party modes: the board between two rounds, over the town, never in the way of a tap */
#partyBoard { position: fixed; left: 50%; top: 24%; transform: translateX(-50%); z-index: 40; pointer-events: none; }
#partyBoard .box { width: min(360px, 90vw); padding: 6px 14px; text-align: center; }
#partyBoard h2 { font-size: var(--tpx); margin: 4px 0; color: var(--gold); text-shadow: var(--ink-outline); }
#partyBoard p { margin: 4px 0; text-shadow: var(--ink-outline); }
#pbList { margin: 0 auto; padding: 0; list-style: none; text-shadow: var(--ink-outline); counter-reset: r; }
#pbList li { display: flex; justify-content: space-between; gap: 10px; counter-increment: r; }
#pbList li::before { content: counter(r) "."; min-width: 2em; text-align: right; color: var(--muted); }
#pbList li b { flex: 1; text-align: left; font-weight: normal; }
#pbList li.me b { color: var(--gold); }
/* short phones across: the three start buttons in one row under the text */
@media (max-height: 520px) { #title .box { padding: 6px 14px; } #title p { margin: 3px 0; line-height: 1.15; } #title button { font-size: var(--px); padding: 0 14px; margin-top: 4px; } }
@media (max-height: 520px) { #mp h1 { font-size: var(--px); } #mp .box { padding: 4px 12px; } #mp .row { margin: 2px 0; } }
