:root {
  --bg: #0b0d1a; --card: rgba(22, 25, 48, .78); --card-solid: #161930; --text: #eef0ff; --muted: #9aa0c3; --line: rgba(255,255,255,.12);
  --input: rgba(8, 10, 24, .7); --accent: #ff6a3d; --accent-dark: #ff8a5c; --accent2: #8b5cf6; --ok: #4ade80; --warn: rgba(250, 204, 21, .14); --radius: 16px;
}
* { box-sizing: border-box; }
html { min-height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 15% 10%, rgba(139, 92, 246, .28), transparent 60%),
    radial-gradient(ellipse 70% 55% at 90% 95%, rgba(255, 106, 61, .22), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(34, 211, 238, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed; }
body { margin: 0; min-height: 100vh; color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: transparent; }
/* Peen müra/tähetolm SVG-na */
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='20' cy='30' r='.8' opacity='.5'/%3E%3Ccircle cx='140' cy='60' r='.6' opacity='.35'/%3E%3Ccircle cx='200' cy='170' r='.9' opacity='.45'/%3E%3Ccircle cx='70' cy='200' r='.6' opacity='.3'/%3E%3Ccircle cx='110' cy='120' r='.5' opacity='.4'/%3E%3Ccircle cx='225' cy='20' r='.5' opacity='.3'/%3E%3C/g%3E%3C/svg%3E"); }
a { color: var(--accent-dark); }
::selection { background: var(--accent2); color: #fff; }
h1 { margin: 0 0 .5em; font-size: 1.8rem; line-height: 1.2; }
h2 { margin: 0; font-size: 1.2rem; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: 0 10px 40px rgba(0,0,0,.35); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
input[type=text], input[type=password], input[type=search], textarea {
  width: 100%; padding: 12px 14px; font: inherit; border: 2px solid var(--line); border-radius: 10px; background: var(--input); color: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,106,61,.18); }
::placeholder { color: #6b7096; }
label { display: block; margin-bottom: 12px; }
.btn { display: inline-block; background: linear-gradient(135deg, var(--accent), #ff3d77); color: #fff; border: 0; border-radius: 10px; padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.1); box-shadow: 0 6px 20px rgba(255,90,80,.35); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.big { padding: 16px 32px; font-size: 1.15rem; }
.btn.small { padding: 7px 12px; font-size: .9rem; }
.btn.danger { background: #b3261e; }
.btn.ghost:hover { box-shadow: none; }
.link { background: none; border: 0; padding: 0; color: var(--accent-dark); cursor: pointer; font: inherit; text-decoration: underline; }
.link.danger { color: #f87171; }
.row { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.row.left { justify-content: flex-start; }
.row.between { margin-top: 0; margin-bottom: 12px; }
form.inline { display: inline; margin: 0; }

/* ---------- Avalik leht ---------- */
body.public { display: flex; flex-direction: column; min-height: 100vh; align-items: center; justify-content: flex-start; padding: max(16px, 7vh) 16px 32px; }
body.public .card { width: 100%; max-width: 560px; padding: 32px 28px; text-align: center; }
body.public h1 { font-size: 2rem; background: linear-gradient(90deg, #fff, #ffb59c 60%, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.onair-dot { display: inline-flex; align-items: center; gap: 8px; font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: #ffb59c; margin-bottom: 10px; }
.onair-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(255,106,61,.7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255,106,61,0); } 100% { box-shadow: 0 0 0 0 rgba(255,106,61,0); } }
.eq { display: flex; gap: 4px; justify-content: center; align-items: flex-end; height: 28px; margin: 4px 0 18px; }
.eq i { width: 5px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent2)); animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2n) { animation-duration: .8s; } .eq i:nth-child(3n) { animation-duration: 1.4s; } .eq i:nth-child(5n) { animation-delay: -.4s; }
@keyframes eq { 0%,100% { height: 20%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .eq i, .onair-dot::before { animation: none; height: 60%; } }
.lead { font-size: 1.1rem; }
.question { font-size: 1.45rem; font-weight: 700; margin: 10px 0 18px; line-height: 1.3; }
#answer { font-size: 1.2rem; text-align: center; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .3s; }
#counter { margin: 8px 0 0; font-size: .9rem; }
.big-emoji { font-size: 3rem; margin: 0; }
.error { color: #f87171; margin-top: 14px; }

/* ---------- Haldus ---------- */
body.admin { padding: 16px; }
.wide { max-width: 980px; margin: 0 auto; }
.narrow { max-width: 380px; margin: 10vh auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.topbar span { display: flex; gap: 16px; align-items: center; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.flash { background: rgba(74,222,128,.14); border: 1px solid rgba(74,222,128,.3); border-radius: 10px; padding: 10px 14px; }
.warn { background: var(--warn); border: 1px solid rgba(250,204,21,.35); border-radius: 10px; padding: 10px 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.stats b { display: block; font-size: 1.8rem; }
.stats span { color: var(--muted); font-size: .9rem; }
details > summary { cursor: pointer; }
details.card > summary { margin: -4px 0; }
details[open].card > summary { margin-bottom: 14px; }
.filter { margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .85rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 2px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; white-space: nowrap; }
.center { text-align: center; }
tr.inactive td a { color: var(--muted); }
.pill { border: 0; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: .8rem; cursor: pointer; white-space: nowrap; }
.pill.on { background: rgba(74,222,128,.15); color: var(--ok); }
.pill.off { background: rgba(255,255,255,.08); color: var(--muted); }
.qedit { display: flex; gap: 10px; }
.qtitle { font-size: 1.2rem; font-weight: 600; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0; position: sticky; top: 0; background: var(--card-solid); z-index: 1; }
.board .rank { color: var(--muted); font-weight: 700; }
.board .label { font-weight: 600; font-size: 1.05rem; }
.barwrap { height: 6px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.pbar { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.variants { margin-top: 6px; font-size: .9rem; }
.variants summary { color: var(--muted); }
.variants ul { margin: 6px 0; padding-left: 18px; }
.variants li .link { font-size: .8rem; margin-left: 6px; }
.toggle { display: flex; gap: 6px; align-items: center; margin: 0; font-size: .9rem; }

/* ---------- Eetrivaade ---------- */
.onair { max-width: 900px; margin: 0 auto; }
.onair h1 { font-size: 2.2rem; }
.reveal { list-style: none; padding: 0; margin: 24px 0; }
.reveal li { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, #2a2f6b, #3b2160); border: 1px solid rgba(255,255,255,.15); transition: background .2s; color: #fff; border-radius: 12px; padding: 16px 20px; margin-bottom: 10px; font-size: 1.6rem; cursor: pointer; user-select: none; }
.reveal .n { background: var(--accent); border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; font-weight: 700; flex: none; }
.reveal .a { flex: 1; font-weight: 700; }
.reveal .p small { font-size: 1rem; opacity: .8; }
.reveal li.hidden .a, .reveal li.hidden .p { visibility: hidden; }
.reveal li.hidden { background: rgba(255,255,255,.06); }

@media (max-width: 600px) {
  .qedit { flex-direction: column; }
  .board td, .board th { padding: 8px 4px; }
  .reveal li { font-size: 1.2rem; }
}

input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
code { background: rgba(255,255,255,.1); padding: 1px 5px; border-radius: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
/* Eesmärk, olekud, statistika */
.pill.full { background: rgba(139,92,246,.2); color: #c4b5fd; }
.pbar.full { background: linear-gradient(90deg, #8b5cf6, #c4b5fd); }
.prog { white-space: nowrap; min-width: 120px; }
.barwrap.mini { display: block; height: 4px; margin-top: 4px; width: 110px; }
.barwrap.mini .pbar { display: block; }
.wide-prog .barwrap.mini { width: 160px; }
.target-row { margin-top: 12px; }
.inline-label { display: flex; align-items: center; gap: 8px; margin: 0; }
.num-input { width: 100px; padding: 8px 10px; font: inherit; border: 2px solid var(--line); border-radius: 10px; background: var(--input); color: inherit; }
.topbar span a { white-space: nowrap; }
.cur { font-weight: 700; text-decoration: none; }
.nowrap { white-space: nowrap; }
.statt td { padding: 8px; } .statt .barcell { white-space: nowrap; }
.barcell { width: 50%; position: relative; }
.barcell b { position: relative; margin-left: 6px; }
.hbar { display: inline-block; vertical-align: middle; height: 14px; min-width: 2px; border-radius: 4px; background: linear-gradient(90deg, var(--accent2), var(--accent)); max-width: calc(100% - 110px); }
.hours { display: flex; align-items: flex-end; gap: 4px; height: 160px; margin: 16px 0 6px; }
.hcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.hcol span { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: linear-gradient(0deg, var(--accent2), var(--accent)); }
.hcol small { height: 18px; color: var(--muted); font-size: .7rem; margin-top: 4px; }
@media (max-width: 600px) { .statt th:nth-child(3), .statt td:nth-child(3) { display: none; } .hours { gap: 2px; } }

/* Mängu kirjeldus vastamise vormi all */
body.public .game-info { text-align: left; font-size: .95rem; color: #d4d7f0; padding: 20px 24px; }
.game-info p { margin: 0 0 .7em; }
.game-info p:last-child { margin-bottom: 0; }
.game-info strong { color: #fff; }
/* Tabid: Kasutamata / Kasutatud */
.tabs { display: flex; gap: 4px; margin-bottom: -1px; position: relative; z-index: 1; }
.tabs a { padding: 10px 18px; border-radius: 12px 12px 0 0; color: var(--muted); text-decoration: none; font-weight: 600; border: 1px solid transparent; border-bottom: 0; }
.tabs a span { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: .8rem; text-align: center; }
.tabs a:hover { color: var(--text); }
.tabs a.cur-tab { background: var(--card-solid); color: var(--text); border-color: var(--line); }
.tabs a.cur-tab span { background: var(--accent); color: #fff; }
.tabcard { border-top-left-radius: 0; }
.actions { white-space: nowrap; text-align: right; }
.actions .btn { margin-left: 4px; }
@media (max-width: 600px) { .actions .btn { padding: 6px 8px; font-size: .8rem; } }

.lead p { margin: 0 0 .7em; }
.lead p:last-child { margin-bottom: 1em; }
