:root {
  color-scheme: dark; /* AMOLED: true black, near-black surfaces, green accent */
  --bg: #000; --card: #0a0b0f; --line: #1c2030; --text: #f1f3fa; --muted: #9aa3bd; --sunk: #050608; --ease: cubic-bezier(.2, .8, .2, 1);
  --accent: #4ade80; --accent2: #38bdf8; --warn: #fbbf24; --danger: #f87171; --ar: 4 / 3;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent2); }
.top { padding: 14px 16px 6px; max-width: 900px; margin: 0 auto; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { font-size: 34px; }
h1 { margin: 0; font-size: 22px; letter-spacing: .2px; }
.tag { margin: 0; color: var(--muted); font-size: 14px; }
main { max-width: 900px; margin: 0 auto; padding: 0 12px; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 14px 0 4px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 12px;
  position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0; }
.tabs button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #062312; border-color: var(--accent); }
button:focus-visible, input:focus-visible + span, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; }
.intro { text-align: center; padding: 22px 16px; }
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: #10131b;
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); color: #062312; border-color: var(--accent); }
.btn.big { min-height: 54px; font-size: 18px; padding: 0 28px; margin: 6px 0 10px; }
.small { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); margin: 0; }
.error { color: var(--danger); font-weight: 600; }
.stage-wrap { margin: 0 0 6px; }
.stage { position: relative; aspect-ratio: var(--ar); width: min(100%, calc(62vh * (var(--ar))));
  margin: 0 auto; border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.stage.mirrored video, .stage.mirrored canvas { transform: scaleX(-1); }
.badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.badge { background: rgba(0,0,0,.6); padding: 3px 8px; border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums; }
.status { max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 10px 0 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.switch.block { display: flex; margin: 8px 0; }
.hand-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.hand-card { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.hand-card .side { color: var(--muted); font-size: 13px; }
.hand-card .gesture { font-size: 22px; font-weight: 700; }
.hand-card .count { font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.stats > div { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.k { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.v { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.small-v { font-size: 15px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.meter .bar { flex: 1; height: 10px; background: var(--sunk); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; width: 0; background: var(--accent2); transition: width .08s; }
.meter b { color: var(--text); font-variant-numeric: tabular-nums; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.blink-pad .pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad-btn { min-height: 72px; border-radius: 14px; border: 2px solid var(--line); background: var(--sunk); color: var(--text);
  font-size: 16px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pad-btn b { font-size: 13px; color: var(--muted); }
.pad-btn.look { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(56,189,248,.35); }
.pad-btn.hit { background: var(--accent); color: #062312; }
.mouse-layer { position: absolute; inset: 0; background: rgba(5, 8, 20, .45); }
.game-hud { position: absolute; bottom: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between;
  font-weight: 700; font-size: 15px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.air-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.start-btn { width: 34%; min-width: 120px; aspect-ratio: 2.2 / 1; border-radius: 16px; border: 3px solid #fff;
  background: var(--accent); color: #062312; font-size: clamp(16px, 4vw, 26px); font-weight: 800; }
.target { position: absolute; width: 18%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%);
  border: 4px solid #fff; background: radial-gradient(circle, #f87171 0 25%, #fff 26% 45%, #f87171 46% 100%); }
.hover { filter: brightness(1.25); box-shadow: 0 0 0 5px rgba(251,191,36,.8); }
.cursor { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  border: 3px solid var(--warn); background: rgba(251,191,36,.25); pointer-events: none; z-index: 3; }
.cursor.down { background: var(--warn); transform: scale(.75); }
.calib { position: fixed; inset: 0; z-index: 50; background: #000; }
.calib-dot { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 8px rgba(248,113,113,.3); transition: left .3s, top .3s; }
.calib-text { position: absolute; left: 0; right: 0; top: 58%; text-align: center; font-size: 20px; font-weight: 700; }
.help summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.help ul { padding-left: 20px; margin: 4px 0; }
.foot { max-width: 900px; margin: 0 auto; padding: 8px 16px 28px; text-align: center; color: var(--muted); font-size: 14px; }
[hidden] { display: none !important; }
@media (min-width: 800px) {
  h1 { font-size: 26px; }
  .stage { width: min(100%, calc(66vh * (var(--ar)))); }
}

/* share + more tools */
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.share-row .btn { flex: 1 1 130px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; flex-basis: 100%; min-height: 50px; font-size: 16px; }
.more-tools h2 { margin-top: 0; }
.more-tools ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.more-tools li a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; }
.more-tools li a span:last-child { display: block; color: var(--muted); font-size: 14px; }
.more-tools p a { color: var(--accent2); }

/* AMOLED polish: crisp borders, accent glow, micro-interactions */
::selection { background: rgba(74, 222, 128, .3); color: #fff; }
body { -webkit-font-smoothing: antialiased; }
.tabs { background: rgba(0, 0, 0, .86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tabs button, .btn, .pad-btn, .more-tools li a { transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease); }
.tabs button[aria-selected="true"], .btn.primary { box-shadow: 0 6px 22px rgba(74, 222, 128, .22); }
.tabs button:not([aria-selected="true"]):hover, .btn:not(.primary):not(.wa):hover, .more-tools li a:hover { border-color: rgba(74, 222, 128, .5); }
.tabs button:active, .btn:active, .pad-btn:active, .more-tools li a:active { transform: scale(.97); }
.stage { box-shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 20px 60px rgba(0, 0, 0, .6); }
.card { animation: rise .3s var(--ease) both; }
.btn.wa { box-shadow: 0 6px 22px rgba(31, 168, 85, .25); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
