/* The canvas is the game. Everything here is the thin frame around it, and it stays out of the
   way: no panels, no boxes, nothing that needs reading twice while the rope is turning. */

:root {
  --cream: #f7ecd9;
  --amber: #ffb347;
  --dim: rgba(247, 236, 217, 0.42);
  --ink: #0b0f22;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font: 500 15px/1.5 ui-sans-serif, system-ui, 'Segoe UI', Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

/* ---- the bar --------------------------------------------------------------------------- */

#bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 0;
  pointer-events: none;
}

.cell { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.cell.left { align-items: flex-start; }
.cell.right { align-items: flex-end; }

.cap {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

#score {
  font-size: clamp(34px, 7vw, 56px);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 18px rgba(255, 140, 80, 0.35);
}

.pips { display: flex; gap: 6px; }
.pips i {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #ff7a52;
  box-shadow: 0 0 10px rgba(255, 122, 82, 0.6);
  transition: background 140ms, box-shadow 140ms, transform 140ms;
}
.pips i.spent { background: rgba(247, 236, 217, 0.16); box-shadow: none; transform: scale(0.72); }

.chain i { background: rgba(247, 236, 217, 0.16); box-shadow: none; transform: scale(0.72); }
.chain i.lit { background: var(--amber); box-shadow: 0 0 12px rgba(255, 179, 71, 0.8); transform: scale(1); }

/* ---- tempo ----------------------------------------------------------------------------- */

#tempo {
  position: fixed;
  left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(260px, 46vw);
  height: 3px;
  border-radius: 3px;
  background: rgba(247, 236, 217, 0.12);
  overflow: hidden;
  pointer-events: none;
}
#tempo span {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  border-radius: 3px;
  background: linear-gradient(90deg, #ffb347, #ff5a3c);
  transition: width 260ms linear;
}

/* ---- overlay --------------------------------------------------------------------------- */

#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 24px;
  text-align: center;
  padding-bottom: 34vh;
  background: radial-gradient(ellipse at 50% 34%, rgba(11, 15, 34, 0.62), rgba(11, 15, 34, 0.34));
  pointer-events: none;
  animation: rise 320ms ease-out;
}
#overlay[data-state="playing"],
#overlay[data-state="recover"] { display: none; }

#title {
  margin: 0 0 6px;
  font-size: clamp(40px, 9vw, 78px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 40px rgba(255, 140, 80, 0.4);
}
#blurb { margin: 0; max-width: 34ch; color: rgba(247, 236, 217, 0.82); }
#blurb b { color: var(--amber); font-weight: 700; }
.fine {
  margin: 14px 0 0;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { #overlay { animation: none; } }

#verdict {
  position: fixed;
  left: 12px; bottom: 12px;
  margin: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--amber);
}
