:root {
  --bg: #0e0f1f;
  --bg2: #161834;
  --panel: #1c1f42;
  --panel2: #232756;
  --line: #2f3468;
  --text: #f4f5ff;
  --muted: #a7abd8;
  --accent: #8b6cff;
  --accent2: #2dd4ef;
  --good: #2fd27a;
  --bad: #ff5a6a;
  --o1: #4f8cff;
  --o2: #ffb547;
  --o3: #ff5fa8;
  --o4: #2fd2a0;
  --radius: 18px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1100px 600px at 15% -10%, #2b1f70 0%, transparent 60%),
    radial-gradient(900px 520px at 110% 115%, #0b4b5e 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; font-size: .85em; }

.btn {
  border: 1px solid var(--line); background: var(--panel2); border-radius: 12px;
  padding: 10px 18px; font-weight: 700; transition: transform .08s ease, background .2s ease, opacity .2s;
}
.btn:hover:not(:disabled) { background: #2b3068; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6a4dff); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #9a80ff, #7a60ff); }
.btn.ghost { background: transparent; }
.btn.big { font-size: 1.2rem; padding: 14px 32px; border-radius: 14px; }
.link { background: none; border: 0; color: var(--muted); padding: 4px 0; }
.link:hover { color: var(--text); }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 10px; width: 36px; height: 36px; color: var(--muted); }
.icon-btn:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }

/* ── home ── */
.home { max-width: 980px; margin: 0 auto; padding: 56px 16px 40px; text-align: center; }
.brand .logo { font-size: 64px; filter: drop-shadow(0 8px 24px rgba(139,108,255,.45)); }
.brand h1 { font-size: clamp(48px, 9vw, 88px); margin: 4px 0 0; letter-spacing: -0.04em; line-height: 1;
  background: linear-gradient(90deg, #fff, #c9bcff 50%, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--muted); font-size: clamp(18px, 2.4vw, 22px); margin: 12px 0 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin: 40px 0 0; }
.card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  padding: 26px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line);
  transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); border-color: #4b51a0; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.card.accent { background: linear-gradient(160deg, #2a2366, var(--panel) 60%); border-color: #4c3fb0; }
.card-icon { font-size: 34px; }
.card-title { font-size: 24px; font-weight: 800; }
.card-text { color: var(--muted); }
.how { list-style: none; padding: 0; margin: 40px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; color: var(--muted); counter-reset: how; }
.how li { counter-increment: how; }
.how li::before { content: counter(how); display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 50%; background: var(--panel2); color: var(--text); font-weight: 800; font-size: 13px; }
.foot { margin-top: 48px; color: var(--muted); font-size: 14px; }

/* ── setup ── */
.setup { max-width: 820px; margin: 0 auto; padding: 32px 16px 48px; }
.setup-head { display: flex; align-items: center; gap: 16px; }
.setup-head h1 { margin: 0; font-size: 30px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); font-size: 15px; }
.row { display: flex; gap: 10px; }
.row input { flex: 1; min-width: 0; }
input[type=text], select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 12px;
  padding: 11px 14px; font: inherit;
}
select { width: 100%; margin-top: 6px; }
input[type=range] { width: 100%; margin-top: 14px; accent-color: var(--accent); }
.chat-status { margin: 12px 0 0; font-weight: 600; }
.chat-status::before { content: '●'; margin-right: 8px; }
.chat-status.ok { color: var(--good); }
.chat-status.wait { color: var(--o2); }
.chat-status.bad { color: var(--bad); }
.chat-status.off, .chat-status.sim { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--bg2); }
.radio:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139,108,255,.35); }
.radio input { margin-top: 4px; accent-color: var(--accent); }
.radio small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 16px; }
.grid label { color: var(--muted); font-size: 14px; font-weight: 600; }
.tips ul { margin: 0; padding-left: 20px; color: var(--muted); }
.tips li { margin: 6px 0; }
.tips b { color: var(--text); }
.start-row { text-align: center; margin-top: 26px; }

/* ── game ── */
.game { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.game.is-stream { grid-template-columns: minmax(0, 1fr) 340px; }
.stage { padding: 22px clamp(16px, 3vw, 40px) 70px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
/* Transliacijoje: viršutinė juosta viršuje, o žaidimo turinys centruojamas vertikaliai. */
.is-stream .stage { min-height: 100vh; }
.is-stream .phase-label { margin-top: auto; }
.is-stream .controls { margin-bottom: auto; }
.topbar { width: min(960px, 100%); display: flex; align-items: center; gap: 12px; }
.round-no { font-weight: 800; font-size: 22px; margin-right: auto; }
.round-no span { color: var(--muted); font-weight: 600; }
.pill { border: 1px solid var(--line); background: var(--bg2); border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 700; color: var(--muted); }
.pill.status.ok { color: var(--good); }
.pill.status.wait, .pill.status.bad { color: var(--o2); }
.pill.score { color: var(--text); font-size: 16px; }

.timer { width: min(960px, 100%); height: 14px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .1s linear; }
.timer-fill.low { background: linear-gradient(90deg, #ff8a5a, var(--bad)); }

.phase-label { margin: 6px 0 0; min-height: 1.4em; font-size: clamp(20px, 2.6vw, 30px); font-weight: 800; text-align: center; }
[data-phase=delay] .phase-label { color: var(--o2); }

.play {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); font-weight: 800; font-size: 18px;
}
.play:hover { border-color: var(--accent); }
.play.nudge { animation: nudge 1.2s ease-in-out infinite; border-color: var(--accent); }
.eq { display: flex; align-items: flex-end; gap: 4px; height: 28px; }
.eq i { width: 5px; height: 30%; border-radius: 3px; background: var(--accent2); }
.play.playing .eq i { animation: eq .9s ease-in-out infinite; }
.play.playing .eq i:nth-child(2) { animation-delay: -.2s; }
.play.playing .eq i:nth-child(3) { animation-delay: -.45s; }
.play.playing .eq i:nth-child(4) { animation-delay: -.1s; }
.play.playing .eq i:nth-child(5) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(139,108,255,.6); } 50% { box-shadow: 0 0 0 10px rgba(139,108,255,0); } }

.options { width: min(960px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.opt {
  --c: var(--o1);
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; min-height: 86px; border-radius: var(--radius); text-align: left;
  background: var(--panel); border: 2px solid var(--line);
  font-size: clamp(20px, 2.3vw, 30px); font-weight: 800;
  transition: border-color .2s, opacity .3s, transform .08s, box-shadow .3s;
}
.opt:nth-child(2) { --c: var(--o2); }
.opt:nth-child(3) { --c: var(--o3); }
.opt:nth-child(4) { --c: var(--o4); }
.opt > * { position: relative; z-index: 1; }
.opt .opt-bar { position: absolute; inset: 0 auto 0 0; width: 0; z-index: 0; background: color-mix(in srgb, var(--c) 24%, transparent); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.opt .num { flex: none; display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 12px; background: var(--c); color: #0c0c1a; }
.opt-count { margin-left: auto; font-size: .62em; color: var(--muted); font-weight: 700; white-space: nowrap; }
.mode-chat .opt { cursor: default; }
.is-solo .opt:hover, .mode-vs .opt:hover { border-color: var(--c); }
.opt:active { transform: translateY(1px); }
.opt.correct { border-color: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 35%, transparent); }
.opt.correct .num { background: var(--good); }
.opt.wrong { opacity: .5; }
.opt.wrong.picked { opacity: .85; border-color: var(--bad); }
.opt.picked::after { content: 'your pick'; position: absolute; top: 6px; right: 12px; font-size: 12px; font-weight: 700; color: var(--muted); z-index: 1; }
.lock-badge { font-weight: 800; color: var(--accent2); }

.reveal { width: min(960px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; text-align: center; animation: pop .35s ease; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.verdict { font-size: 18px; color: var(--muted); }
.verdict b { color: var(--text); }
.verdict .good { color: var(--good); font-weight: 800; }
.verdict .bad { color: var(--bad); font-weight: 800; }
.lang-name { font-size: clamp(30px, 4vw, 44px); font-weight: 900; margin-top: 4px; }
.lang-name .native { color: var(--accent2); font-weight: 700; margin-left: 8px; }
.lang-meta { color: var(--muted); }
.sentence { margin: 14px auto 0; max-width: 720px; font-size: 20px; font-style: italic; }
.sentence .translation { display: block; font-style: normal; color: var(--muted); font-size: 16px; margin-top: 4px; }
.fastest { margin-top: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; }
.fastest .lbl { color: var(--muted); font-weight: 700; margin-right: 4px; }
.chip { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.credit { margin-top: 14px; font-size: 13px; color: var(--muted); }
.controls { display: flex; gap: 12px; }

.side { background: rgba(8, 9, 26, .55); border-left: 1px solid var(--line); padding: 22px 18px 70px; display: flex; flex-direction: column; gap: 18px; }
.side h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.side-block.votes { text-align: center; padding: 10px 0; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); }
.big-num { font-size: 64px; font-weight: 900; line-height: 1; }
.big-num.bump { animation: bump .25s ease; }
@keyframes bump { 50% { transform: scale(1.15); color: var(--accent2); } }
.votes .label { color: var(--muted); font-weight: 600; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vs div { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.vs span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.vs b { font-size: 34px; }
.feed, .board { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 4px 0; font-weight: 600; color: var(--muted); animation: pop .25s ease; }
.board { counter-reset: b; }
.board li { counter-increment: b; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; font-weight: 700; }
.board li:not(.muted)::before { content: counter(b); color: var(--muted); width: 1.2em; }
.board li:nth-child(odd):not(.muted) { background: rgba(255,255,255,.03); }
.board li b { margin-left: auto; }
.who { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); font-weight: 500 !important; }
.side-help { margin-top: auto; text-align: center; color: var(--muted); background: var(--panel); border-radius: 14px; padding: 12px; border: 1px dashed var(--line); }
.side-help b { color: var(--text); font-size: 1.2em; }

.is-solo .watermark { display: none; } /* vandens ženklas reikalingas tik transliacijai */
.watermark { position: fixed; left: 16px; bottom: 14px; z-index: 5; font-weight: 800; font-size: 18px; padding: 6px 14px; border-radius: 12px; background: rgba(0,0,0,.4); border: 1px solid var(--line); }

/* ── final ── */
.final { max-width: 820px; margin: 0 auto; padding: 48px 16px 90px; text-align: center; }
.final h1 { font-size: clamp(32px, 5vw, 48px); margin: 0 0 20px; }
.final-score { font-size: 120px; font-weight: 900; line-height: 1; }
.final-score span { font-size: 40px; color: var(--muted); }
.squares { font-size: 28px; letter-spacing: 2px; margin: 18px 0 6px; }
.final-msg { color: var(--muted); font-size: 18px; }
.final-actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; }
.vs-final { font-size: 30px; font-weight: 900; margin-bottom: 20px; }
.vs-final b { color: var(--accent2); margin-left: 10px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 10px 0 18px; }
.podium-col { width: min(200px, 30vw); }
.podium-name { font-weight: 900; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-score { color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.podium-block { display: grid; place-items: center; border-radius: 14px 14px 4px 4px; font-size: 40px; font-weight: 900; background: var(--panel2); border: 1px solid var(--line); }
.place-1 .podium-block { height: 150px; background: linear-gradient(180deg, #ffcf4a, #b8860b); color: #2a1d00; }
.place-2 .podium-block { height: 110px; background: linear-gradient(180deg, #e3e7f5, #8d93ad); color: #1c1f2e; }
.place-3 .podium-block { height: 80px; background: linear-gradient(180deg, #f0a26a, #9a5a2c); color: #2a1407; }
.final-board { max-width: 420px; margin: 0 auto; text-align: left; counter-reset: none; }
.final-board li::before { content: none !important; }
.final-board .rank { color: var(--muted); width: 1.6em; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--panel2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); white-space: pre-line;
  transition: opacity .2s, transform .2s; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .game.is-stream { grid-template-columns: 1fr; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .options { grid-template-columns: 1fr; gap: 10px; }
  .opt { min-height: 64px; padding: 14px 16px; }
  .stage { gap: 14px; }
  .watermark { font-size: 14px; }
  .final-score { font-size: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
