/* The look of the FIREFOX mockups: torn parchment panels and ink-drawn buttons cut from one asset sheet
:root (assets/ui, drawn in the style of the mockups), :root a condensed sans for the HUD and a heavy serif for titles.
   Loaded after comic-ui.css: it replaces surfaces and type, the layout stays there. */
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 400; font-display: swap; src: url(assets/fonts/Oswald-400-normal-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 400; font-display: swap; src: url(assets/fonts/Oswald-400-normal-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap; src: url(assets/fonts/Oswald-600-normal-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap; src: url(assets/fonts/Oswald-600-normal-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'PT Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(assets/fonts/PTSerif-400-italic-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'PT Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(assets/fonts/PTSerif-400-italic-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'PT Serif'; font-style: normal; font-weight: 700; font-display: swap; src: url(assets/fonts/PTSerif-700-normal-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'PT Serif'; font-style: normal; font-weight: 700; font-display: swap; src: url(assets/fonts/PTSerif-700-normal-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --hud-font: 'Oswald', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --title-font: 'PT Serif', Georgia, 'Times New Roman', serif;
  --ink-drop: drop-shadow(2px 4px 0 #0a0c08a8);
  --lime-glow: drop-shadow(0 0 10px #c8ff5a99) drop-shadow(2px 4px 0 #0a0c0899);
}

/* ---------------------------------------------------------------- surfaces */
:root .comic-sheet {
  border: 26px solid transparent;
  border-image: url(assets/ui/sheet.webp) 64 fill / 26px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: var(--ink-drop);
}
:root #hud :is(.panel, #goal) {
  border: 13px solid transparent;
  border-image: url(assets/ui/strip.webp) 40 fill / 13px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: var(--ink-drop);
}
:root #hud #yaga {
  border: 11px solid transparent;
  border-image: url(assets/ui/tag.webp) 40 fill / 11px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: var(--ink-drop);
  color: var(--paper-ink);
  font: 600 clamp(12px, .8vw, 18px)/1.1 var(--hud-font);
}
:root .comic-sheet :is(.tile, .upgrade),
:root #overlay.menu .menu-sheet .upgrade,
:root #overlay.menu .stats > div,
:root #overlay.pick .card,
:root #overlay.shop .card,
:root #overlay.result .stats > div {
  border: 11px solid transparent;
  border-image: url(assets/ui/card.webp) 34 fill / 11px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: drop-shadow(2px 3px 0 #20150d80);
  backdrop-filter: none;
}

/* ---------------------------------------------------------------- buttons */
:root #overlay .primary,
:root #atlas > .primary {
  border: 14px solid transparent;
  border-image: url(assets/ui/btn-lime.webp) 44 fill / 14px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: var(--lime-glow);
  color: #1d220a;
  font: 700 clamp(17px, 1.15vw, 28px)/1 var(--title-font);
  letter-spacing: .02em;
}
:root #overlay .primary:hover:enabled,
:root #atlas > .primary:hover { filter: drop-shadow(0 0 16px #d8ff6acc) drop-shadow(2px 4px 0 #0a0c0899) brightness(1.06); }
:root #overlay.paused .wide:not(.primary),
:root #overlay.pick .extras .wide,
:root #overlay.shop > .wide:not(.primary),
:root #overlay.result > .wide:not(.primary),
:root #atlas .wide:not(.primary) {
  border: 14px solid transparent;
  border-image: url(assets/ui/btn-dark.webp) 44 fill / 14px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: var(--ink-drop);
  color: #f2e2bd;
  font: 700 clamp(15px, 1vw, 24px)/1 var(--title-font);
}
:root #overlay.paused .wide:not(.primary):hover:enabled,
:root #overlay.pick .extras .wide:hover:enabled,
:root #overlay.shop > .wide:not(.primary):hover:enabled { filter: var(--ink-drop) brightness(1.18); }
:root #overlay.menu .menu-sheet .modes .upgrade,
:root #overlay.menu .menu-sheet .actions .wide:not(.primary) {
  border: 13px solid transparent;
  border-image: url(assets/ui/btn-paper.webp) 44 fill / 13px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--paper-ink);
  font-family: var(--title-font);
}
:root #overlay.paused .stats > div {
  border: 12px solid transparent;
  border-image: url(assets/ui/box-dark.webp) 40 fill / 12px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: var(--ink-drop);
}
/* The chosen hero, weapon or mode, and anything under the pointer: a green glow around the paper. */
:root #overlay.menu .menu-sheet :is(.tile, .upgrade).last,
:root #overlay.menu .menu-sheet :is(.tile, .upgrade)[aria-pressed="true"],
:root #overlay.menu .menu-sheet :is(.tile, .upgrade):hover:enabled,
:root #overlay:is(.pick, .shop) .card:enabled:hover {
  border-color: transparent;
  box-shadow: none;
  filter: drop-shadow(0 0 3px #b9f34f) drop-shadow(0 0 9px #b9f34fbb) drop-shadow(2px 3px 0 #20150d80);
}

/* ---------------------------------------------------------------- type */
:root #hud, :root #hud button, :root #overlay, :root #atlas { font-family: var(--hud-font); }
:root #overlay h1, :root #overlay h2, :root #atlas h1 { font-family: var(--title-font); }
:root #overlay.menu .menu-sheet h1 {
  font: 700 clamp(32px, min(6.4vw, 10.5vh), 150px)/.95 var(--title-font);
  letter-spacing: .02em;
  color: #15160c;
  text-shadow: 0 0 .12em #d8ff6c, 0 0 .3em #c4ff4ab0;
}
:root #overlay.menu .menu-sheet h2 {
  font: 600 clamp(14px, 1.3vw, 30px)/1.1 var(--hud-font);
  letter-spacing: .04em;
  text-transform: uppercase;
}
:root #overlay.menu .stats b { font-family: var(--title-font); }
:root #overlay.menu .stats small,
:root #overlay.menu .modes .upgrade span { font-family: var(--hud-font); text-transform: uppercase; }
:root #overlay.menu .menu-sheet :is(.tile, .upgrade) b { font: 600 clamp(12px, .95vw, 22px)/1.15 var(--hud-font); text-transform: uppercase; }
:root #overlay.menu .menu-sheet .modes .upgrade b { font: 700 clamp(15px, 1.05vw, 26px)/1.1 var(--title-font); text-transform: none; }
:root #overlay.menu .menu-sheet .lore { font: 400 clamp(11px, .82vw, 18px)/1.35 var(--hud-font); }

/* HUD: the numbers and labels of the mockups. */
:root #hud .vitals .row { font: 400 clamp(13px, 1.1vw, 26px)/1 var(--hud-font); }
:root #hud .vitals .hp { height: clamp(10px, .75vw, 18px); }
:root #hud .vitals .xp { position: relative; height: clamp(8px, .6vw, 14px); margin-top: 3px; overflow: visible; }
:root #hud .vitals .xp::after {
  content: 'ОПЫТ';
  position: absolute;
  left: 0;
  top: calc(100% + 3px);
  color: var(--paper-ink);
  font: 600 clamp(9px, .62vw, 15px)/1 var(--hud-font);
  letter-spacing: .06em;
}
:root #hud .vitals { padding-bottom: clamp(14px, 1.1vw, 26px); }
:root #hud .bar { border: 2px solid #1a130c; border-radius: 1px; }
:root #hud .hp i { background: linear-gradient(#e0473a, #a92a26); }
:root #hud .xp i { background: linear-gradient(#8fdc5e, #4f9a3d); }
:root #hud .chapter { text-align: center; }
:root #hud #place { font: 400 clamp(12px, .95vw, 23px)/1.15 var(--hud-font); letter-spacing: .06em; text-transform: uppercase; color: var(--paper-ink); }
:root #hud #hunt { font: 600 clamp(13px, 1.05vw, 25px)/1.15 var(--hud-font); letter-spacing: .06em; }
:root #hud .chapter .bar { display: none; }
:root #hud #goal :is(b, span) { font: 400 clamp(12px, .92vw, 21px)/1.35 var(--hud-font); }
:root #hud .tally { font: 400 clamp(12px, .9vw, 21px)/1 var(--hud-font); }

/* ---------------------------------------------------------------- pause */
:root #overlay.paused .comic-popup h1 { font: 700 clamp(30px, 2.4vw, 56px)/1 var(--title-font); color: #15160c; }
:root #overlay.paused .comic-popup .motto { font: 700 clamp(13px, .95vw, 22px)/1.2 var(--title-font); color: var(--paper-ink); }
:root #overlay.paused .stats b { font: 700 clamp(20px, 1.5vw, 34px)/1 var(--title-font); }
:root #overlay.paused .stats small { font: 700 clamp(11px, .8vw, 18px)/1 var(--title-font); }

/* ---------------------------------------------------------------- level-up cards */
:root #overlay.pick .comic-popup h1 { font: 700 clamp(22px, 1.75vw, 42px)/1 var(--title-font); text-transform: uppercase; color: #15160c; letter-spacing: .02em; }
:root #overlay:is(.pick, .shop) .card b { font: 700 clamp(14px, .95vw, 22px)/1.15 var(--title-font); text-transform: uppercase; }
:root #overlay:is(.pick, .shop) .card :is(span, small, em) { font-family: var(--hud-font); }
:root #overlay.pick .card::after {
  border: 2px solid #3a2a1a;
  border-radius: 3px;
  background: #e9d3a3;
  font: 600 12px/1 var(--hud-font);
}

/* ---------------------------------------------------------------- shop */
:root #overlay.shop > h1 {
  font: 700 clamp(30px, 2.6vw, 60px)/1 var(--title-font);
  color: #f0c66a;
  text-shadow: 0 2px 0 #3a2208, 0 0 18px #f0b2484d;
}
:root #overlay.shop .tip-yaga { font: italic 400 clamp(13px, .9vw, 20px)/1.35 var(--title-font); color: #f2e2bd; }
:root #overlay.shop .purse { font: 600 clamp(15px, 1vw, 22px)/1 var(--hud-font); color: #f2e2bd; }
:root #overlay.shop .card .price { font: 700 clamp(13px, .85vw, 19px)/1 var(--title-font); color: #4a2c10; }
:root #overlay.shop .card small { text-transform: uppercase; letter-spacing: .05em; font-size: clamp(9px, .6vw, 13px); }

/* ---------------------------------------------------------------- results */
:root #overlay.result > h1 { font-family: var(--title-font); color: #f0c66a; }
:root #overlay.result .stats b { font-family: var(--title-font); }

/* ---------------------------------------------------------------- hints on the field */
:root #hud #prompt,
:root #hud #map-goal {
  border: 10px solid transparent;
  border-image: url(assets/ui/plaque.webp) 30 fill / 10px stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: var(--ink-drop);
  color: #f2e2bd;
  font-family: var(--hud-font);
}
:root #hud #prompt b { font: 700 clamp(15px, 1vw, 22px)/1.1 var(--title-font); color: #f0c66a; }
:root #hud #map-goal { font: 400 clamp(13px, .9vw, 20px)/1.2 var(--hud-font); padding: 2px 8px; }

/* ---------------------------------------------------------------- menu links: keeper and settings */
:root #overlay.menu .menu-links { display: flex; gap: 18px; }
:root #overlay.menu .menu-links .keeper-link { font: 600 clamp(13px, .9vw, 20px)/1 var(--hud-font); text-transform: uppercase; letter-spacing: .05em; color: var(--paper-muted); }
:root #overlay.menu .menu-links .keeper-link:hover { color: var(--paper-ink); }

/* ---------------------------------------------------------------- settings (as the Gemini mockup) */
:root #overlay .settings { display: grid; gap: clamp(10px, 1.4vh, 18px); width: 100%; }
:root #overlay .settings-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.2vw, 24px); }
:root #overlay .settings-col {
  display: grid;
  align-content: start;
  gap: clamp(8px, 1.1vh, 14px);
  padding: clamp(10px, .9vw, 18px) clamp(12px, 1vw, 20px);
  border: 2px solid #2a1d12;
  border-radius: 3px 6px 4px 5px;
  background: #d9b98226;
  box-shadow: inset 0 0 0 1px #fff3d244, 2px 3px 0 #2a1d1230;
}
:root #overlay .settings-head {
  margin: 0 0 2px;
  font: 700 clamp(15px, 1.1vw, 24px)/1 var(--title-font);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--paper-ink);
}
:root #overlay .setting { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 10px; color: var(--paper-ink); }
:root #overlay .setting-label { font: 700 clamp(14px, .95vw, 21px)/1.1 var(--title-font); }
:root #overlay .setting-value { font: 600 clamp(13px, .85vw, 19px)/1 var(--hud-font); text-align: right; }
:root #overlay .setting-range { grid-column: 1 / -1; }
:root #overlay .setting-hint { grid-column: 1 / -1; font: 400 clamp(11px, .7vw, 15px)/1.2 var(--hud-font); color: var(--paper-muted); }
:root #overlay .setting-pair { display: flex; gap: 12px; }
/* Вкл / Выкл: a hand-drawn box, crossed when chosen. */
:root #overlay .setting-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--paper-ink);
  font: 700 clamp(13px, .85vw, 19px)/1 var(--title-font);
  cursor: pointer;
}
:root #overlay .setting-choice::before {
  content: '';
  width: 1.05em;
  height: 1.05em;
  border: 2px solid #1a130c;
  border-radius: 2px 3px 2px 3px;
  background: #f4e2bb;
  box-shadow: 1px 1px 0 #1a130c55;
}
:root #overlay .setting-choice[aria-pressed="true"]::before {
  background:
    linear-gradient(45deg, transparent 42%, #1a130c 42% 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, #1a130c 42% 58%, transparent 58%),
    #f4e2bb;
}
:root #overlay .setting-choice.wide-choice {
  padding: 4px 12px;
  border: 9px solid transparent;
  border-image: url(assets/ui/btn-lime.webp) 44 fill / 9px stretch;
  filter: drop-shadow(1px 2px 0 #20150d70);
}
:root #overlay .setting-choice.wide-choice::before { content: none; }
:root #overlay .setting-choice:disabled { opacity: .5; cursor: default; }
/* The slider: a dark wooden rail and a brass-capped handle. */
:root #overlay .setting-range {
  --fill: 50%;
  appearance: none;
  width: 100%;
  height: 12px;
  border: 2px solid #1a130c;
  border-radius: 6px;
  background: linear-gradient(90deg, #6b4a2c 0 var(--fill), #3a2b1f var(--fill)), #3a2b1f;
  box-shadow: inset 0 2px 2px #0006;
  cursor: pointer;
}
:root #overlay .setting-range::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 28px;
  border: 2px solid #1a130c;
  border-radius: 4px;
  background: linear-gradient(#e9c98a, #a97c3c);
  box-shadow: 1px 2px 0 #0008;
}
:root #overlay .setting-range::-moz-range-thumb {
  width: 14px;
  height: 24px;
  border: 2px solid #1a130c;
  border-radius: 4px;
  background: linear-gradient(#e9c98a, #a97c3c);
}
:root #overlay .settings > .primary { justify-self: center; min-width: min(260px, 100%); text-transform: uppercase; }
:root #overlay.paused .comic-popup:has(.settings) { width: min(clamp(560px, 46vw, 980px), 100%); }
@media (max-width: 700px) { :root #overlay .settings-cols { grid-template-columns: 1fr; } }

/* The taller vitals panel (with its experience label) pushes the goals down. */
:root #hud #goal { top: calc(var(--hud-top) + clamp(92px, 6.6vw, 156px)); }
@media (max-width: 860px) {
  :root #hud #goal { top: calc(var(--hud-top) + 112px); }
  :root .comic-sheet { border-width: 18px; border-image-width: 18px; }
}

/* Field hints stay under any open screen. */
body:has(#overlay:not([hidden])) #hud :is(#map-goal, #compass) { visibility: hidden; }

@media (max-width: 560px) {
  /* Names wrap between words, never inside one. */
  :root #overlay.menu .menu-sheet :is(.tile, .upgrade) b {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
    font-size: 10px;
    letter-spacing: 0;
  }
  :root .comic-sheet .tile { overflow-wrap: normal; padding-inline: 2px; }
}

/* ---------------------------------------------------------------- pages of their own (Gemini mockups):
   co-op, keeper and settings take a wide sheet in the middle of the forest, the hero art steps aside. */
body.menu.wide-page::before { display: none; }
body.menu.wide-page #view { visibility: hidden; }
:root #overlay.menu.wide-page { justify-content: center; align-items: center; background: #0d140f8c; }
:root #overlay.menu.wide-page > .menu-sheet { width: min(1080px, 100%); }
:root #overlay.menu.wide-page .menu-sheet > h1,
:root #overlay.menu.wide-page .menu-sheet > .stats { display: none; }
:root #overlay.menu.wide-page .menu-sheet > h2 {
  margin: 0 0 6px;
  text-align: center;
  text-transform: none;
  font: 700 clamp(26px, 2.6vw, 58px)/1.05 var(--title-font);
  letter-spacing: .01em;
  color: #2d3a17;
  text-shadow: 0 0 .1em #e2ff8a, 0 0 .3em #c4ff4a99, 1px 2px 0 #fff3d088;
}
:root #overlay.menu.wide-page .menu-sheet .settings-cols { grid-template-columns: 1fr 1fr; }
:root #overlay.menu.wide-page .menu-sheet > .start,
:root #overlay.menu.wide-page .menu-sheet > .wide:last-child { justify-self: center; min-width: min(280px, 100%); }

/* Settings sections are framed like the mockup: the heading sits on the frame line. */
:root #overlay .settings-col { position: relative; padding-top: clamp(18px, 1.6vw, 28px); margin-top: 10px; }
:root #overlay .settings-head {
  position: absolute;
  top: -0.65em;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 10px;
  background: #e8cd9b;
  white-space: nowrap;
}

/* Keeper: a grid of upgrade cards with the level and the price in seeds. */
:root #overlay.menu .menu-sheet .keeper { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 1vw, 18px); }
:root #overlay.menu .menu-sheet .keeper .upgrade { align-items: center; text-align: center; gap: 2px; padding: clamp(8px, 1vh, 14px) 6px !important; }
:root #overlay.menu .menu-sheet .keeper .upgrade .icon { --size: clamp(40px, 6vh, 74px); }
:root #overlay.menu .menu-sheet .keeper .upgrade b { font: 700 clamp(14px, 1vw, 22px)/1.1 var(--title-font); text-transform: none; }
:root #overlay.menu .menu-sheet .keeper .upgrade > span { font: 400 clamp(10px, .7vw, 15px)/1.25 var(--hud-font); color: var(--paper-muted); }
:root #overlay.menu .menu-sheet .keeper .upgrade .rank { font: 600 clamp(11px, .75vw, 16px)/1 var(--hud-font); color: var(--paper-ink); }
:root #overlay.menu .menu-sheet .keeper .upgrade .price { display: inline-flex; align-items: center; gap: 4px; font: 700 clamp(12px, .85vw, 18px)/1 var(--title-font); font-style: normal; color: #4a2c10; }
:root #overlay.menu .menu-sheet .keeper .upgrade .price .seed { --size: 1.3em; }
:root #overlay.menu .menu-sheet .keeper .upgrade:disabled { filter: grayscale(.35) brightness(.88) drop-shadow(2px 3px 0 #20150d80); }

/* Co-op: the room code on its own paper tag, the actions in a row. */
:root #overlay.menu .menu-sheet .coop { display: grid; justify-items: center; gap: 12px; }
:root #overlay.menu .menu-sheet .coop .room {
  margin: 4px 0;
  padding: 6px 36px;
  border: 16px solid transparent;
  border-image: url(assets/ui/tag.webp) 40 fill / 16px stretch;
  font: 700 clamp(40px, 4.4vw, 96px)/1 var(--hud-font);
  letter-spacing: .12em;
  color: #15160c;
  filter: drop-shadow(0 0 8px #c8ff5a77) drop-shadow(2px 4px 0 #0a0c0899);
}
:root #overlay.menu .menu-sheet .coop .lore { font: italic 400 clamp(15px, 1.15vw, 26px)/1.2 var(--title-font); color: var(--paper-ink); }
:root #overlay.menu .menu-sheet .coop .code {
  width: min(320px, 100%);
  padding: 8px 14px;
  border: 12px solid transparent;
  border-image: url(assets/ui/tag.webp) 40 fill / 12px stretch;
  background: none;
  color: #15160c;
  font: 700 clamp(26px, 2vw, 44px)/1 var(--hud-font);
  letter-spacing: .14em;
  text-align: center;
}
:root #overlay.menu .menu-sheet .coop .wide { min-width: min(260px, 100%); text-transform: uppercase; }
:root #overlay.menu .menu-sheet .coop .wide:not(.primary) {
  border: 13px solid transparent;
  border-image: url(assets/ui/btn-paper.webp) 44 fill / 13px stretch;
  background: none;
  color: var(--paper-ink);
  font: 700 clamp(14px, 1vw, 22px)/1.1 var(--hud-font);
}
:root #overlay.menu .menu-sheet .coop .notice { font: italic 400 clamp(13px, .9vw, 19px)/1.3 var(--title-font); color: #3c4a1e; }

/* ---------------------------------------------------------------- results (Gemini mockup) */
:root #overlay.result { justify-content: center; background: radial-gradient(ellipse at center, #0d140f66, #0a100ccc 75%), url(assets/grove.jpg) center / cover no-repeat; }
:root #overlay.result .result-sheet { width: min(980px, 100%); gap: clamp(10px, 1.5vh, 18px); }
:root #overlay.result .result-sheet h1 {
  margin: 0;
  font: 700 clamp(40px, 4.2vw, 96px)/1 var(--title-font);
  text-transform: uppercase;
  letter-spacing: .02em;
  background: linear-gradient(#ffd27a, #e05a2c 55%, #8f1d14);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px #2a0d07;
  filter: drop-shadow(0 0 10px #ff6a3a66) drop-shadow(2px 3px 0 #2a0d07aa);
}
:root #overlay.result.won .result-sheet h1 { background-image: linear-gradient(#fff3b0, #f0c66a 55%, #9a6a1c); filter: drop-shadow(0 0 10px #ffd96a66) drop-shadow(2px 3px 0 #3a2208aa); }
:root #overlay.result .result-sheet .motto { margin: 0; font: italic 400 clamp(18px, 1.5vw, 34px)/1.2 var(--title-font); color: var(--paper-ink); }
:root #overlay.result .result-sheet .stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(6px, .8vw, 14px); width: 100%; }
:root #overlay.result .result-sheet .stats > div { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: clamp(8px, 1vh, 14px) 4px; }
:root #overlay.result .result-sheet .stats .stat-art { --size: clamp(38px, 5vh, 70px); filter: drop-shadow(1px 3px 1px #50331d55); }
:root #overlay.result .result-sheet .stats small { font: italic 700 clamp(12px, .85vw, 19px)/1 var(--title-font); color: var(--paper-ink); opacity: 1; }
:root #overlay.result .result-sheet .stats b { font: 700 clamp(18px, 1.35vw, 30px)/1 var(--title-font); color: var(--paper-ink); }
:root #overlay.result .result-sheet .purse-note { margin: 0; font: 400 clamp(12px, .8vw, 17px)/1.3 var(--hud-font); color: var(--paper-muted); text-align: center; }
:root #overlay.result .result-sheet .primary { text-transform: uppercase; min-width: min(320px, 100%); }
@media (max-width: 700px) {
  :root #overlay.result .result-sheet .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  :root #overlay.menu .menu-sheet .keeper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root #overlay.menu.wide-page .menu-sheet .settings-cols { grid-template-columns: 1fr; }
}

/* Closer to the Gemini mockups: bigger type on the wide pages, upright keeper cards, larger result icons. */
:root #overlay.menu.wide-page .settings-head,
:root #overlay.paused .settings-head { font-size: clamp(17px, 1.45vw, 32px); }
:root #overlay.menu.wide-page .setting-label,
:root #overlay.paused .setting-label { font-size: clamp(16px, 1.3vw, 29px); }
:root #overlay.menu.wide-page .setting-value,
:root #overlay.paused .setting-value { font-size: clamp(15px, 1.15vw, 26px); }
:root #overlay.menu.wide-page .setting-choice,
:root #overlay.paused .setting-choice { font-size: clamp(15px, 1.15vw, 26px); }
:root #overlay.menu.wide-page .setting-range,
:root #overlay.paused .setting-range { height: 16px; }
:root #overlay.menu.wide-page .settings > .primary { min-width: min(320px, 100%); }
:root #overlay.menu .menu-sheet .keeper .upgrade { flex-direction: column; justify-content: flex-start; min-height: clamp(150px, 20vh, 260px); }
:root #overlay.menu .menu-sheet .keeper .upgrade .icon { --size: clamp(52px, 8vh, 96px); margin-bottom: 4px; }
:root #overlay.menu .menu-sheet .keeper .upgrade b { font-size: clamp(16px, 1.25vw, 28px); }
:root #overlay.menu .menu-sheet .keeper .upgrade .pips { width: 70%; margin: 4px auto 2px; }
:root #overlay.menu .menu-sheet .keeper .upgrade .rank { font-size: clamp(12px, .9vw, 19px); }
:root #overlay.menu .menu-sheet .keeper .upgrade .price { font-size: clamp(14px, 1vw, 22px); margin-top: auto; }
:root #overlay.result .result-sheet .stats .stat-art { --size: clamp(54px, 8vh, 100px); }
:root #overlay.result .result-sheet .stats small { font-size: clamp(15px, 1.1vw, 24px); text-transform: none; }
:root #overlay.result .result-sheet .stats b { font-size: clamp(20px, 1.6vw, 36px); }
:root #overlay.menu .menu-sheet .coop .wide { font-size: clamp(16px, 1.15vw, 26px); }
/* The icon sits on top of the keeper card, not pinned to its left edge. */
:root #overlay.menu .menu-sheet .keeper .upgrade { padding-left: 6px !important; }
:root #overlay.menu .menu-sheet .keeper .upgrade .icon { position: static; transform: none; }

/* ---------------------------------------------------------------- guardian: intro banner and health */
:root #intro {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(920px, 92vw);
  padding: 14px 30px;
  border: 22px solid transparent;
  border-image: url(assets/ui/strip.webp) 40 fill / 22px stretch;
  background: none;
  font: 700 clamp(30px, 4.6vw, 84px)/1 var(--title-font);
  letter-spacing: .04em;
  color: transparent;
  background-image: none;
  -webkit-text-stroke: 0;
  text-shadow: none;
  filter: drop-shadow(0 0 14px #b6ff3a55) drop-shadow(3px 5px 0 #0a0c08aa);
}
:root #intro::first-line { color: #241808; }
:root #intro { color: #241808; }
:root #boss {
  width: min(560px, 82vw);
  padding: 6px 14px 9px;
  border: 12px solid transparent;
  border-image: url(assets/ui/strip.webp) 40 fill / 12px stretch;
  filter: var(--ink-drop);
  font: 700 clamp(14px, 1.1vw, 24px)/1.1 var(--title-font);
  letter-spacing: .06em;
  color: #6a1712;
}
:root #boss .bar { height: 14px; border: 2px solid #1a130c; border-radius: 1px; background: #3a2b1f; margin-top: 5px; }
:root #boss .bar i { background: linear-gradient(#e0473a, #8f1d14); }

/* ---------------------------------------------------------------- phones
   The canvas follows the visible screen, not the one behind a browser's bars. */
#view { width: 100vw; height: 100vh; height: 100dvh; }
html, body { height: 100%; height: 100dvh; }

/* A phone held sideways: little height, so everything shrinks and moves to the edges. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 540px) {
  :root #hud { --hud-top: max(6px, env(safe-area-inset-top)); --hud-left: max(8px, env(safe-area-inset-left)); --hud-right: max(8px, env(safe-area-inset-right)); }
  :root #hud .vitals { width: min(240px, 30vw); padding: 4px 8px 12px 40px; border-width: 9px; border-image-width: 9px; }
  :root #hud #portrait { --size: 30px; left: 4px; }
  :root #hud .vitals .row { font-size: 12px; margin-bottom: 2px; }
  :root #hud .vitals .hp { height: 7px; }
  :root #hud .vitals .xp { height: 5px; }
  :root #hud .vitals .xp::after { font-size: 8px; }
  :root #hud .chapter {
    top: var(--hud-top);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(300px, 34vw);
    padding: 2px 6px;
    border-width: 9px;
    border-image-width: 9px;
  }
  :root #hud .chapter :is(#place, #hunt) { display: block; margin: 0; font-size: 11px; }
  :root #hud .tally { padding: 3px 6px; border-width: 9px; border-image-width: 9px; gap: 5px; font-size: 12px; }
  :root #hud #goal {
    top: calc(var(--hud-top) + 66px);
    width: min(230px, 28vw);
    padding: 2px 6px;
    border-width: 9px;
    border-image-width: 9px;
  }
  :root #hud #goal :is(b, span) { font-size: 11px; line-height: 1.25; }
  :root #hud #yaga { top: calc(var(--hud-top) + 44px); font-size: 11px; padding: 0 4px; border-width: 8px; border-image-width: 8px; }
  :root body.touch #map { top: calc(var(--hud-top) + 70px); width: 120px; height: 90px; }
  /* Abilities in an arc around the attack button in the bottom right corner. */
  :root body.touch #dash { width: 78px; height: 78px; right: max(14px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  :root body.touch #abilities {
    right: calc(max(14px, env(safe-area-inset-right)) + 86px);
    bottom: max(10px, env(safe-area-inset-bottom));
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
  }
  :root body.touch #abilities button { width: 50px; height: 50px; }
  :root body.touch #abilities #a-ult { width: 54px; height: 54px; }
  :root #hud #prompt { bottom: auto; top: 30%; }
  :root #hud #map-goal { bottom: auto; top: calc(var(--hud-top) + 166px); }
  /* Screens over the game fit the height and scroll if they must. */
  :root #overlay { overflow-y: auto; align-items: flex-start; padding: 8px; }
  :root .comic-sheet { border-width: 14px; border-image-width: 14px; }
  :root .comic-popup { gap: 6px; padding: 8px 12px; }
  :root #overlay .comic-popup h1 { font-size: 24px; margin: 0; }
  :root #overlay .wide { min-height: 36px; padding-block: 4px; font-size: 15px; }
  :root #overlay.paused .stats > div { padding: 4px; }
  :root #overlay.paused .stats b { font-size: 18px; }
  :root #overlay:is(.paused, .pick, .result) { align-items: center; }
  :root #overlay.shop { align-items: center; }
  :root #overlay.shop { justify-content: flex-start; gap: 4px; }
  :root #overlay.shop > h1 { font-size: 26px; margin: 4px 0 0; }
  :root #overlay.shop .tip-yaga { font-size: 12px; margin: 0; }
  :root #overlay.shop .cards { gap: 6px; }
  :root #overlay.shop .card { flex-basis: calc((100% - 24px) / 5); padding: 6px; }
  :root #overlay.shop .card .art { --size: 30px; }
  :root #overlay.shop .card b { font-size: 12px; }
  :root #overlay.shop .card span { font-size: 10px; }
  :root #overlay.result .result-sheet .stats .stat-art { --size: 34px; }
  /* The menu keeps the desktop arrangement: the sheet on the left, the hero art on the right. */
  :root #overlay.menu { justify-content: flex-start; align-items: flex-start; padding: 8px; background: linear-gradient(90deg, #100e0db3 0, transparent 60%); }
  :root #overlay.menu > .menu-sheet { width: min(470px, 58vw); padding: 8px 10px; gap: 4px; }
  :root #overlay.menu .menu-sheet h1 { font-size: 34px; }
  :root #overlay.menu .menu-sheet .tile .icon { --size: 34px; }
  :root body.menu.illustrated-hero::before { inset: 0 0 0 52%; height: auto; background-position: center 30%; }
  :root #overlay.menu.wide-page > .menu-sheet { width: min(760px, 100%); }
}

/* Settings: two even columns (sound and game on the left, the picture on the right), no poster shade behind. */
:root #overlay .settings-side { display: grid; align-content: start; gap: clamp(10px, 1.4vh, 18px); min-width: 0; }
:root #overlay .settings-cols { align-items: start; }
:root #overlay .setting-pair.quality { flex-wrap: wrap; gap: 6px 12px; grid-column: 1 / -1; }
:root body.menu.wide-page #overlay.menu.wide-page { background: #0d140fa6; }
/* Settings in the pause popup: a wider sheet, the picture column a little wider than sound, and rows that wrap
   instead of running off the parchment. */
:root #overlay.paused .comic-popup:has(.settings) { width: min(1120px, 94vw); max-height: 94svh; overflow-y: auto; }
:root #overlay .settings-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
:root #overlay .settings-col, :root #overlay .setting, :root #overlay .setting-label { min-width: 0; }
:root #overlay .setting-pair { flex-wrap: wrap; justify-content: flex-end; }
:root #overlay .setting-value { grid-column: 1 / -1; }
@media (max-width: 700px) { :root #overlay .settings-cols { grid-template-columns: minmax(0, 1fr); } }
:root #overlay .setting-pair.quality { justify-content: flex-start; }
/* Short screens: the pause settings tighten up so «Готово» stays on the sheet. */
@media (max-height: 820px) {
  :root #overlay.paused .comic-popup:has(.settings) { padding-block: 14px; gap: 6px; }
  :root #overlay.paused .comic-popup:has(.settings) h1 { font-size: clamp(24px, 4.2svh, 40px); margin: 0; }
  :root #overlay.paused .settings { gap: 6px; }
  :root #overlay.paused .setting { gap: 2px 10px; }
  :root #overlay.paused .setting-label { font-size: clamp(14px, 2.3svh, 22px); }
  :root #overlay.paused .setting-choice { font-size: clamp(13px, 2.1svh, 20px); }
  :root #overlay.paused .setting-hint { font-size: 11px; }
  :root #overlay.paused .settings > .primary { min-height: 0; padding-block: 8px; }
}

/* ---------------------------------------------------------------- co-op page («Вдвоём») */
:root #overlay .coop2 { display: grid; gap: clamp(10px, 1.6vh, 20px); width: 100%; color: var(--paper-ink); }
:root #overlay .coop-server { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; font: 600 clamp(13px, .9vw, 19px)/1.2 var(--hud-font); color: var(--paper-muted); }
:root #overlay .coop-server .dot { width: 10px; height: 10px; border-radius: 50%; background: #b9a777; box-shadow: 0 0 0 2px #2a2112; }
:root #overlay .coop-server.up .dot { background: #8fdc3a; box-shadow: 0 0 0 2px #2a2112, 0 0 10px #a8ff4a; animation: coop-pulse 1.8s ease-in-out infinite; }
:root #overlay .coop-server.down .dot { background: #d2553f; }
@keyframes coop-pulse { 50% { opacity: .55; } }
:root #overlay .coop-cards { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 1.6vw, 28px); }
:root #overlay .coop-card { display: grid; justify-items: center; align-content: start; gap: 10px; padding: clamp(14px, 1.4vw, 24px); border: 2px solid #2a2112; border-radius: 8px; background: #fff3d038; box-shadow: inset 0 0 0 1px #fff6, 2px 3px 0 #2a211233; }
:root #overlay .coop-card h3 { margin: 0; font: 700 clamp(18px, 1.5vw, 30px)/1.1 var(--title-font); }
:root #overlay .coop-card p { margin: 0; text-align: center; font: 400 clamp(13px, .9vw, 18px)/1.3 var(--hud-font); color: var(--paper-muted); }
:root #overlay .coop-card > .wide { width: min(100%, 300px); margin-top: auto; }
:root #overlay .coop-card .code { width: min(100%, 300px); text-align: center; font: 700 clamp(26px, 2.2vw, 42px)/1 var(--hud-font); letter-spacing: .3em; text-transform: uppercase; }
:root #overlay .coop-hero { display: grid; justify-items: center; gap: 3px; }
:root #overlay .coop-face { width: clamp(84px, 7.4vw, 140px); aspect-ratio: 1; overflow: hidden; display: grid; place-items: center; border: 3px solid #2a2112; border-radius: 10px; background: #3a2f1c; box-shadow: 2px 3px 0 #2a211255; }
:root #overlay .coop-face .art { width: 100%; height: 100%; background: center 18% / cover no-repeat; }
:root #overlay .coop-face .portrait-fox { background-image: url(assets/ui/menu/portrait-fox.webp); }
:root #overlay .coop-face .portrait-badger { background-image: url(assets/ui/menu/portrait-badger.webp); }
:root #overlay .coop-face > b { font: 700 48px/1 var(--title-font); color: #e8d9b0; }
:root #overlay .coop-hero.waiting .coop-face { border-style: dashed; animation: coop-pulse 1.6s ease-in-out infinite; }
:root #overlay .coop-hero > b { font: 700 clamp(15px, 1.1vw, 22px)/1.1 var(--title-font); }
:root #overlay .coop-hero > small { font: 600 clamp(12px, .8vw, 16px)/1 var(--hud-font); color: var(--paper-muted); text-transform: uppercase; letter-spacing: .04em; }
:root #overlay .coop-room { display: grid; justify-items: center; gap: 8px; }
:root #overlay .coop-room > small { font: 600 clamp(12px, .85vw, 17px)/1 var(--hud-font); text-transform: uppercase; letter-spacing: .12em; color: var(--paper-muted); }
:root #overlay .coop-code { display: flex; gap: clamp(5px, .5vw, 10px); }
:root #overlay .coop-code span { display: grid; place-items: center; width: clamp(40px, 3.4vw, 64px); aspect-ratio: .82; border: 2px solid #2a2112; border-radius: 6px; background: #fff7df; box-shadow: 2px 3px 0 #2a211244; font: 700 clamp(26px, 2.4vw, 46px)/1 var(--hud-font); color: #1c1a10; }
:root #overlay .coop-copy { padding: 6px 16px; border: 2px solid #2a2112; border-radius: 6px; background: #f2e2b6; font: 600 clamp(12px, .85vw, 16px)/1 var(--hud-font); text-transform: uppercase; cursor: pointer; }
:root #overlay .coop-pair { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 2vw, 40px); }
:root #overlay .coop-plus { font: 700 clamp(26px, 2vw, 40px)/1 var(--title-font); color: var(--paper-muted); font-style: normal; }
:root #overlay .coop-go { justify-self: center; min-width: min(300px, 100%); }
:root #overlay .coop2 .notice { margin: 0; text-align: center; font: 600 clamp(13px, .95vw, 19px)/1.3 var(--hud-font); }
:root #overlay .coop2 .notice.bad { color: #a3321f; }
:root #overlay .coop2 .notice.wait { color: #6b5418; }
@media (max-width: 700px) { :root #overlay .coop-cards { grid-template-columns: 1fr; } }
/* The strip over a shared run when the link is down or the room has closed. */
#net-banner { position: fixed; top: 12px; left: 50%; z-index: 40; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 8px 18px; border: 2px solid #2a2112; border-radius: 8px; background: #f3e2b5f0; color: #2a2112; font: 600 15px/1.2 'Oswald', sans-serif; box-shadow: 0 4px 16px #0008; }
#net-banner[hidden] { display: none; }
#net-banner.bad { background: #f1c7b5f0; }
#net-banner button { padding: 5px 12px; border: 2px solid #2a2112; border-radius: 5px; background: #b9f34f; font: inherit; cursor: pointer; }
#net-banner button[hidden] { display: none; }
:root #overlay .coop-copies { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
:root #overlay .coop-copies .coop-copy:last-child { background: #b9f34f; }

/* Settings → «Сеть»: label and value rows, the value coloured by how good it is. */
:root #overlay .net-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; color: var(--paper-ink); }
:root #overlay .net-info dt { font: 700 clamp(13px, .9vw, 19px)/1.25 var(--title-font); }
:root #overlay .net-info dd { margin: 0; text-align: right; font: 600 clamp(13px, .85vw, 18px)/1.25 var(--hud-font); }
:root #overlay .net-info dd.net-good { color: #2f6d12; }
:root #overlay .net-info dd.net-fair { color: #8a5a00; }
:root #overlay .net-info dd.net-bad { color: #a3321f; }
:root #overlay .net-info dd.net-good::before, :root #overlay .net-info dd.net-fair::before, :root #overlay .net-info dd.net-bad::before { content: '\25CF'; margin-right: 6px; font-size: .8em; }
:root #overlay .coop-where { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; font: 700 clamp(14px, 1vw, 20px)/1.2 var(--title-font); color: var(--paper-ink); }
:root #overlay .coop-hint { margin: -4px auto 0; max-width: 46em; text-align: center; font: 400 clamp(12px, .85vw, 17px)/1.3 var(--hud-font); color: var(--paper-muted); }
