@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url(../vendor/fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url(../vendor/fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 800; font-display: swap; src: url(../vendor/fonts/barlow-condensed-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 900; font-display: swap; src: url(../vendor/fonts/barlow-condensed-latin-900-normal.woff2) format('woff2'); }

:root {
  --ink: #0a1628;
  --panel: rgba(9, 20, 38, 0.8);
  --panel-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --muted: #bdd0e6;
  --yellow: #ffd23f;
  --orange: #ff7a1a;
  --teal: #19c3b1;
  --pink: #ff4f9a;
  --red: #ff3b4a;
  --green: #3ee07a;
  --r: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text);
  font-family: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif; font-weight: 700;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: none;
}
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 80% 75% at 50% 45%, rgba(0,0,0,0) 65%, rgba(20,40,80,0.18) 100%); }
#cam { position: fixed; width: 2px; height: 2px; opacity: 0; pointer-events: none; left: 0; top: 0; }
.hidden { display: none !important; }
.ic { width: 1.1em; height: 1.1em; fill: currentColor; flex: none; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

#hand { position: fixed; left: 0; top: 0; width: 13vh; height: 13vh; margin: -6.5vh 0 0 -6.5vh; z-index: 300; pointer-events: none;
  display: none; will-change: transform; }
#hand.on { display: block; }
#hand .ring { position: absolute; inset: 0; border-radius: 50%; --p: 0;
  background: conic-gradient(var(--yellow) calc(var(--p) * 360deg), rgba(255,255,255,.28) 0);
  -webkit-mask: radial-gradient(circle, transparent 57%, #000 59%); mask: radial-gradient(circle, transparent 57%, #000 59%);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
#hand .palm { position: absolute; inset: 22%; width: 56%; height: 56%; fill: rgba(10,30,70,.55); stroke: #fff; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); transition: transform .15s var(--ease); }
#hand.armed .palm { transform: scale(1.12); stroke: var(--yellow); }
.hand-hover { outline: 4px solid var(--yellow) !important; outline-offset: 4px; transform: scale(1.04); }
.hand-hint { margin: 0; font-size: clamp(13px, 3.2vh, 26px); color: #fff; font-weight: 600; text-shadow: 0 2px 8px rgba(0,20,60,.6); }
.small-hint { font-size: clamp(12px, 3vh, 24px); opacity: .8; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.08); border-radius: 999px; padding: 4px; }
.stepper button { min-width: max(44px, 9vh); min-height: max(40px, 8.5vh); border: 0; border-radius: 999px; background: rgba(255,255,255,.12);
  font-size: clamp(18px, 4.6vh, 38px); font-weight: 900; cursor: pointer; color: #fff; touch-action: manipulation; }
.stepper output { min-width: 3.2em; text-align: center; font-size: clamp(16px, 4.2vh, 36px); font-weight: 800; font-variant-numeric: tabular-nums; }
#flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 30;
  background: radial-gradient(ellipse at center, rgba(255, 60, 60, 0) 35%, rgba(255, 40, 60, 0.75) 100%); }
#flash.on { animation: flash .6s var(--ease); }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10;
  padding: max(2.4vh, env(safe-area-inset-top)) max(2.4vw, env(safe-area-inset-right)) max(2.4vh, env(safe-area-inset-bottom)) max(2.4vw, env(safe-area-inset-left)); }
.hud-tl, .hud-tr, .hud-bl, .hud-br, .hud-tc { position: absolute; display: flex; gap: 1.2vh; }
.hud-tl { top: 2.4vh; left: 2.4vw; flex-direction: column; align-items: flex-start; }
.hud-tr { top: 2.4vh; right: 2.4vw; align-items: center; }
.hud-tc { top: 2.4vh; left: 50%; transform: translateX(-50%); }
.hud-bl { bottom: 2.4vh; left: 2.4vw; flex-direction: column; align-items: flex-start; }
.hud-br { bottom: 2.4vh; right: 2.4vw; flex-direction: column; align-items: flex-end; }
.score { font-size: clamp(34px, 11vh, 120px); font-weight: 900; line-height: .9; letter-spacing: .01em;
  text-shadow: 0 .06em 0 rgba(0,0,0,.35), 0 0 .4em rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: .35em; padding: .18em .6em; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); font-size: clamp(18px, 5.4vh, 56px); font-weight: 800;
  font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pill .ic { width: 1em; height: 1em; }
.mult { color: var(--yellow); }
.speed { font-size: clamp(14px, 3.6vh, 38px); }
.hearts { display: flex; gap: .5vh; }
.hearts svg { width: clamp(22px, 6.5vh, 64px); height: clamp(22px, 6.5vh, 64px); fill: var(--red);
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); transition: transform .25s var(--ease), opacity .25s; }
.hearts svg.off { fill: rgba(255,255,255,.22); transform: scale(.82); }
.icon-btn { pointer-events: auto; width: clamp(44px, 10vh, 72px); height: clamp(44px, 10vh, 72px); border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; }
.icon-btn .ic { width: 45%; height: 45%; }
#pip { width: auto; height: clamp(90px, 26vh, 260px); border-radius: 12px; border: 2px solid rgba(255,255,255,.35);
  background: #000; display: block; }
.lanebar { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%;
  height: clamp(10px, 2.4vh, 22px); }
.lanebar i { border-radius: 6px; background: rgba(255,255,255,.18); transition: background .15s; }
.lanebar i.on { background: var(--yellow); }
.lanebar b { position: absolute; top: 50%; width: clamp(10px, 2.4vh, 22px); height: clamp(10px, 2.4vh, 22px);
  border-radius: 50%; background: #fff; border: 3px solid var(--ink); transform: translate(-50%, -50%); left: 50%; }
.moves { display: flex; gap: .8vh; align-items: center; }
.moves span { font-size: clamp(11px, 2.8vh, 24px); font-weight: 800; letter-spacing: .06em; padding: .15em .55em; border-radius: 999px;
  background: var(--panel); color: rgba(255,255,255,.5); border: 1px solid var(--line); transition: background .1s, color .1s; }
.moves span.on { background: var(--green); color: var(--ink); border-color: transparent; }
#mv-jump.on { background: var(--yellow); }
#mv-squat.on { background: var(--pink); color: #fff; }
.moves .fps { background: none; border: 0; padding: 0 .2em; color: rgba(255,255,255,.75); font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.cad { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: .8vh 1.6vh 1.2vh;
  min-width: clamp(110px, 24vh, 240px); text-align: right; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cad .lbl { font-size: clamp(11px, 2.6vh, 24px); color: var(--muted); letter-spacing: .08em; }
.cad .val { font-size: clamp(26px, 8vh, 84px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.meter { height: clamp(6px, 1.4vh, 12px); border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; margin-top: .6vh; }
#cad-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--green), var(--yellow));
  transition: width .3s var(--ease); }
.hint { font-size: clamp(22px, 7vh, 72px); font-weight: 900; letter-spacing: .06em; padding: .1em .7em; border-radius: 999px;
  background: var(--yellow); color: var(--ink); opacity: 0; transform: translateY(-20%) scale(.9);
  transition: opacity .15s, transform .15s var(--ease); box-shadow: 0 .12em 0 rgba(0,0,0,.25); }
.hint.show { opacity: 1; transform: none; }
.hint.move { background: var(--teal); color: #fff; }
.hint.duck { background: var(--pink); color: #fff; }

.msg { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.6); z-index: 20; pointer-events: none;
  font-size: clamp(56px, 26vh, 300px); font-weight: 900; line-height: .9; color: var(--yellow); opacity: 0; white-space: nowrap;
  -webkit-text-stroke: .04em var(--ink); paint-order: stroke fill; text-shadow: 0 .06em 0 var(--ink); }
.msg.show { animation: pop .9s var(--ease) forwards; }
.msg.small { font-size: clamp(34px, 12vh, 140px); }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
.nudge { position: fixed; left: 50%; top: 62%; transform: translateX(-50%); z-index: 20; pointer-events: none;
  font-size: clamp(22px, 7vh, 72px); font-weight: 900; letter-spacing: .06em; padding: .15em .8em; border-radius: 999px;
  background: var(--panel); border: 2px solid var(--yellow); color: var(--yellow); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.06); } }

/* Screens */
.screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; gap: 4vw;
  padding: max(4vh, env(safe-area-inset-top)) max(5vw, env(safe-area-inset-right)) max(4vh, env(safe-area-inset-bottom)) max(5vw, env(safe-area-inset-left));
  background: linear-gradient(100deg, rgba(10,30,70,.62) 0%, rgba(10,30,70,.28) 55%, rgba(10,30,70,.08) 100%);
  animation: fade .25s var(--ease); }
@keyframes fade { from { opacity: 0; } }
h1, h2 { margin: 0; line-height: .95; }
h2 { font-size: clamp(24px, 7.5vh, 72px); font-weight: 900; letter-spacing: .02em; }
.sub { color: var(--muted); font-size: clamp(15px, 3.8vh, 32px); font-weight: 600; margin: .4em 0; line-height: 1.25; }
.row { display: flex; gap: 2vh; flex-wrap: wrap; }

.menu-col { display: flex; flex-direction: column; gap: 2.2vh; min-width: 0; }
.menu-col:first-child { flex: 0 1 42vw; }
.logo { font-size: clamp(56px, 22vh, 220px); font-weight: 900; font-style: italic; letter-spacing: -.01em; color: #fff;
  text-shadow: .04em .05em 0 var(--orange), .08em .1em 0 var(--ink); }
.logo span { color: var(--yellow); margin-left: .12em; }
.tagline { margin: -.6vh 0 .8vh; font-size: clamp(18px, 5vh, 44px); color: #fff; font-weight: 700; text-shadow: 0 2px 10px rgba(0,20,60,.55); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; cursor: pointer; border-radius: 999px;
  min-height: max(48px, 11vh); padding: 0 1.2em; font-size: clamp(18px, 5vh, 44px); font-weight: 800; letter-spacing: .02em;
  border: 2px solid transparent; transition: transform .12s var(--ease), background .15s, box-shadow .15s; touch-action: manipulation; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--yellow); color: var(--ink); box-shadow: 0 .14em 0 #c79a00; }
.btn.primary:hover { background: #ffdc66; }
.btn.secondary { background: rgba(8,24,56,.55); border-color: rgba(255,255,255,.55); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn.secondary:hover { background: rgba(8,24,56,.7); }
.menu-col .row { flex-wrap: nowrap; }
.menu-col .row .btn { flex: 1; padding: 0 .8em; }
.best { margin: 0; font-size: clamp(16px, 4.2vh, 38px); color: #fff; letter-spacing: .08em; text-shadow: 0 2px 10px rgba(0,20,60,.55); }
.best b { color: var(--yellow); font-size: 1.2em; }
.howto { flex: 0 1 46vw; padding: 2.6vh 2.4vh; border-radius: 22px; background: rgba(8, 24, 56, 0.5);
  border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.8vh; }
.card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 1.6vh; align-items: center;
  padding: 1.6vh 2vh; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line); }
.card .fig { grid-row: span 2; width: clamp(40px, 13vh, 120px); height: clamp(40px, 13vh, 120px); color: var(--yellow);
  stroke: currentColor; stroke-width: 7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.card b { font-size: clamp(16px, 4.6vh, 42px); font-weight: 800; align-self: end; }
.card span { font-size: clamp(13px, 3.4vh, 30px); color: var(--muted); font-weight: 600; align-self: start; }
.tip { margin: 0; font-size: clamp(13px, 3.3vh, 28px); color: var(--muted); font-weight: 600; line-height: 1.3; }

.sheet, .center-box, .over-box { background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 3.4vh 4vh; display: flex; flex-direction: column; gap: 1.8vh; max-height: 100%; overflow: auto;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.sheet { width: min(1040px, 94vw); display: grid; grid-template-columns: 1fr 1fr; gap: 2vh 4vw; align-items: center; }
.sheet h2, .sheet > .btn { grid-column: 1 / -1; }
.sheet > .btn { justify-self: center; min-width: 40%; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 2vh; }
.flabel { font-size: clamp(16px, 4.2vh, 36px); font-weight: 700; }
.seg { display: inline-flex; background: rgba(255,255,255,.08); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { min-height: max(40px, 8.5vh); padding: 0 1em; border: 0; border-radius: 999px; background: transparent;
  font-size: clamp(15px, 3.8vh, 32px); font-weight: 800; cursor: pointer; color: var(--muted); touch-action: manipulation; }
.seg button.on { background: var(--yellow); color: var(--ink); }
input[type=number] { width: 5.5em; min-height: max(40px, 8.5vh); border-radius: 12px; border: 2px solid var(--line);
  background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: clamp(16px, 4vh, 34px); text-align: center; }

.center-box { align-items: center; text-align: center; width: min(820px, 92vw); }
.spinner { width: max(44px, 12vh); height: max(44px, 12vh); border-radius: 50%; border: .9vh solid rgba(255,255,255,.18);
  border-top-color: var(--yellow); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { width: 100%; height: max(10px, 2.4vh); border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.progress.small { height: max(8px, 1.6vh); }
.progress > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--yellow)); transition: width .15s linear; }

#calib { gap: 3vw; }
.calib-view { position: relative; height: min(84vh, 62vw); aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden;
  border: 3px solid rgba(255,255,255,.3); background: #000; flex: none; }
#calib-canvas { width: 100%; height: 100%; display: block; }
.calib-side { display: flex; flex-direction: column; gap: 1.8vh; min-width: 0; max-width: 36vw; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.2vh; }
.checks li { display: flex; align-items: center; gap: .6em; font-size: clamp(16px, 4.6vh, 40px); font-weight: 700; color: var(--muted); }
.checks li::before { content: ''; width: .8em; height: .8em; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); flex: none; transition: background .2s, border-color .2s; }
.checks li.ok { color: #fff; }
.checks li.ok::before { background: var(--green); border-color: var(--green); }

.over-box { align-items: center; width: min(1100px, 94vw); }
.over-title { display: flex; align-items: center; gap: .4em; font-size: clamp(32px, 11vh, 110px); font-style: italic; }
.badge { font-size: .35em; font-style: normal; background: var(--yellow); color: var(--ink); padding: .2em .6em; border-radius: 999px; animation: pulse2 1s ease-in-out infinite; }
@keyframes pulse2 { 50% { transform: scale(1.08); } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4vh; width: 100%; }
.stats div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 1.2vh 1.6vh; display: flex; flex-direction: column; }
.stats b { font-size: clamp(24px, 7.5vh, 76px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.stats span { font-size: clamp(12px, 3.2vh, 28px); color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.stats div:first-child b { color: var(--yellow); }
.stats div:last-child b { color: var(--orange); }
.hands { display: flex; flex-direction: column; align-items: center; gap: .8vh; width: min(520px, 80%);
  font-size: clamp(14px, 3.6vh, 30px); color: var(--muted); font-weight: 600; }

.rotate { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: var(--ink); text-align: center; font-size: 22px; }
.rot-ic { width: 72px; height: 72px; color: var(--yellow); animation: rot 2s var(--ease) infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse) { .rotate { display: grid; } }

@media (max-aspect-ratio: 1/1) and (pointer: fine) {
  #menu { flex-direction: column; }
  .menu-col:first-child { flex: none; width: min(560px, 100%); }
  .howto { display: none; }
}
@media (max-height: 460px) {
  .menu-col, .cards { gap: 1.6vh; }
  .card { padding: 1.2vh 1.4vh; }
  .tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .msg.show { animation: none; opacity: 1; transform: translate(-50%, -50%); }
  .spinner { animation: spin 1.5s linear infinite !important; }
}
