/* site.css - the 1920 x 1080 stage and its DOM layers (Web/DESIGN_RC291.md 5.1, 5.5 to 5.7). Everything inside
   #stage-wrap is positioned in stage pixels; main.js scales the wrap with transform: scale(s) and letterboxes it.
   Text anchors: .c-x centres on (left, top), .l-x starts at left, .r-x ends at left; top is the glyph centre line. */

@font-face { font-family: "HN Roman"; src: url("../assets/fonts/HelveticaNeueLTPro-Roman.otf") format("opentype"); font-display: block; }
@font-face { font-family: "HN Bd"; src: url("../assets/fonts/HelveticaNeueLTPro-Bd.otf") format("opentype"); font-display: block; }
@font-face { font-family: "HN Bold"; src: url("../assets/fonts/HelveticaNeueBold.otf") format("opentype"); font-display: block; }

:root {
  --roman: "HN Roman", "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --bd: "HN Bd", "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --bold: "HN Bold", "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --ink: #FFFFFF;
  --gold: #FFEC00;
  --glyph-dy: 0.14em;        /* Roman: CSS line box centre to cap-glyph centre, measured against REF shot 1 */
  --glyph-dy-bold: 0.11em;   /* HelveticaNeueBold, same measure */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
  color: var(--ink);
  font-family: var(--roman);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; overflow: hidden; background: #000; }

#stage-wrap {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  overflow: hidden;
  touch-action: none;
}
#app.crop #stage-wrap { overflow: visible; }

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}

[hidden] { display: none !important; }
@media (pointer: fine) { .pause-btn { display: none; } }

/* ------------------------------------------------------------ text anchors */

.t-roman { font-family: var(--roman); font-weight: 400; }
.t-bold { font-family: var(--bold); font-weight: 700; }
.c-x, .l-x, .r-x {
  position: absolute;
  margin: 0;
  font-size: 32px;
  line-height: 1;
  white-space: nowrap;
}
.c-x { transform: translate(-50%, calc(-50% + var(--glyph-dy))); }
.t-bold.c-x { transform: translate(-50%, calc(-50% + var(--glyph-dy-bold))); }
.l-x { transform: translate(0, calc(-50% + var(--glyph-dy))); }
.r-x { transform: translate(-100%, calc(-50% + var(--glyph-dy))); }
.small { font-size: 21.33px; }
.big { font-size: 56px; }

/* ------------------------------------------------------------ HUD (5.5) */

#hud, #judgments { position: absolute; inset: 0; pointer-events: none; }

/* REF shots: every HUD text carries a 1 px black outline (UMG font outline); a 2 px centred stroke painted under the fill. */
#hud .c-x, #hud .l-x, #preview-text { -webkit-text-stroke: 2px #000; paint-order: stroke fill; }
#hud-title { left: 960px; top: 96px; }
/* REF shot 1: SCORE: spans x 834..947 and MULTI: 843..940, so the labels are centred on x 891 (SCORE:'s right edge
   is the design's 950); values start at x 988. */
#hud-score-label { left: 891px; top: 143px; }
#hud-score { left: 988px; top: 143px; }
#hud-multi-label { left: 891px; top: 182px; }
#hud-multi { left: 988px; top: 182px; }
#hud-multi.gold { color: var(--gold); }
#preview-text { left: 1410px; top: 103px; pointer-events: none; }
#hud-accuracy { left: 1410px; top: 133px; }
#hud-best-combo { left: 1410px; top: 163px; }
#hud-current-combo { left: 1410px; top: 205px; }
#hud-countdown { left: 960px; top: 221px; font-family: var(--bold); font-weight: 700; }
#hud-charge-bar { position: absolute; left: 780px; top: 278px; width: 360px; height: 6px; overflow: hidden; }
#hud-charge-fill { width: 100%; height: 100%; background: var(--gold); transform-origin: 0 50%; transform: scaleX(0); }
#hud-charge-text, #hud-perf-text { left: 960px; top: 301px; font-size: 21.33px; }

#app.crop #hud .l-x, #app.crop #preview-text { left: 700px; }
#app.crop #hud-accuracy { top: 240px; }
#app.crop #hud-best-combo { top: 270px; }
#app.crop #hud-current-combo { top: 300px; }
#app.crop #preview-text { top: 66px; }

.judg {
  position: absolute;
  top: 960px;
  width: 151px;
  height: 40px;
  margin-left: -75.5px;
  margin-top: -20px;
  line-height: 40px;
  text-align: center;
  font-size: 21.33px;
  white-space: nowrap;
  visibility: hidden;
  -webkit-text-stroke: 1px var(--judg-outline, rgba(0, 0, 0, 0.7));
  paint-order: stroke fill;
}
.judg.show { visibility: visible; }

.pause-btn {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: calc(8px + var(--safe-left));
  width: 44px;
  height: 44px;
  border: 2px solid #F5F4FA;
  background: rgba(0, 0, 0, 0.45);
  color: #F5F4FA;
  font: 700 16px var(--bd);
  cursor: pointer;
}

/* ------------------------------------------------------------ screens (5.6) */

.screen { position: absolute; inset: 0; }
.screen.dim { background: rgba(0, 0, 0, 0.65); }
.screen.pause { background: rgba(0, 0, 0, 0.65); -webkit-backdrop-filter: blur(var(--pause-blur, 4px)); backdrop-filter: blur(var(--pause-blur, 4px)); }
.screen.solid { background: #000; }
.screen.passthrough { background: transparent; pointer-events: none; }
.screen.passthrough .gbtn { pointer-events: auto; }

.gbtn {
  position: absolute;
  left: 560px;
  width: 800px;
  height: 40px;
  padding: 0;
  border: 4px solid #F5F4FA;
  border-radius: 0;
  background-color: #791408;
  background-image: var(--grain, none);
  color: #F5F4FA;
  padding-top: 3px;
  font: 32px/32px var(--bd);
  cursor: pointer;
  touch-action: manipulation;
}
.gbtn:hover { background-color: #8E4F3A; }
.gbtn:active { background-color: #3D0A04; }
.gbtn:disabled { background-color: #3C3C3C; border-color: #A0A0A5; cursor: progress; }
.gbtn:focus-visible, .pause-btn:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.fine {
  position: absolute;
  left: 560px;
  width: 800px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 32px;
}
.fine input { flex: 1; height: 40px; accent-color: #791408; }
.fine output { min-width: 120px; text-align: right; font-variant-numeric: tabular-nums; }

.cta { font-size: 21.33px; }
.cta a { color: #DBB88D; }
.draft-tag { margin-left: 10px; padding: 0 6px; border: 1px solid #DBB88D; font-size: 16px; text-transform: uppercase; }

.res-col-label, .res-col-value { position: absolute; }

.errbox { position: absolute; left: 360px; top: 300px; width: 1200px; font: 24px var(--roman); }
.error-text { white-space: pre-wrap; font-size: 20px; color: #EE8A88; }
h2[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.debug {
  position: absolute;
  left: calc(6px + var(--safe-left));
  top: calc(62px + var(--safe-top));
  max-width: min(560px, 96vw);
  margin: 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #B8F5C8;
  font: 10px/1.3 ui-monospace, Consolas, "Courier New", monospace;
  white-space: pre;
  overflow: hidden;
  pointer-events: none;
}

.file-warning {
  position: fixed;
  inset: 16px;
  margin: auto;
  height: fit-content;
  max-width: 640px;
  padding: 18px;
  background: #1A1410;
  border: 1px solid #6D5C46;
  color: #F5F4FA;
  font: 15px/1.5 var(--roman);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
