:root {
  --bg: #05060a;
  --ink: #eef1e6;
  --muted: #8d947f;
  --line: #1e231b;
  --accent: #c8f04a;
  --ice: #6ef0ff;
  --danger: #ff3d6e;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, -apple-system, 'Segoe UI', Inter, system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  pointer-events: none;
  z-index: 3;
}

.grp { display: flex; gap: 18px; }
.grp.right { text-align: right; align-items: flex-end; }

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font: 500 10px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat b {
  font: 600 17px/1.1 var(--mono);
  letter-spacing: .02em;
  color: var(--ink);
}

.bars {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 0 18px calc(14px + env(safe-area-inset-bottom));
  z-index: 3;
  pointer-events: none;
}

.bar {
  height: 7px;
  margin-top: 7px;
  border-radius: 99px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width .12s linear;
}

.bar.xp { height: 5px; }
.bar.xp i { background: var(--ice); box-shadow: 0 0 12px rgba(110,240,255,.6); }
.bar.hp i { background: var(--accent); box-shadow: 0 0 12px rgba(200,240,74,.55); }
.bar.hp i.low { background: var(--danger); box-shadow: 0 0 12px rgba(255,61,110,.6); }

.bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font: 500 10px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 5;
  background: radial-gradient(circle at 50% 45%, rgba(5,6,10,.74), rgba(5,6,10,.95));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.screen.on { display: flex; }

.panel {
  width: 100%;
  max-width: 520px;
  text-align: center;
  animation: rise .35s ease both;
}

.panel.wide { max-width: 840px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.kicker {
  margin: 0 0 14px;
  font: 500 11px/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
}

h1, h2 { margin: 0; font-weight: 600; }

h1 {
  font-size: clamp(46px, 13vw, 92px);
  line-height: .86;
  letter-spacing: -.04em;
}

h1 em { font-style: normal; color: var(--accent); }

h2 { font-size: clamp(24px, 5vw, 34px); letter-spacing: -.02em; }

h2.score {
  font: 600 clamp(46px, 11vw, 78px)/1 var(--mono);
  letter-spacing: -.02em;
  color: var(--accent);
}

.lede {
  margin: 18px auto 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 15px;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: center;
  margin: 22px 0 0;
  font: 500 11px/1.7 var(--mono);
  letter-spacing: .06em;
  color: var(--muted);
}

.keys b { color: var(--ink); font-weight: 600; }

.btn {
  display: inline-block;
  margin-top: 26px;
  padding: 14px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #080a06;
  font: 600 14px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s, opacity .16s;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 34px -14px rgba(200,240,74,.95); }
.btn:active { transform: translateY(0); }

.btn.ghost {
  margin-left: 8px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.ghost:hover { border-color: var(--accent); box-shadow: none; }

.best {
  margin: 16px 0 0;
  font: 500 11px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 28px;
  text-align: left;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px 16px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0c0f0b;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, transform .16s, background .16s;
}

.card:hover { border-color: var(--accent); background: #10140d; transform: translateY(-2px); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.card .num {
  font: 600 10px/1 var(--mono);
  letter-spacing: .12em;
  color: var(--accent);
}

.card strong { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.card .desc { font-size: 13px; line-height: 1.45; color: var(--muted); }

.card .lvl {
  position: absolute;
  top: 16px; right: 16px;
  font: 500 10px/1 var(--mono);
  color: var(--muted);
}

.mute {
  position: fixed;
  right: 16px;
  bottom: 58px;
  z-index: 4;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(5,6,10,.72);
  color: var(--muted);
  font: 500 10px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}

.mute:hover { color: var(--ink); border-color: var(--accent); }
.mute.off { color: #5c6157; }

@media (max-width: 640px) {
  .hud { padding: 12px 14px; }
  .grp { gap: 12px; }
  .stat b { font-size: 15px; }
  .cards { grid-template-columns: 1fr; max-height: 62vh; overflow: auto; }
  .mute { right: 12px; bottom: 54px; }
}

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