/* Shared game page styles (used only on /play/<id>/). */
:root {
  --ink: #1d1640;
  --accent: #ffcf3f;
  --accent-ink: #2a1d00;
  --card: rgba(255, 255, 255, 0.96);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #120d2c; color: var(--ink);
  font-family: var(--font); -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#app { position: fixed; inset: 0; overflow: hidden; }
#cv { position: absolute; inset: 0; display: block; touch-action: none; }

.rb {
  min-width: 44px; min-height: 44px; border: 0; border-radius: 14px; font: inherit; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.9); color: var(--ink); text-decoration: none; padding: 0 16px;
  touch-action: manipulation;
}
.rb:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--ink); }
.rb.icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: rgba(20, 14, 50, 0.55); color: #fff; }
.rb.icon svg { width: 24px; height: 24px; }
.rb.primary { background: var(--accent); color: var(--accent-ink); font-size: 1.25rem; min-height: 56px; padding: 0 32px; box-shadow: 0 4px 0 #c99a00; }
.rb.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #c99a00; }
.rb[hidden] { display: none; }

.hud {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 8px) 0 calc(env(safe-area-inset-left) + 8px);
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud .score {
  flex: 1; text-align: center; color: #fff; font-weight: 800; font-size: 1.5rem; letter-spacing: 0.02em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); pointer-events: none; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#app:not([data-state="playing"]) .hud .score { visibility: hidden; }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; display: none; justify-content: space-between;
  padding: 0 calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 14px) calc(env(safe-area-inset-left) + 14px);
  pointer-events: none;
}
#app[data-state="playing"] .controls { display: flex; }
.rb.hold {
  pointer-events: auto; width: 84px; height: 84px; border-radius: 50%; padding: 0;
  background: rgba(255, 255, 255, 0.22); color: #fff; border: 3px solid rgba(255, 255, 255, 0.6);
  touch-action: none;
}
.rb.hold svg { width: 40px; height: 40px; }
.rb.hold.on { background: rgba(255, 255, 255, 0.5); transform: scale(0.95); }
.rb.hold.right { margin-left: auto; }

.ov {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(18, 13, 44, 0.55);
  padding: calc(env(safe-area-inset-top) + 16px) calc(env(safe-area-inset-right) + 16px) calc(env(safe-area-inset-bottom) + 16px) calc(env(safe-area-inset-left) + 16px);
}
.ov.show { display: flex; animation: ovIn 0.25s ease-out; }
@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ov.show { animation: none; } }
.card {
  background: var(--card); border-radius: 24px; padding: 24px 22px; width: min(340px, 100%);
  display: flex; flex-direction: column; align-items: stretch; gap: 12px; text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); max-height: 100%; overflow: auto;
}
.card h1, .card h2 { margin: 0; font-size: 1.6rem; line-height: 1.15; }
.card p { margin: 0; }
.card .lead { color: #4a4170; line-height: 1.4; }
.card .final { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.card .final .lbl { display: block; font-size: 0.95rem; font-weight: 600; color: #6a6190; }
.card .best { color: #6a6190; font-weight: 600; min-height: 1.2em; }
.card .newbest { color: #c2410c; font-weight: 800; }
.card .newbest[hidden] { display: none; }
