/* OPERATION NAPKIN - core styles (play/css/core-02.css). Owner: CORE.
   Page skeleton, arena/HUD containers, touch sticks + buttons, the sound control, toasts/banners and the
   fallback screens (fb-*). Module styles live in css/<module>-01.css (one owner per file). */

/* == core: fonts (self-hosted, same files as the main site) == */
@font-face {
  font-family: "Anton";
  src: url("../../assets/fonts/anton-latin-400-normal-01.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Special Elite";
  src: url("../../assets/fonts/special-elite-latin-400-normal-01.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

/* == core: tokens == */
:root {
  --ink: #0B0907; --panel: #16110D; --panel-2: #211913; --cream: #F7ECD8; --muted: #B9A88F;
  --batter: #F2B233; --crust: #B8651B; --grease: #FFE7A3; --ketchup: #E2332B; --teal: #7FB3AC;
  --manila: #E9D4A3; --manila-ink: #2A2017; --steel: #9AA3A8;
  --f-display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --f-type: "Special Elite", "Courier New", Courier, monospace;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-meme: Impact, Haettenschweiler, "Anton", "Arial Narrow Bold", sans-serif;
  /* set by core-01.js on every layout: arena rect, scale, touch top bar, touch zone */
  --ax: 0px; --ay: 0px; --aw: 960px; --ah: 576px; --as: 1; --topbar: 0px;
  --zx: 0px; --zy: 0px; --zw: 0px; --zh: 0px;
  color-scheme: dark;
}

/* == core: page == */
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: var(--ink); color: var(--cream);
  font-family: var(--f-body); font-size: 16px; line-height: 1.4;
  overflow: hidden; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
*, *::before, *::after { box-sizing: border-box; }
#game {
  position: fixed; left: 0; top: 0; display: block;
  background: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none;
  outline: none;
}
#touch {
  position: fixed; z-index: 1; display: none; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#ui { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
#ui button, #ui a, #ui input, #ui select, #ui [tabindex], .mtn-screen, .mtn-sound { pointer-events: auto; }
.noscript { padding: 24px; font-family: var(--f-type); }
.noscript a { color: var(--batter); }

/* the HUD container sits exactly over the arena; children may position in % of the arena */
.mtn-arena { position: absolute; pointer-events: none; overflow: hidden; font-size: calc(16px * var(--as)); }
.mtn-topbar {
  position: absolute; left: 0; right: 0; top: 0; height: var(--topbar); display: none;
  align-items: center; justify-content: flex-end; gap: 8px; padding: 0 8px;
  background: rgba(11, 9, 7, 0.86); border-bottom: 1px solid rgba(247, 236, 216, 0.08);
}
html.mtn-touch .mtn-topbar { display: flex; }

/* == core: buttons and focus == */
.mtn-btn {
  min-width: 44px; min-height: 44px; padding: 8px 16px;
  font: 400 18px/1.1 var(--f-display); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink); background: var(--batter); border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 3px 0 var(--crust); cursor: pointer;
}
.mtn-btn:hover { filter: brightness(1.06); }
.mtn-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--crust); }
.mtn-btn:focus-visible, .mtn-sound-btn:focus-visible, .mtn-sound-vol:focus-visible, .mtn-backlink:focus-visible {
  outline: 3px solid var(--teal); outline-offset: 3px;
}
.mtn-backlink {
  display: inline-block; min-height: 44px; padding: 12px 8px; color: var(--grease);
  font: 14px/1.2 var(--f-type); text-decoration: none;
}
.mtn-backlink:hover { text-decoration: underline; }

/* == core: screens (menus, overlays) == */
.mtn-screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  background: rgba(11, 9, 7, 0.82); touch-action: pan-y;
  z-index: 0; isolation: isolate;   /* own stacking context: positioned children of a lower screen never draw over a later screen */
}

/* == core: the sound control (the only way to turn sound on, rule R5) == */
.mtn-sound { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.mtn-sound-btn {
  min-width: 44px; min-height: 44px; padding: 6px 12px; border-radius: 22px; cursor: pointer;
  font: 400 16px/1 var(--f-display); letter-spacing: 0.04em; color: var(--cream);
  background: var(--panel-2); border: 2px solid rgba(247, 236, 216, 0.25);
}
.mtn-sound.on .mtn-sound-btn { border-color: var(--batter); color: var(--grease); }
.mtn-sound-vol { width: 112px; min-height: 44px; accent-color: var(--batter); cursor: pointer; background: transparent; }
.mtn-sound.compact .mtn-sound-vol { width: 96px; }
.mtn-sound-hint { flex-basis: 100%; text-align: center; font: 13px/1.3 var(--f-type); color: var(--muted); }

/* == core: toasts and banners == */
.mtn-toasts {
  position: absolute; left: 50%; top: calc(var(--ay) + var(--ah) * 0.70); transform: translateX(-50%);   /* integrator: was 0.14, right under the ORDER UP / floor banners */
  display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 6; width: min(92vw, 520px);
}
.mtn-toast {
  padding: 8px 14px; border-radius: 10px; background: rgba(11, 9, 7, 0.88); border: 1px solid rgba(242, 178, 51, 0.5);
  font: 14px/1.3 var(--f-type); color: var(--cream); text-align: center; transition: opacity .35s, transform .35s;
}
.mtn-toast.out { opacity: 0; transform: translateY(-6px); }
.mtn-banner {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%); width: 92%;
  text-align: center; pointer-events: none; animation: mtn-pop .28s ease-out both;
}
.mtn-banner.out { animation: mtn-out .4s ease-in both; }
.mtn-banner-title {
  font: 400 calc(48px * var(--as)) / 1 var(--f-display); letter-spacing: 0.03em; color: var(--grease);
  -webkit-text-stroke: calc(2px * var(--as)) var(--ink); paint-order: stroke fill;
  text-shadow: 0 calc(3px * var(--as)) 0 var(--ink), 0 0 calc(18px * var(--as)) rgba(242, 178, 51, 0.35);
}
.mtn-banner-sub {
  margin-top: calc(6px * var(--as)); font: calc(20px * var(--as)) / 1.2 var(--f-type); color: var(--cream);
  text-shadow: 0 2px 0 var(--ink), 0 0 6px var(--ink);
}
.mtn-banner.floor .mtn-banner-title { color: var(--cream); }
@keyframes mtn-pop { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes mtn-out { to { opacity: 0; transform: translateX(-50%) translateY(-8px); } }

/* == core: touch sticks and buttons (GDD 3.4) == */
.mtn-stick {
  position: absolute; width: 112px; height: 112px; border-radius: 50%;
  border: 2px solid rgba(247, 236, 216, 0.35); background: rgba(11, 9, 7, 0.25); pointer-events: none;
}
.mtn-stick.aim { border-color: rgba(242, 178, 51, 0.5); }
/* integrator: faint hints where the floating sticks live (portrait touch, until both sticks were used a few times) */
.mtn-zone-hint { position: absolute; top: 42%; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 2px dashed rgba(247, 236, 216, 0.22); display: none; align-items: center; justify-content: center; text-align: center; pointer-events: none; font: 400 14px/1.15 var(--f-display); letter-spacing: 0.04em; color: rgba(247, 236, 216, 0.38); }
.mtn-zone-hint.move { left: 25%; }
.mtn-zone-hint.aim { left: 75%; border-color: rgba(242, 178, 51, 0.28); color: rgba(242, 178, 51, 0.5); }
html.mtn-touch.mtn-portrait #touch.hints .mtn-zone-hint { display: flex; }
html.mtn-touch.mtn-portrait #touch.hints.hubhint .mtn-zone-hint.aim { display: none; }
html.mtn-lefthanded .mtn-zone-hint.move { left: 75%; }
html.mtn-lefthanded .mtn-zone-hint.aim { left: 25%; }
.mtn-stick-knob {
  position: absolute; left: 32px; top: 32px; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(247, 236, 216, 0.55); border: 2px solid rgba(11, 9, 7, 0.6);
}
.mtn-stick.aim .mtn-stick-knob { background: rgba(242, 178, 51, 0.7); }
.mtn-tbtn {
  --cd: 0; --charge: 0; --r: 24px; --b: 24px;
  position: absolute; right: var(--r); bottom: calc(var(--b) + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: rgba(22, 17, 13, 0.82); border: 2px solid rgba(242, 178, 51, 0.7);
  color: var(--cream); font: 400 13px/1 var(--f-display); letter-spacing: 0.05em;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
html.mtn-lefthanded .mtn-tbtn { right: auto; left: var(--r); }
html.mtn-touch:not(.mtn-portrait) .mtn-tbtn { opacity: 0.55; }
.mtn-tbtn::before {      /* cooldown: the remaining part darkens */
  content: ""; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(rgba(11, 9, 7, 0.72) calc(var(--cd) * 360deg), transparent 0);
}
.mtn-tbtn::after {       /* charge ring */
  content: ""; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--batter) calc(var(--charge) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%); mask: radial-gradient(circle, transparent 62%, #000 64%);
  opacity: 0.9;
}
.mtn-tbtn.down { background: rgba(242, 178, 51, 0.35); transform: scale(0.94); }
.mtn-tbtn.disabled { opacity: 0.35; }
.mtn-tbtn.pulse { animation: mtn-pulse 0.9s ease-in-out infinite; }
.mtn-tbtn-label { position: relative; z-index: 1; pointer-events: none; }
.mtn-tbtn-badge {
  position: absolute; right: -4px; top: -4px; min-width: 18px; padding: 0 4px; border-radius: 9px; z-index: 2;
  background: var(--ketchup); color: var(--cream); font: 12px/18px var(--f-display); text-align: center;
}
.mtn-tbtn-badge:empty { display: none; }
@keyframes mtn-pulse { 50% { box-shadow: 0 0 0 6px rgba(242, 178, 51, 0.35); } }

/* == core: fallback screens (core-fallbacks-01.js; the meta module replaces these) == */
.mtn-screen-title {
  background:
    linear-gradient(rgba(11, 9, 7, 0.62), rgba(11, 9, 7, 0.9)),
    url("../../assets/scene-nightshift-01.webp") center / cover no-repeat, var(--ink);
  justify-content: flex-start;
}
.mtn-screen-title > .mtn-backlink { align-self: flex-start; }
.fb-title { width: min(100%, 760px); margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.fb-logo { margin: 0; position: relative; line-height: 1; }
.fb-logo-main {
  display: block; font: 400 clamp(40px, 9vw, 84px)/0.95 var(--f-display); letter-spacing: 0.02em; color: var(--cream);
  text-shadow: 0 4px 0 var(--ink), 0 0 24px rgba(242, 178, 51, 0.25);
}
.fb-stamp {
  display: inline-block; margin-top: 6px; padding: 2px 12px; transform: rotate(-8deg);
  font: 400 clamp(18px, 4vw, 28px)/1.2 var(--f-display); letter-spacing: 0.08em; color: var(--ketchup);
  border: 3px solid var(--ketchup); border-radius: 6px; background: rgba(11, 9, 7, 0.4);
}
.fb-tag { margin: 0; font: clamp(14px, 3.4vw, 18px)/1.3 var(--f-type); color: var(--grease); }
.fb-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.fb-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px 12px;
  background: rgba(22, 17, 13, 0.9); color: var(--cream); border: 2px solid rgba(247, 236, 216, 0.2);
  box-shadow: 0 4px 0 var(--ink); border-radius: 14px; text-transform: none;
}
.fb-card:hover, .fb-card.preselected { border-color: var(--batter); }
.fb-card.preselected { box-shadow: 0 0 0 3px rgba(242, 178, 51, 0.35), 0 4px 0 var(--ink); }
.fb-card-img { width: auto; height: clamp(110px, 24vh, 190px); max-width: 100%; object-fit: contain; pointer-events: none; }
.fb-card-name { font: 400 clamp(17px, 4vw, 24px)/1.05 var(--f-display); letter-spacing: 0.03em; color: var(--batter); }
.fb-card-goal { font: clamp(12px, 2.8vw, 14px)/1.25 var(--f-type); color: var(--cream); }
.fb-diff { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.fb-diff-btn { background: var(--panel-2); color: var(--cream); border-color: rgba(247, 236, 216, 0.25); box-shadow: none; font-size: 15px; }
.fb-diff-btn[aria-pressed="true"] { background: var(--batter); color: var(--ink); border-color: var(--ink); }
.fb-sound { margin-top: 4px; }
.fb-note { margin: 0; font: 12px/1.3 var(--f-type); color: var(--muted); }
.fb-dim { background: rgba(11, 9, 7, 0.72); }
.fb-panel {
  width: min(100%, 460px); margin: auto; padding: 22px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: rgba(22, 17, 13, 0.94); border: 2px solid rgba(242, 178, 51, 0.35); border-radius: 16px; box-shadow: 0 8px 0 var(--ink);
}
.fb-h { margin: 0; font: 400 clamp(32px, 8vw, 52px)/1 var(--f-display); letter-spacing: 0.03em; color: var(--cream); }
.fb-dead { color: var(--grease); }
.fb-sub { margin: 0; font: 16px/1.35 var(--f-type); color: var(--cream); }
.fb-killer { margin: 0; font: 400 20px/1.1 var(--f-display); letter-spacing: 0.05em; color: var(--ketchup); }
.fb-foot { margin: 0; font: 12px/1.4 var(--f-type); color: var(--muted); }
.fb-row { display: flex; gap: 10px; justify-content: center; width: 100%; }
.fb-wide { min-width: 160px; }
.fb-row .fb-wide { min-width: 0; flex: 1 1 0; }

/* fallback HUD (the combat module's HUD replaces it) */
.fb-hud { position: absolute; inset: 0; pointer-events: none; }
.fb-hud-left { position: absolute; left: 1.2%; top: 1.6%; display: flex; flex-direction: column; gap: 0.3em; }
.fb-hearts { display: flex; flex-wrap: wrap; gap: 0.22em; max-width: 40vw; }
.fb-heart {
  width: 1.3em; height: 1.3em; border-radius: 0.28em; border: 0.12em solid var(--ink);
  background: var(--cream); box-shadow: 0 0.12em 0 rgba(0, 0, 0, 0.5);
}
.fb-heart.monkey { background: var(--batter); border-radius: 45% 45% 40% 40%; }
.fb-heart.crouton { background: #E8C48A; border-radius: 0.15em; }
.fb-heart.half { background-image: linear-gradient(90deg, transparent 50%, rgba(11, 9, 7, 0.85) 50%); }
.fb-heart.empty { background: rgba(11, 9, 7, 0.65); border-color: rgba(247, 236, 216, 0.4); }
.fb-crumbs { font: 400 1.05em/1 var(--f-display); letter-spacing: 0.04em; color: var(--grease); text-shadow: 0 0.1em 0 var(--ink), 0 0 0.3em var(--ink); }
.fb-hud-right { position: absolute; right: 1.2%; top: 1.2%; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.mtn-topbar .fb-hud-right { position: static; }
.fb-pause { padding: 4px 10px; font-size: 18px; background: var(--panel-2); color: var(--cream); border-color: rgba(247, 236, 216, 0.25); box-shadow: none; }

@media (max-width: 420px) {
  .fb-cards { gap: 8px; }
  .fb-wide { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mtn-banner, .mtn-banner.out, .mtn-tbtn.pulse { animation: none; }
  .mtn-toast { transition: none; }
}

/* == finisher (core-03): toasts raised during play never sit on top of a DOM screen (pause, settings, boon picker, report); toasts raised by a screen still show == */
#ui:has(> .mtn-screen) > .mtn-toasts > .mtn-toast.play { visibility: hidden; }
.mtn-toasts { pointer-events: none; }
/* portrait phones: the arena is a short strip, so toasts go just below it into the control zone instead of over the fight */
html.mtn-touch.mtn-portrait .mtn-toasts { top: calc(var(--ay) + var(--ah) + 10px); width: min(88vw, 420px); }
html.mtn-touch.mtn-portrait .mtn-toast { font-size: 13px; padding: 6px 10px; background: rgba(11, 9, 7, 0.72); }
/* portrait phones: suggest landscape while the first-use hints are up (the room is drawn at ~0.4 scale in portrait) */
html.mtn-touch.mtn-portrait #touch.hints::after {
  content: "\21BB  Turn your phone sideways for a bigger kitchen."; position: absolute; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 46%; font: 13px/1.3 var(--f-type); color: rgba(247, 236, 216, 0.55); pointer-events: none;
}
html.mtn-touch.mtn-portrait.mtn-lefthanded #touch.hints::after { left: auto; right: 16px; text-align: right; }
/* landscape phones: the button arc sat over the arena's east wall and door. One column centred in the side margin instead
   (--ax = the arena's left offset = the margin width; on very narrow margins they still overlap a little, at 55 % opacity). */
html.mtn-touch:not(.mtn-portrait) .mtn-tbtn-dash { --r: max(2px, calc(var(--ax) / 2 - 38px)) !important; --b: 18px !important; }
html.mtn-touch:not(.mtn-portrait) .mtn-tbtn-special { --r: max(4px, calc(var(--ax) / 2 - 30px)) !important; --b: 106px !important; }
html.mtn-touch:not(.mtn-portrait) .mtn-tbtn-active { --r: max(6px, calc(var(--ax) / 2 - 28px)) !important; --b: 176px !important; }
html.mtn-touch:not(.mtn-portrait) .mtn-tbtn-popcorn { --r: max(8px, calc(var(--ax) / 2 - 24px)) !important; --b: 242px !important; }
html.mtn-touch:not(.mtn-portrait) .mtn-tbtn-sauce { --r: max(8px, calc(var(--ax) / 2 - 22px)) !important; --b: 300px !important; }
