@font-face {
  font-family: 'Germania One';
  src: url('./fonts/germania-one-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Dark oak, cast iron, and Bavarian lozenges. */
:root {
  color-scheme: dark;
  --sans: system-ui, -apple-system, sans-serif;
  --tavern: 'Germania One', Georgia, serif;
  --bavarian-blue: #0074c8;
  --bavarian-white: #f5f2e8;
  --brass: #bc9051;
  --lozenge-tile: conic-gradient(from 45deg, var(--bavarian-blue) 0 25%, var(--bavarian-white) 0 50%,
    var(--bavarian-blue) 0 75%, var(--bavarian-white) 0);
  --lozenges: var(--lozenge-tile) center / 28px 12px;
  --oak-grain: repeating-linear-gradient(2deg, transparent 0 3px,
    rgb(255 207 153 / 3%) 4px, rgb(0 0 0 / 15%) 5px, transparent 7px 10px);
  --ink: #fbf1e2;
  --muted: #dbbcaa;
  --iron: #2a1a13;
  --solid: #251a15;
  --recess: #1b120e;
  --edge: rgb(211 158 79 / 55%);
  --rule: rgb(247 167 111 / 19%);
  --sheen: rgb(255 192 140 / 13%);
  --accent: #f5a93b;
  --hot: #f06a2b;
  --wash: #48281c;
  --danger: #ffb39e;
  --scrim: rgb(17 10 8 / 68%);
  --surface: linear-gradient(158deg, var(--sheen), transparent 54%), var(--iron);
  --key-face: linear-gradient(170deg, var(--sheen), transparent 85%), var(--solid);
  --bevel: inset 0 1px 0 var(--sheen), inset 0 -1px 0 rgb(0 0 0 / 36%);
  --shadow: 0 3px 0 rgb(14 9 7 / 64%), 0 8px 18px rgb(11 9 10 / 26%);
  --heat-glow: 0 0 14px color-mix(in srgb, var(--hot) 47%, transparent);
}

[data-theme="biergarten"] {
  --ink: #fff0d7;
  --muted: #dec3a1;
  --iron: #281912;
  --solid: #261912;
  --recess: #170e0a;
  --edge: rgb(220 157 73 / 43%);
  --rule: rgb(231 183 115 / 21%);
  --sheen: rgb(246 184 76 / 13%);
  --accent: #f6b84c;
  --hot: #ea853d;
  --wash: #503419;
}

[data-theme="frost"] {
  --ink: #e3eef8;
  --muted: #bdcfdf;
  --iron: #22252b;
  --solid: #182330;
  --recess: #101824;
  --edge: rgb(182 210 238 / 43%);
  --rule: rgb(177 203 226 / 24%);
  --sheen: rgb(195 226 255 / 14%);
  --accent: #ffad85;
  --hot: #ff7440;
  --wash: #493039;
  --scrim: rgb(10 17 28 / 70%);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #8dd5f4;
  color: var(--ink);
  font: 500 15px/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

button, input, select { font: inherit; color: inherit; }

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button, summary { touch-action: manipulation; }

:is(button, input, select, summary):focus-visible,
.gamepad-navigation :is(button, input, select, summary):focus {
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:is(input, select).gamepad-editing {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--wash);
}

[hidden], .hidden { display: none !important; }

[data-icon] { display: inline-flex; }

.hud-icon {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
}

.app-shell {
  --left: max(24px, calc(env(safe-area-inset-left) + 8px));
  --right: max(24px, calc(env(safe-area-inset-right) + 8px));
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  pointer-events: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
  touch-action: none;
}

.patron-speech {
  --bubble-paper: #fff1d1;
  --bubble-oak: #45271a;
  position: fixed;
  z-index: 12;
  translate: -50% calc(-100% - 8px);
  transform-origin: 50% calc(100% + 8px);
  padding: 5px 13px 6px;
  border: 2px solid var(--bubble-oak);
  border-radius: 14px;
  background: linear-gradient(#fff8e7, var(--bubble-paper));
  box-shadow: 0 3px 0 rgb(69 39 26 / 30%);
  color: var(--bubble-oak);
  font: 400 19px/1.1 var(--tavern);
  white-space: nowrap;
  pointer-events: none;
  animation: patron-speech 1.4s ease-out both;
}

.patron-speech::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: calc(50% - 5px);
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: var(--bubble-paper);
  border-right: 2px solid var(--bubble-oak);
  border-bottom: 2px solid var(--bubble-oak);
}

@keyframes patron-speech {
  0% { opacity: 0; transform: scale(0.72); }
  11% { opacity: 1; transform: scale(1.08); }
  19%, 77% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .patron-speech { animation-name: patron-speech-fade; }
}

@keyframes patron-speech-fade {
  0%, 77% { opacity: 1; }
  100% { opacity: 0; }
}

.brand, .action-cluster, .scoreboard, .fab, .stage-toast, .dock-controls {
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--bevel), var(--shadow);
}

.brand, .scoreboard, .action-cluster, .dock-controls {
  border: 5px solid transparent;
  border-inline-width: 1px;
  background:
    var(--oak-grain) padding-box,
    linear-gradient(164deg, var(--sheen), transparent 74%) padding-box,
    linear-gradient(var(--iron), var(--recess)) padding-box,
    var(--lozenge-tile) center top / 24px 10px repeat-x border-box,
    var(--lozenge-tile) center bottom / 24px 10px repeat-x border-box,
    var(--bavarian-blue) border-box;
  box-shadow: inset 0 0 0 1px var(--brass), inset 0 2px 6px rgb(0 0 0 / 39%), var(--shadow);
}

.stat-k, .mini-k, .btn-lbl, .dock-btn, .daily-date-line {
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

/* Header */
.top-bar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template: "brand menu" auto "score score" auto / auto 1fr;
  align-items: center;
  gap: 12px 8px;
  padding: max(18px, calc(env(safe-area-inset-top) + 6px)) var(--right) 0 var(--left);
}

.brand {
  grid-area: brand;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 3px 13px 3px 7px;
  border-radius: 16px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: radial-gradient(ellipse at 45% 65%, var(--wash), var(--recess) 82%);
  box-shadow: inset 0 1px 5px rgb(0 0 0 / 55%);
  color: var(--accent);
}

.brand-mark .hud-icon { width: 30px; height: 30px; }

.brand-title {
  margin: 0;
  font: 400 32px/.97 var(--tavern);
  text-shadow: 0 2px 0 var(--recess);
}

.brand-title span { color: #ffd68a; }

.action-cluster {
  grid-area: menu;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
  pointer-events: auto;
}

.icon-btn, .dock-btn, .fab, .dpad-btn, .modal-close, .primary-btn, .secondary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  transition: color 120ms ease, background-color 120ms ease, transform 90ms ease;
}

.icon-btn {
  min-width: 42px;
  min-height: 44px;
  padding-inline: 8px;
}

.btn-lbl { font-size: 11px; }
.icon-btn > .hud-icon, .icon-btn > [data-icon] { color: var(--muted); }
.icon-btn:hover > .hud-icon, .icon-btn:hover > [data-icon] { color: var(--accent); }

.scoreboard {
  grid-area: score;
  justify-self: center;
  display: grid;
  grid-template-columns: 1fr repeat(3, 1.05fr) .9fr 1.9fr;
  width: min(100%, 448px);
  padding: 7px 5px 8px;
}

.stat {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding-inline: 3px;
  text-align: center;
}

.stat + .stat { border-inline-start: 1px solid var(--rule); }
.stat-k, .mini-k { color: var(--muted); font-size: 10px; }
.stat-v, .mini-stats strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 25px;
  font-weight: 850;
  line-height: 1;
}

#hud-level.stat-v-compact {
  width: 100%;
  overflow: hidden;
  font-size: clamp(11px, 1.45vw, 14px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-diff .stat-v { font-size: 14px; line-height: 1.12; }
:is(.stat-target, .stat-streak, .stat-seared) .stat-v {
  color: #ffc269;
  text-shadow: 0 0 12px rgb(251 117 42 / 62%), 0 1px 0 #4b210f;
}

@media (min-width: 1080px) {
  .top-bar {
    column-gap: 14px;
    grid-template: "brand score menu" auto / minmax(0, 1fr) minmax(0, 448px) minmax(0, 1fr);
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .action-cluster .icon-btn { gap: 5px; }
}

/* Stage and camera controls */
.stage-wrap { position: relative; z-index: 8; }

.stage-toast {
  position: absolute;
  z-index: 1;
  inset: 12px auto auto 50%;
  width: max-content;
  max-width: min(480px, calc(100% - var(--left) - var(--right)));
  padding: 8px 16px;
  border-inline-start: 3px solid var(--accent);
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
  opacity: 0;
  transform: translate(-50%, -5px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.stage-toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-danger { border-inline-start-color: var(--danger); color: var(--danger); }

.fab {
  position: absolute;
  right: var(--right);
  bottom: 14px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: var(--ink);
  pointer-events: auto;
}

.fab .hud-icon { width: 26px; height: 26px; }

.mobile-dpad {
  --dpad-key: 48px;
  --dpad-hub: 44px;
  position: absolute;
  left: var(--left);
  bottom: 10px;
  display: none;
  grid: var(--dpad-key) var(--dpad-hub) var(--dpad-key) / var(--dpad-key) var(--dpad-hub) var(--dpad-key);
  touch-action: none;
}

.mobile-dpad::before, .mobile-dpad::after {
  grid-area: 2 / 2;
  place-self: center;
  border-radius: 50%;
  content: "";
}

.mobile-dpad::before {
  width: 74%;
  height: 74%;
  border: 1px solid var(--rule);
  background: radial-gradient(circle, var(--iron), var(--recess) 82%);
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 55%), var(--shadow);
}

.mobile-dpad::after {
  width: 10px;
  height: 10px;
  border: 1px solid var(--brass);
  background: var(--wash);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 45%);
}

.dpad-btn {
  z-index: 0;
  color: var(--ink);
  touch-action: none;
  pointer-events: auto;
}

/* The key moves within its hit area, so dragging across the edge stays stable. */
.dpad-btn::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1px solid var(--brass);
  border-radius: inherit;
  background: radial-gradient(ellipse at 50% 0, rgb(253 198 100 / 14%), transparent 75%), var(--key-face);
  box-shadow: inset 0 1px 0 rgb(255 220 140 / 30%), inset 0 -4px 0 rgb(0 0 0 / 34%), var(--shadow);
  content: "";
}

.dpad-btn .hud-icon { width: 23px; height: 23px; filter: drop-shadow(0 2px 0 var(--recess)); }
.dpad-up { grid-area: 1 / 2; border-radius: 17px 17px 7px 7px; }
.dpad-down { grid-area: 3 / 2; border-radius: 7px 7px 17px 17px; }
.dpad-left { grid-area: 2 / 1; border-radius: 17px 7px 7px 17px; }
.dpad-right { grid-area: 2 / 3; border-radius: 7px 17px 17px 7px; }

.dpad-btn.is-pressed { color: var(--accent); }
.dpad-btn.is-pressed::before {
  transform: translateY(2px) scale(.93);
  border-color: var(--hot);
  background: var(--wash);
  box-shadow: inset 0 2px 5px var(--recess), var(--heat-glow);
}
.dpad-btn.is-pressed .hud-icon { transform: translateY(2px) scale(.93); }
.mobile-dpad:has(.is-pressed)::after { border-color: var(--hot); }

/* Dock */
.bottom-dock {
  position: relative;
  z-index: 10;
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 0 var(--right) max(16px, calc(env(safe-area-inset-bottom) + 7px)) var(--left);
}

.dock-controls {
  display: flex;
  gap: 4px;
  padding: 3px 5px;
  pointer-events: auto;
}

.dock-btn, .modal-close, .secondary-btn {
  border: 1px solid var(--rule);
  background: var(--key-face);
  box-shadow: var(--bevel);
}

.dock-btn {
  min-height: 44px;
  padding: 0 15px;
  font-size: 12px;
}

.dock-btn .hud-icon { color: var(--muted); }
.dock-btn:hover:not(:disabled) .hud-icon { color: var(--accent); }
.dock-btn.confirming {
  border-color: var(--hot);
  background: var(--wash);
  color: var(--ink);
  box-shadow: var(--bevel), var(--heat-glow);
}
.dock-btn.confirming .hud-icon { color: var(--hot); }
.dock-btn:disabled { opacity: .5; cursor: default; }

.dock-hint {
  color: #fbf1e2;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 3px #132131, 0 1px 6px #132131;
  opacity: 0.92;
  transition: opacity 420ms ease;
  pointer-events: auto;
}
.dock-hint.is-dimmed { opacity: 0.44; }
.dock-hint:hover { opacity: 0.96; }

.dock-hint kbd { font: inherit; }
.dock-hint .hint-sep { margin-inline: 4px; }
.dock-hint .hint-gp { display: none; }
body.gamepad-active .dock-hint .hint-kb { display: none; }
body.gamepad-active .dock-hint .hint-gp { display: inline; }

.dock-hint kbd.gp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -1px;
  font: 800 10.5px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.02em;
  text-shadow: none;
  box-shadow: 0 1px 2px rgb(0 0 0 / 45%), inset 0 1px 0 rgb(255 255 255 / 28%);
}
.dock-hint kbd.gp-a,
.dock-hint kbd.gp-b,
.dock-hint kbd.gp-x,
.dock-hint kbd.gp-y {
  min-width: 18px;
  height: 18px;
  padding-inline: 3px;
  border-radius: 999px;
}
.dock-hint kbd.gp-a { background: #107c10; color: #fff; border: 1px solid #35b935; }
.dock-hint kbd.gp-b { background: #d13438; color: #fff; border: 1px solid #f06568; }
.dock-hint kbd.gp-x { background: #0078d4; color: #fff; border: 1px solid #4ca8f5; }
.dock-hint kbd.gp-y { background: #eab308; color: #18181b; border: 1px solid #fde047; }
.dock-hint kbd.gp-pill {
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  background: #23272f;
  color: #f4f4f5;
  border: 1px solid rgb(255 255 255 / 24%);
}

/* Dialogs */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.scrim.open { opacity: 1; pointer-events: auto; }

.modal {
  --modal-x: clamp(15px, 4vw, 24px);
  --modal-top: max(12px, env(safe-area-inset-top));
  --modal-bottom: max(12px, env(safe-area-inset-bottom));
  position: fixed;
  inset: var(--modal-top) var(--right) var(--modal-bottom) var(--left);
  z-index: 50;
  width: min(100% - var(--left) - var(--right), 500px);
  height: fit-content;
  max-height: calc(100% - var(--modal-top) - var(--modal-bottom));
  margin: auto;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border: 1px solid var(--brass);
  border-radius: 18px;
  background: var(--oak-grain), var(--solid);
  box-shadow: var(--bevel), 0 20px 58px rgb(11 8 8 / 54%);
  scrollbar-color: var(--edge) var(--solid);
  pointer-events: auto;
}

#modal-help { width: min(100% - var(--left) - var(--right), 560px); }

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px var(--modal-x);
  border-top: 6px solid transparent;
  border-bottom: 1px solid var(--brass);
  background:
    var(--oak-grain) padding-box,
    linear-gradient(165deg, var(--iron), var(--recess)) padding-box,
    var(--lozenges) border-box;
}

.modal-head h2 {
  flex: 1;
  margin: 0;
  font: 400 clamp(23px, 5vw, 30px)/1.05 var(--tavern);
  color: #ffe8bc;
  text-shadow: 0 2px 0 var(--recess);
}

.modal-mark { color: var(--accent); }
.modal-mark .hud-icon { width: 25px; height: 25px; }

.modal-close {
  flex: none;
  width: 44px;
  height: 44px;
  color: var(--muted);
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 18px var(--modal-x) 22px;
}

.modal-body :is(button, input, select, summary) { scroll-margin-top: 80px; }

.diff-grid, .custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.diff-card {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--key-face);
  box-shadow: var(--bevel);
  text-align: left;
}

.diff-card strong { font-size: 15px; font-weight: 850; line-height: 1.2; }
.diff-card span { color: var(--muted); font-size: 13px; line-height: 1.28; }
.diff-card.active { border-color: var(--hot); background: var(--wash); }

.custom-section {
  min-width: 0;
  border-block: 1px solid var(--rule);
}

.custom-section summary {
  padding: 11px 4px;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.custom-section[open] { padding-bottom: 12px; }

.custom-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 4px 0 12px;
}

.custom-grid label, .custom-variety {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.custom-grid input, .custom-variety select, .seed-row input {
  min-width: 0;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--recess);
  color: var(--ink);
  font-size: 16px;
}

.custom-variety { margin-bottom: 12px; }

#custom-status { margin: 8px 0 0; }
#custom-status:empty { margin: 0; }

.seed-row { display: flex; gap: 7px; }
.seed-row input { flex: 1; }
.seed-row input::placeholder { color: var(--muted); opacity: 1; }

.primary-btn, .secondary-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 7px 12px;
  font-weight: 850;
  line-height: 1.15;
  text-align: center;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: linear-gradient(170deg, var(--accent), var(--hot));
  color: var(--recess);
  box-shadow: var(--bevel), 0 3px 0 var(--recess);
}

.secondary-btn .hud-icon { color: var(--accent); }
.full-width { width: 100%; }

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.daily-date-line, .daily-status { margin: 0; }
.daily-date-line { color: var(--accent); font-size: 13px; }
.daily-status { margin-top: -7px; color: var(--muted); }

.mini-stats {
  display: flex;
  padding: 12px 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--recess);
  box-shadow: inset 0 2px 6px rgb(0 0 0 / 28%);
}

.mini-stats > div {
  display: grid;
  justify-items: center;
  align-content: start;
  flex: 1;
  gap: 4px;
  text-align: center;
}

.mini-stats > div + div { border-inline-start: 1px solid var(--rule); }

.help-body { gap: 12px; }
.help-body :is(p, ul) { margin: 0; }

.help-body ul {
  display: grid;
  gap: 7px;
  padding-inline-start: 18px;
}

.help-body li::marker { color: var(--hot); }
.help-body strong { font-weight: 800; }
.help-body code { font-size: .9em; color: var(--accent); }

.help-keys {
  padding-top: 9px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

.vic-body { text-align: center; }

.vic-award {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.vic-crest {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 5px solid transparent;
  border-radius: 50%;
  background: radial-gradient(circle, var(--wash), var(--recess)) padding-box, var(--lozenges) border-box;
  box-shadow: inset 0 0 0 1px var(--brass), var(--heat-glow);
  color: var(--accent);
}

.vic-crest .hud-icon { width: 34px; height: 34px; }
#vic-medal {
  margin: 0;
  color: #ffd68a;
  font: 400 28px/1.12 var(--tavern);
  text-shadow: 0 2px 0 var(--recess);
}
.vic-body .modal-actions { justify-content: center; }

/* Shared interaction states */
@media (hover: hover) {
  :is(.icon-btn, .dock-btn, .modal-close, .secondary-btn, .diff-card, .fab):hover:not(:disabled) {
    background: var(--wash);
    color: var(--ink);
  }

  .primary-btn:hover { box-shadow: var(--bevel), var(--heat-glow); }
}

button:not(:disabled, .dpad-btn):active { transform: translateY(1px); }

@media (max-width: 1379px) {
  .btn-lbl { display: none; }
  .icon-btn { padding-inline: 0; }
}

@media (max-width: 680px), (pointer: coarse), (orientation: landscape) and (max-height: 520px) and (max-width: 960px) {
  .mobile-dpad { display: grid; }
  .dock-hint { display: none; }
}

@media (max-width: 680px) {
  .app-shell {
    --left: max(11px, calc(env(safe-area-inset-left) + 6px));
    --right: max(11px, calc(env(safe-area-inset-right) + 6px));
  }

  .top-bar {
    gap: 10px 6px;
    padding-top: max(10px, calc(env(safe-area-inset-top) + 6px));
  }

  .brand { gap: 6px; min-height: 49px; padding: 4px 7px 4px 4px; border-radius: 12px; }
  .brand-title { font-size: clamp(16px, 5vw, 21px); }
  .brand-title span { display: block; }
  .brand-mark { width: clamp(27px, 8vw, 36px); height: clamp(27px, 8vw, 36px); }
  .brand-mark .hud-icon { width: 84%; height: 84%; }
  .action-cluster { gap: 1px; padding: 2px; border-radius: 12px; }
  .icon-btn { min-width: clamp(28px, 8.5vw, 42px); }
  .icon-btn .hud-icon { width: 18px; height: 18px; }
  .scoreboard { padding-inline: 2px; }
  .stat { padding-inline: 2px; }
  .stat-k { font-size: clamp(8px, 2.5vw, 10px); }
  .stat-v { font-size: 22px; }
  #hud-level { font-size: 20px; }
  .stat-diff .stat-v { font-size: 12px; }
  .dock-btn { padding-inline: 13px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .top-bar { padding-top: max(8px, env(safe-area-inset-top)); row-gap: 7px; }
  .stage-toast { top: 9px; }
  .dock-hint { display: none; }
  .bottom-dock { padding-bottom: max(9px, calc(env(safe-area-inset-bottom) + 5px)); }
  .mobile-dpad, .fab { bottom: 5px; }
  .modal-head { padding-block: 7px; }
  .modal-body { padding-block: 12px 16px; gap: 12px; }
  .daily-status { margin-top: 0; }
}

@media (orientation: landscape) and (max-height: 520px) and (min-width: 720px) {
  .top-bar { grid-template: "brand score menu" auto / auto minmax(0, 1fr) auto; }
  .brand { min-height: 48px; }
  .brand-title { font-size: 23px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark .hud-icon { width: 25px; height: 25px; }
  .btn-lbl { display: none; }
  .icon-btn { min-width: 38px; padding-inline: 0; }
  .scoreboard { padding-block: 6px; }
  .stat-v { font-size: 21px; }
  .stat-diff .stat-v { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

.credit-links { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); text-align: center; }
.credit-links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credit-links a:hover { color: var(--ink); }
