:root {
  --bg: #0a0e17;
  --card: #131a28;
  --line: #253247;
  --field: #0d131f;
  --text: #e9edf5;
  --muted: #8b97ab;
  --accent: #22d3ee;
  --accent2: #202c3f;
  --violet: #a78bfa;
  --good: #34d399;
  --bad: #fb7185;
  --gold: #fbbf24;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
#app { max-width: 440px; margin: 0 auto; min-height: 100vh; padding: 16px; display: flex; flex-direction: column; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.h { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
input { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); color: var(--text); font-size: 16px; margin: 6px 0; }
button { width: 100%; padding: 13px; border-radius: 10px; border: 0; background: var(--accent); color: #04222b; font-size: 16px; font-weight: 700; margin-top: 10px; cursor: pointer; }
button.sec { background: var(--accent2); color: var(--text); font-weight: 600; }
button:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.right { margin-left: auto; text-align: right; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.gold { color: var(--gold); }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.brand { font-weight: 800; }
.err { color: var(--bad); font-size: 14px; min-height: 18px; margin-top: 8px; }
.code { font-size: 32px; font-weight: 800; letter-spacing: .1em; text-align: center; margin: 6px 0; }
.hero { text-align: center; padding: 18px 0 2px; }
.bolt { font-size: 60px; line-height: 1; display: inline-block; filter: drop-shadow(0 0 22px rgba(34, 211, 238, .6)); }
.top .bolt { font-size: 18px; filter: none; vertical-align: -2px; }
.tiers { display: flex; gap: 8px; margin-top: 6px; }
.tier { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; }
.tier.sel { border-color: var(--accent); background: rgba(34,211,238,.14); color: var(--accent); }
.edit-name-btn { width: auto; padding: 4px 9px; font-size: 13px; margin: 0 0 0 auto; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.qr-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 50; }
.qr-box { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px 20px; text-align: center; max-width: 320px; width: 90%; }
.qr-box img { display: block; margin: 12px auto; border-radius: 10px; background: #fff; padding: 8px; }
.qr-close { margin-top: 14px; background: var(--accent2); color: var(--text); font-size: 14px; padding: 10px; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(30,40,60,.96); border: 1px solid var(--accent); color: var(--text); padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: 600; z-index: 200; pointer-events: none; transition: opacity .5s; white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
#spin { animation: spin 1s linear infinite; }

/* Play screen */
.playbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.clock { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.clock.warn { color: var(--gold); }
.clock.danger { color: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.score-chip { font-size: 22px; font-weight: 800; color: var(--accent); }
.wordline { min-height: 40px; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; letter-spacing: .12em; margin: 4px 0; }
.wordline .ph { color: var(--muted); font-size: 15px; font-weight: 500; letter-spacing: normal; }
.flash { text-align: center; min-height: 22px; font-size: 15px; font-weight: 700; margin-bottom: 6px; transition: opacity .3s; }
.grid { display: grid; gap: 8px; margin: 4px 0 10px; }
.cell { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--text); font-size: 26px; font-weight: 800; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; -webkit-user-select: none; transition: transform .08s, background .12s, border-color .12s; touch-action: manipulation; }
.cell.sel { background: rgba(34,211,238,.2); border-color: var(--accent); color: var(--accent); transform: scale(1.04); box-shadow: 0 0 14px rgba(34,211,238,.35); }
.cell.head { background: var(--accent); color: #04222b; border-color: var(--accent); }
.play-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.found-wrap { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: var(--accent2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-size: 13px; font-weight: 600; }
.chip .pts { color: var(--accent); margin-left: 5px; }
.mini-lead { margin-top: 12px; }
.mini-lead .row { padding: 7px 0; }

/* Reveal */
.reveal-title { text-align: center; font-size: 24px; font-weight: 800; margin: 8px 0 4px; }
.rank { width: 26px; text-align: center; font-weight: 800; color: var(--muted); flex: none; }
.rank.r1 { color: var(--gold); }
.uniq { color: var(--gold); margin-left: 4px; }
.confetti { position: fixed; top: -16px; width: 9px; height: 14px; border-radius: 2px; z-index: 60; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(620deg); } }
