@font-face { font-family: 'Jersey 10'; src: url(/assets/Jersey10.woff2) format('woff2'), url(../assets/herpderp/ui/fonts/Jersey10.ttf) format('truetype'); }
:root {
  --wood: #6e3f1c; --wood-dark: #3a2210; --wood-light: #8f5a2c;
  --parch: #ead6a4; --gold: #ffd43a; --ink: #2b1a0e; --text: #fff6dc; --muted: #eed9a8;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --title: 'Jersey 10', 'Trebuchet MS', sans-serif;
  color-scheme: dark;
  --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;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d2a12; color: var(--text); font-family: var(--font); font-weight: 600; -webkit-font-smoothing: antialiased; }
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
/* HerpDerp v6: light haze at the top, soft dark edge and a warm wash over the world (as in Survivor). */
#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; background: radial-gradient(ellipse at center, rgba(200,20,10,0) 40%, rgba(200,20,10,.7) 78%, rgba(120,0,0,.95) 100%); }
#hurt-edge.low { animation: mk-pulse 1.2s ease-in-out infinite; }
@keyframes mk-pulse { 0%, 100% { opacity: .15; } 50% { opacity: .45; } }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; image-rendering: pixelated; }
/* Start, perk and result windows: shared parts from css/phone.css; the overlay is ours, below the system buttons (z 50)
   and the pause menu (900). Only the middle (.hscroll) scrolls, so the buttons stay in view. */
.mk-screen { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 12px; }
.mk-screen.hidden { display: none !important; }
.mk-panel .phm-stat b { font-size: var(--nx2, 28px); font-weight: 700; }
.mk-board { padding: 2px 6px; }
.mk-board ol { padding: 0; list-style: none; }
.mk-board li { display: flex; gap: 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mk-board li .n { width: 24px; color: var(--phm-brown); }
.mk-board li .nm { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mk-board li.me { color: #b3361a; }
.mk-board .empty { justify-content: center; color: var(--phm-brown); }
.mk-board .dev { margin: 2px 0 0; text-align: center; color: var(--phm-brown); }
.mk-name { display: flex; flex-direction: column; gap: 4px; align-self: stretch; text-align: center; color: var(--phm-muted); text-shadow: var(--phm-outline); }
.mk-name.hidden { display: none; }
.mk-name input { min-height: 44px; user-select: text; -webkit-user-select: text; }
.mk-name input:focus-visible { outline: 3px solid var(--phm-gold); outline-offset: 2px; }
/* Perk cards: icon (12 art px at 3 CSS px each), name, level and one line of effect */
.mk-perks { align-self: stretch; display: flex; flex-direction: column; gap: 8px; padding-bottom: 4px; }
.mk-perk { white-space: normal; min-width: 0; width: 100%; min-height: 48px; display: grid; grid-template-columns: 36px 1fr; gap: 2px 10px; align-items: center; text-align: left; padding: 6px 12px; }
.mk-perk img { grid-row: span 2; width: 36px; height: 36px; image-rendering: pixelated; }
.mk-perk b { font-weight: 400; }
.mk-perk b, .mk-perk small { min-width: 0; overflow-wrap: anywhere; }
.mk-perk small { color: var(--phm-muted); font-size: 18.667px; line-height: 1; }
/* Status bar as in Survivor (#topbar) */
#topbar { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 10px; white-space: nowrap;
  background: var(--wood); border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 22px 22px; padding: calc(4px + env(safe-area-inset-top, 0px)) 14px 6px;
  box-shadow: 0 6px 0 rgba(0,0,0,.28), inset 0 2px 0 var(--wood-light); font-size: 18.667px; text-shadow: var(--ink-outline); pointer-events: none; }
#topbar b { color: var(--gold); font-weight: 400; font-size: 37.333px; }
/* 3 CSS px per art pixel: whole device pixels at every pixel ratio */
#topbar .stat { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
#topbar .ico { width: 27px; height: 24px; image-rendering: pixelated; display: block; }
#topbar.hidden { display: none; }
/* phones: left-aligned, clear of the music and menu buttons; digits drop to the small size when the bar still reaches them (fitTopbar) */
@media (max-width: 520px) { #topbar { left: 6px; transform: none; max-width: calc(100vw - 112px); } }
@media (max-width: 400px) { #topbar { gap: 6px; padding-left: 10px; padding-right: 10px; } #topbar b { font-size: var(--nx2, 28px); } }
#topbar.tight { gap: 6px; padding-left: 10px; padding-right: 10px; }
#topbar.tight b { font-size: var(--phm-px); }
/* Recall button while the balls fly, bottom right beside the thrower */
#flybar .phm-btn { min-height: 44px; font-family: inherit; font-size: var(--phm-px); }
#flybar { position: fixed; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 20; }
#flybar.hidden { display: none; }
