/* Violet Flap — game screen styling. Overlays sit above a full-bleed canvas. */

.game-body { overflow: hidden; height: 100svh; }

#stage {
  position: fixed; inset: 0;
  overflow: hidden;
  /* the canvas paints the sky; this is a fallback */
  background: linear-gradient(160deg, #1a0a3e, #0b0417 80%);
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}

#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---- top bar ---- */
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 14px 0; pointer-events: none; }
.icon-btn { pointer-events: auto; cursor: pointer; font: inherit; font-size: 1.3rem; line-height: 1;
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink); background: rgba(32,16,64,0.55); border: 1.5px solid var(--panel-brd);
  border-radius: 50%; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  text-decoration: none; transition: transform .1s ease, background .2s; }
.icon-btn:hover { background: rgba(168,85,247,0.3); }
.icon-btn:active { transform: scale(0.92); }

/* ---- HUD ---- */
.hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.score { position: absolute; top: max(54px, calc(env(safe-area-inset-top) + 50px)); left: 0; right: 0;
  text-align: center; font-size: clamp(3rem, 14vw, 5rem); font-weight: 900; color: #fff;
  text-shadow: 0 0 24px rgba(217,70,239,0.8), 0 4px 10px rgba(0,0,0,0.5);
  transition: transform .09s ease; }
.score.pop { transform: scale(1.35); }
.hud-players { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 0; right: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0 70px; }
.chip { font-size: .72rem; font-weight: 800; color: #fff; padding: .2em .6em; border-radius: 999px;
  background: rgba(32,16,64,0.6); border: 1px solid var(--panel-brd); white-space: nowrap; }
.chip.dead { opacity: .4; text-decoration: line-through; }
.chip .dot { display: inline-block; width: .5em; height: .5em; border-radius: 50%; margin-right: .35em; vertical-align: middle; }

/* ---- screens (overlays) ---- */
.screen { position: absolute; inset: 0; z-index: 25; display: none;
  align-items: center; justify-content: center; padding: 20px;
  padding-top: max(20px, calc(env(safe-area-inset-top) + 60px)); }
.screen.on { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.title-card { text-align: center; max-width: 420px; }
.title { font-size: clamp(2.8rem, 15vw, 5rem); font-weight: 900; letter-spacing: -2px; margin: 0; line-height: .9; }
.title span { display: block;
  background: linear-gradient(120deg, var(--neon), var(--magenta), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 26px rgba(217,70,239,0.6)); }
.tag { color: var(--ink-dim); margin: 14px auto 22px; max-width: 26ch; }
.menu-btns { display: flex; flex-direction: column; gap: 12px; }
.best-line { color: var(--ink-mut); margin-top: 18px; font-weight: 600; }
.best-line b { color: var(--neon); }

.center-hint { text-align: center; color: var(--ink); }
.center-hint p { font-size: 1.3rem; font-weight: 800; margin: 6px 0 22px; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.big-tap { font-size: 3.4rem; animation: bob 1.1s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-12px) } }
@media (prefers-reduced-motion: reduce) { .big-tap { animation: none; } }

/* cards */
.panel.over-card, .panel.setup-card, .panel.lobby-card, .panel.results-card {
  width: 100%; max-width: 380px; padding: 26px 24px; text-align: center; }
.over-card h2, .setup-card h2, .results-card h2 { font-size: 1.5rem; }

.over-score { font-size: 4rem; font-weight: 900; color: #fff; line-height: 1;
  text-shadow: 0 0 30px rgba(217,70,239,0.7); }
.over-best { color: var(--ink-dim); margin: 8px 0 18px; }
.over-best b { color: var(--neon); }
.new-badge { color: #ffd54a; font-weight: 900; font-size: .85rem; margin-left: 6px; }

.over-btns { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* nickname / inputs */
.lbl, .lobby-label { display: block; text-align: left; color: var(--ink-dim); font-size: .8rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 6px; }
.lobby-label { text-align: center; }
.nick-row, .join-row { display: flex; gap: 8px; align-items: stretch; }
.nick-row .field, .join-row .field { flex: 1; }
.nick-row .icon-btn { flex: none; border-radius: 12px; }
.nick-hint { color: var(--ink-mut); font-size: .78rem; margin: 6px 0 16px; text-align: left; }
.nick-hint.bad { color: var(--pink); }
.submit-row { margin: 8px 0; }
.submit-row .btn { width: 100%; margin-top: 4px; }
.submit-done { color: #7cf29a; font-weight: 800; margin: 10px 0; }

.setup-card .btn.big { width: 100%; }
.or { color: var(--ink-mut); font-size: .8rem; margin: 16px 0 10px; position: relative; }
.join-row { margin-bottom: 8px; }
.join-row .btn { flex: none; }
.setup-card .small, .lobby-card .small { margin-top: 16px; }
.err { color: var(--pink); font-weight: 700; font-size: .85rem; margin: 10px 0 0; min-height: 1em; }
.btn.small { font-size: .85rem; padding: .55em 1.1em; }

/* lobby */
.code-big { font-size: 2.8rem; font-weight: 900; letter-spacing: 6px; color: #fff;
  text-shadow: 0 0 26px rgba(217,70,239,0.7); margin: 4px 0 10px; }
.player-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.player-list li { display: flex; align-items: center; gap: 8px; font-weight: 700;
  background: rgba(11,4,23,0.4); border: 1px solid rgba(168,85,247,0.18); border-radius: 10px; padding: .5em .8em; }
.player-list li .host { margin-left: auto; font-size: .72rem; color: #ffd54a; font-weight: 800; }
.player-list li .me { margin-left: auto; font-size: .72rem; color: var(--pink); font-weight: 800; }
.player-list .swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.wait { color: var(--ink-dim); font-weight: 700; font-style: italic; }

/* countdown */
.count-num { font-size: clamp(6rem, 40vw, 16rem); font-weight: 900; color: #fff;
  text-shadow: 0 0 60px rgba(217,70,239,0.9); animation: pulse .9s ease; }
.count-num.go { color: var(--pink); }
@keyframes pulse { 0% { transform: scale(0.4); opacity: 0 } 40% { transform: scale(1.1); opacity: 1 } 100% { transform: scale(1); opacity: 1 } }

/* results */
.results-list { list-style: none; counter-reset: r; margin: 0 0 10px; padding: 0;
  display: flex; flex-direction: column; gap: 8px; text-align: left; }
.results-list li { counter-increment: r; display: flex; align-items: center; gap: 10px;
  background: rgba(11,4,23,0.4); border: 1px solid rgba(168,85,247,0.18); border-radius: 12px; padding: .6em .9em; font-weight: 700; }
.results-list li::before { content: counter(r); font-weight: 900; color: var(--neon); width: 1.4em; }
.results-list li:first-child { border-color: #ffd54a66; background: rgba(255,213,74,0.08); }
.results-list li:first-child::before { content: "🏆"; }
.results-list li .swatch { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.results-list li .pts { margin-left: auto; color: #fff; font-weight: 900; }
.results-list li.me { color: var(--pink); }
.winner-tag { color: #ffd54a; font-weight: 900; }

/* toast */
.toast { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%);
  z-index: 40; background: rgba(32,16,64,0.9); border: 1px solid var(--panel-brd); color: var(--ink);
  padding: .6em 1.1em; border-radius: 999px; font-weight: 700; font-size: .85rem; max-width: 90vw; text-align: center; }

/* landscape: keep cards from overflowing */
@media (orientation: landscape) and (max-height: 520px) {
  .title { font-size: clamp(2rem, 9vh, 3rem); }
  .tag { margin: 8px auto 14px; }
  .screen { padding-top: 56px; align-items: center; }
  .panel.over-card, .panel.setup-card, .panel.lobby-card, .panel.results-card { max-height: 86svh; overflow-y: auto; }
  .over-score { font-size: 2.6rem; }
  .code-big { font-size: 2rem; }
}
