:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f1f4f9;
  --input: #ffffff;
  --line: #e3e7ef;
  --line-2: #cfd6e3;
  --text: #1f2430;
  --muted: #5f6b7d;
  --primary: #3369e8;
  --primary-dark: #2453c4;
  --primary-soft: #e8effd;
  --red: #d50f25;
  --yellow: #eeb211;
  --green: #009925;
  --hot: #d50f25;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 2px 8px rgba(31, 36, 48, .06);
  --shadow-lg: 0 10px 30px rgba(31, 36, 48, .14);
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); line-height: 1.6; background: var(--bg); }
img { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-dark); }
code { background: var(--primary-soft); color: var(--primary-dark); padding: .1em .4em; border-radius: 5px; font-size: .9em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
::selection { background: rgba(51, 105, 232, .25); }

.container { max-width: 1260px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */

.site-header { position: sticky; top: 0; z-index: 50; background: #fff; color: var(--text); border-bottom: 1px solid var(--line); box-shadow: 0 1px 4px rgba(31, 36, 48, .06); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: 6px 0; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand img { border-radius: 9px; }
.header-tools { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
.tool-btn { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: #3d4555; font: inherit; font-weight: 500; font-size: .92rem; text-decoration: none; cursor: pointer; transition: background .15s, color .15s; }
.tool-btn:hover, .tool-btn[aria-expanded="true"] { color: var(--text); background: var(--card-2); }
.tool-btn svg { flex: none; }
.tool-btn.tool-cta { background: var(--primary); color: #fff; font-weight: 700; margin-left: 6px; }
.tool-btn.tool-cta:hover { background: var(--primary-dark); color: #fff; }
.account { position: relative; margin-left: 4px; }
.account-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 6px; border: 0; border-radius: 999px; background: var(--card-2); cursor: pointer; font: inherit; font-weight: 600; font-size: .86rem; }
.account-btn img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #ddd; }
.account-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: 12px 14px; background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 70; }
.account-menu p { margin: 0 0 8px; font-size: .82rem; color: var(--muted); word-break: break-all; }
body.is-wheel #hdrNew span { /* label set in JS */ }
.more { position: relative; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; padding: 6px 0; display: grid; background: #fff; border-radius: 6px; box-shadow: var(--shadow-lg); z-index: 60; }
.more-menu a { padding: 10px 18px; color: var(--text); text-decoration: none; font-size: .94rem; }
.more-menu a:hover { background: var(--card-2); color: var(--text); }

@media (max-width: 760px) {
  .tool-btn:not(.tool-cta) span:not(.live-dot) { display: none; }
  .tool-btn { padding: 0 10px; }
  .brand span { font-size: 1.05rem; }
  .account-btn span { display: none; }
}
@media (max-width: 400px) { .brand span { display: none; } }

/* ---------- Page intro ---------- */

.page-intro { padding: 22px 20px 0; }
.page-intro h1 { margin: 0 0 10px; font-size: clamp(1.45rem, 3.2vw, 2.15rem); line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
.page-intro .intro-lead { margin: 0; color: var(--muted); max-width: 920px; font-size: 1.05rem; }
.page-intro .intro-lead strong { color: var(--text); font-weight: 700; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green); background: #e6f5ea; padding: 4px 12px; border-radius: 999px; margin-bottom: 12px; }
.grad-text { color: var(--primary); }

/* ---------- Game layout ---------- */

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; padding-top: 20px; }
.game-layout > * { min-width: 0; }
@media (max-width: 980px) { .game-layout { grid-template-columns: minmax(0, 1fr); } }

.stage { position: relative; display: flex; flex-direction: column; background: #dfe6f2; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
#game { display: block; width: 100%; height: min(68vh, 680px); min-height: 400px; cursor: pointer; touch-action: manipulation; background: #fff; }
body.is-wheel .stage { background: #eef1f7; }
body.is-wheel #game { height: min(72vh, 760px); min-height: 440px; background: #fff; }
@media (max-width: 980px) { #game { height: 58vh; min-height: 340px; } }
.stage:fullscreen { display: flex; flex-direction: column; border-radius: 0; border: 0; }
.stage:fullscreen #game { flex: 1; height: auto; min-height: 0; }

.live-board { position: absolute; left: 12px; top: 12px; z-index: 2; background: rgba(255, 255, 255, .96); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 10px 12px; min-width: 160px; max-width: 230px; font-size: .82rem; pointer-events: none; box-shadow: var(--shadow-lg); }
.live-title { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: var(--primary); font-weight: 800; margin-bottom: 4px; }
.live-board ol { list-style: none; margin: 0; padding: 0; }
.live-board li { display: flex; align-items: center; gap: 7px; line-height: 1.75; }
.live-board li.done .nm { color: var(--green); font-weight: 700; }
.live-board .pos { width: 18px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.live-board .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, .08); }
.live-board .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-board .tm { font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-width: 520px) { .live-board { font-size: .74rem; min-width: 120px; max-width: 160px; } }

.stage-live { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #f3c2c8; color: var(--text); padding: 5px 12px 5px 6px; border-radius: 999px; font-size: .8rem; font-weight: 600; box-shadow: var(--shadow); pointer-events: none; max-width: calc(100% - 360px); white-space: nowrap; }
.stage-live .st-title { overflow: hidden; text-overflow: ellipsis; }
.stage-live .st-count { color: var(--muted); }
@media (max-width: 700px) { .stage-live { max-width: calc(100% - 40px); top: auto; bottom: 74px; } }

.stage-hud { position: absolute; right: 12px; top: 12px; z-index: 2; display: grid; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: var(--shadow); pointer-events: none; text-align: right; max-width: 46%; }
.stage-hud strong { font-size: .92rem; }
.stage-hud span { font-size: .8rem; color: var(--muted); font-weight: 600; }
@media (max-width: 700px) { .stage-hud { right: 10px; top: auto; bottom: 16px; } }

.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #fff; border-top: 1px solid var(--line); flex-wrap: wrap; z-index: 3; }
.stage-tools, .stage-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stage-hint { font-weight: 600; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(42vw, 360px); }
.stage-actions .btn-primary { min-width: 132px; }
.is-viewer .stage-actions { display: none; }
@media (max-width: 640px) {
  .stage-hint { display: none; }
  .stage-bar { padding: 8px 10px; }
}
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--card-2); color: var(--text); }
.icon-btn .i-off { display: none; }
.icon-btn[aria-pressed="false"] .i-on { display: none; }
.icon-btn[aria-pressed="false"] .i-off { display: block; }

/* ---------- Buttons ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, box-shadow .15s, border-color .15s, opacity .15s; line-height: 1.2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(51, 105, 232, .35); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); color: #fff; box-shadow: 0 3px 8px rgba(51, 105, 232, .35); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--card-2); color: var(--text); }
.btn-lg { padding: 12px 28px; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; }
.btn-block { width: 100%; margin-top: 12px; }
.btn-sm { padding: 7px 12px; font-size: .86rem; white-space: nowrap; }
.btn-live { background: var(--red); color: #fff; box-shadow: 0 1px 3px rgba(213, 15, 37, .35); }
.btn-live:hover:not(:disabled) { background: #b30c1f; color: #fff; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Side panel ---------- */

.side { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 16px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: -4px -16px 14px; padding: 0 8px; }
.tabs [role="tab"] { flex: 1; border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 10px; font-weight: 600; cursor: pointer; color: var(--muted); text-transform: uppercase; font-size: .85rem; letter-spacing: .04em; transition: color .15s, border-color .15s; }
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.pill { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .76rem; line-height: 20px; margin-left: 4px; }

fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain:disabled .entries, fieldset.plain:disabled .toolbar, fieldset.plain:disabled .add-form { opacity: .5; }

input[type="text"], input[type="email"], textarea, select {
  background: var(--input); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="email"]:focus, textarea:focus, select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(51, 105, 232, .18); }
::placeholder { color: #8a94a6; }

.add-form { display: flex; gap: 8px; }
.add-form input { flex: 1; min-width: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tool { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 10px; font-size: .82rem; font-weight: 500; cursor: pointer; color: var(--muted); transition: color .15s, border-color .15s, background .15s; }
.tool:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.tool-danger:hover { border-color: var(--red); color: var(--red); background: #fdecee; }
label.tool:focus-within { outline: 2px solid var(--primary); }

.bulk { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: var(--card-2); }
.bulk label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.bulk textarea { width: 100%; resize: vertical; margin-top: 6px; }
.bulk-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.elim-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; background: #fdecee; border: 1px solid #f6c3c9; color: #9b0b1b; border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; font-size: .84rem; font-weight: 600; }
.elim-bar .link-btn { color: var(--red); font-weight: 700; }

.entries { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.entry { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; transition: background .15s; }
.entry:hover { background: var(--card-2); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); color: #fff; font-weight: 700; cursor: pointer; overflow: hidden; padding: 0; display: inline-flex; align-items: center; justify-content: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); font-size: .9rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.entry-name { flex: 1; min-width: 0; border: 1px solid transparent !important; background: transparent !important; padding: 5px 6px !important; border-radius: 6px !important; box-shadow: none !important; }
.entry-name:hover { border-color: var(--line) !important; }
.entry-name:focus { border-color: var(--primary) !important; background: #fff !important; }
.entry-color { flex: none; width: 24px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }
.entry-color::-webkit-color-swatch-wrapper { padding: 0; }
.entry-color::-webkit-color-swatch { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); }
.entry-color::-moz-color-swatch { border-radius: 50%; border: 2px solid #fff; }
.mini { flex: none; width: 30px; height: 30px; border: 0; background: transparent; border-radius: 50%; color: #8a94a6; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: color .15s, background .15s; }
.mini:hover { background: var(--line); color: var(--text); }
.mini-danger:hover { color: var(--red); background: #fdecee; }
.entry.is-out .entry-name { text-decoration: line-through; color: #8a94a6; }
.entry.is-out .avatar { filter: grayscale(1); opacity: .45; }
.out-badge { flex: none; font-size: .66rem; font-weight: 700; color: var(--red); background: #fdecee; border-radius: 999px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .05em; }
.empty { color: var(--muted); font-size: .9rem; text-align: center; padding: 16px 6px; margin: 0; }

.settings { display: grid; gap: 14px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field { display: grid; gap: 6px; }
.field span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.field select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row select { flex: 1; }
.hint { margin: 0; font-size: .8rem; font-weight: 400; color: var(--muted); line-height: 1.45; }
.palette-row { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-btn { width: 44px; height: 28px; border: 2px solid #fff; border-radius: 8px; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; background: conic-gradient(from 90deg, var(--c0), var(--c1), var(--c2), var(--c3), var(--c0)); }
.palette-btn:hover, .palette-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.asset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.asset-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f3f5f8; }
.asset-thumb.is-round { border-radius: 50%; }
body.is-wheel .entry-color { width: 30px; height: 30px; }
.settings textarea { width: 100%; min-height: 118px; resize: vertical; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.check { display: flex; align-items: center; gap: 10px; font-size: .94rem; cursor: pointer; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.results { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.results li { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.results .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, .06); }
.results div { display: grid; min-width: 0; }
.results strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results small { color: var(--muted); }
.results li.is-champion strong::before { content: "★ "; color: var(--yellow); }

/* ---------- Live rooms ---------- */

.live-box { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--radius); padding: 14px 16px 16px; box-shadow: var(--shadow); }
.live-box p { margin: 6px 0 12px; font-size: .9rem; color: var(--muted); }
.live-state { display: none; }
.live-box[data-state="idle"] [data-for="idle"],
.live-box[data-state="host"] [data-for="host"],
.live-box[data-state="viewer"] [data-for="viewer"],
.live-box[data-state="ended"] [data-for="ended"] { display: block; }
.live-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.live-head h2 { margin: 0; font-size: 1.05rem; }
.live-watch { color: var(--muted); font-size: .86rem; white-space: nowrap; }
.live-watch strong { color: var(--text); }
.live-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--red); color: #fff; font-weight: 700; font-size: .7rem; letter-spacing: .1em; padding: 3px 10px; border-radius: 999px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; animation: livePulse 1.4s ease-in-out infinite; }
.btn-live .live-dot, .live-pill .live-dot { background: #fff; }
@keyframes livePulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.75); } }

.join-form { display: flex; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.join-form input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; font-size: .9rem; padding: 8px 10px; }
.join-form input::placeholder { letter-spacing: .02em; font-weight: 400; text-transform: none; }

.room-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 10px; background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 12px; }
.room-code small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.room-code strong { font-size: 1.5rem; letter-spacing: .22em; font-variant-numeric: tabular-nums; color: var(--primary); }
.live-title-input { width: 100%; margin-bottom: 8px; font-weight: 500; }
.live-link { display: flex; gap: 6px; margin-bottom: 10px; }
.live-link input { flex: 1; min-width: 0; font-size: .82rem; color: var(--muted); padding: 8px 10px; background: var(--card-2); }
.share-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.share-btn { flex: 1; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 600; transition: background .15s, color .15s, border-color .15s; }
.share-btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.share-btn[data-share="whatsapp"]:hover { color: #128c4b; border-color: #25d366; background: #e9fbf0; }
.share-btn svg { flex: none; }
.live-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.live-end { color: var(--red); font-size: .85rem; }
.viewer-meta { margin: 10px 0 12px; }
.viewer-meta .vm-title { font-size: 1.15rem; font-weight: 700; line-height: 1.3; word-break: break-word; }
.viewer-meta .vm-host { color: var(--muted); font-size: .88rem; }

.is-viewer .host-only { display: none !important; }
.is-viewer .entry .mini, .is-viewer .entry .entry-color { display: none; }
.viewer-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #eef4ff; color: #1d4ed8; font-size: .9rem; font-weight: 600; line-height: 1.4; }

/* Dialogs */
.live-dialog { border: 0; padding: 0; border-radius: 10px; max-width: 460px; width: calc(100% - 32px); background: #fff; color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.live-dialog::backdrop { background: rgba(20, 24, 33, .5); }
.live-form { padding: 22px 24px; display: grid; gap: 14px; }
.live-form h2 { margin: 0; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.live-form p { margin: -6px 0 0; color: var(--muted); font-size: .92rem; }
.live-form label.f { display: grid; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.live-form label.f input { font-weight: 400; font-size: 1rem; color: var(--text); }
.live-form .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- Activity counter ---------- */

.stats-strip { display: flex; flex-wrap: wrap; gap: 20px 64px; }
.stat-label { display: block; color: var(--muted); font-size: 1rem; }
.stat-num { display: block; font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); line-height: 1.2; }
.stat + .stat .stat-num { color: var(--green); }

/* Header live button + live room dialog */
.tool-btn .live-dot { width: 9px; height: 9px; background: var(--red); animation: none; }
.tool-btn.is-live { background: var(--red); color: #fff; }
.tool-btn.is-live .live-dot { background: #fff; animation: livePulse 1.4s ease-in-out infinite; }
.tool-btn.is-live:hover { background: #b30c1f; color: #fff; }
.live-room-body { position: relative; padding: 22px 24px 24px; }
.live-room .live-box { border: 0; border-top: 0; box-shadow: none; padding: 0; }
.live-room .live-head { padding-right: 40px; min-height: 32px; }
.live-room .live-head h2 { font-size: 1.3rem; }
.dlg-close { position: absolute; right: 14px; top: 14px; z-index: 2; }

/* ---------- Content ---------- */

.content { padding-top: 28px; padding-bottom: 40px; columns: 2 460px; column-gap: 20px; }
.content section { break-inside: avoid; display: inline-block; width: 100%; margin: 0 0 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 26px; }
.content section > :last-child { margin-bottom: 0; }
.content ul { padding-left: 22px; }
.content li { margin: 6px 0; }
.content h2 { font-size: 1.45rem; letter-spacing: -.01em; margin: 0 0 12px; }
.content h3 { margin: 0 0 6px; font-size: 1.08rem; }
.content p, .content li { color: #3d4555; }
.steps { list-style: none; counter-reset: s; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.steps li { counter-increment: s; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 18px 62px; position: relative; margin: 0; box-shadow: var(--shadow); }
.steps li::before { content: counter(s); position: absolute; left: 18px; top: 18px; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .92rem; }
.steps li:nth-child(4n+2)::before { background: var(--red); }
.steps li:nth-child(4n+3)::before { background: var(--yellow); }
.steps li:nth-child(4n+4)::before { background: var(--green); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--primary); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card:nth-child(4n+2) { border-top-color: var(--red); }
.card:nth-child(4n+3) { border-top-color: var(--yellow); }
.card:nth-child(4n+4) { border-top-color: var(--green); }
.card p { margin: 0; }
.feature-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.feature-list li { padding-left: 30px; position: relative; }
.feature-list li::before { content: "✓"; position: absolute; left: 0; top: .2em; width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #fff; font-size: .72rem; font-weight: 900; display: grid; place-items: center; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

details { background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
details[open] { box-shadow: var(--shadow); }
summary { font-weight: 600; cursor: pointer; padding: 15px 48px 15px 18px; list-style: none; position: relative; color: var(--text); }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; position: absolute; right: 20px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
details p { margin: 0; padding: 0 18px 18px; }

/* Legal / info pages */
.page { max-width: 860px; padding-top: 36px; padding-bottom: 60px; }
.page h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); letter-spacing: -.02em; margin: 0 0 6px; }
.page .updated { color: var(--muted); margin-top: 0; }
.page h2 { margin-top: 34px; font-size: 1.25rem; }
.page p, .page li { color: #3d4555; }
.contact-form { display: grid; gap: 14px; background: var(--card); border: 1px solid var(--line); padding: 22px; border-radius: var(--radius); box-shadow: var(--shadow); }
.contact-form label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.contact-form input, .contact-form textarea, .contact-form select { font-weight: 400; }
.contact-form button { justify-self: start; }
.contact-form small { color: var(--muted); }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 30px 0 20px; margin-top: 30px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-inner p { margin: 10px 0 0; max-width: 420px; color: var(--muted); font-size: .9rem; }
.site-footer .brand { color: var(--text); }
.site-footer .brand img { background: none; }
.brand-footer { font-size: 1.05rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.site-footer nav a, .site-footer .link-btn { color: var(--muted); text-decoration: none; font-size: .9rem; }
.site-footer nav a:hover, .site-footer .link-btn:hover { color: var(--primary); }
.copyright { color: #8a94a6; font-size: .82rem; margin-top: 22px; }

/* ---------- Result dialog ---------- */

.result-dialog { border: 0; padding: 0; border-radius: 16px; max-width: 440px; width: calc(100% - 32px); background: #fff; color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); overflow: hidden; position: relative; }
.result-dialog::backdrop { background: rgba(20, 24, 33, .55); }
.result-dialog.is-win { animation: dialogPop .35s cubic-bezier(.2, 1.2, .3, 1); }
.result-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.result-fx i { position: absolute; top: -16px; border-radius: 2px; animation: confettiFall linear forwards; }
.result-card { position: relative; z-index: 1; padding: 0 24px 22px; text-align: center; }
.result-card::before { content: ""; display: block; height: 6px; margin: 0 -24px 22px; background: linear-gradient(90deg, var(--primary) 0 25%, var(--red) 25% 50%, var(--yellow) 50% 75%, var(--green) 75%); }
.result-burst { display: none; font-size: 2rem; line-height: 1; color: var(--yellow); margin: 0 0 6px; }
.result-dialog.is-win .result-burst { display: block; animation: starSpin .7s ease-out; }
.result-avatar { width: 116px; height: 116px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.8rem; font-weight: 800; color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, .25); overflow: hidden; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--primary), 0 10px 24px rgba(0, 0, 0, .18); }
.result-avatar.pop { animation: popIn .45s cubic-bezier(.2, 1.4, .3, 1); }
.result-avatar.is-loser { box-shadow: 0 0 0 3px var(--red), 0 8px 20px rgba(0, 0, 0, .18); }
.result-avatar img { width: 100%; height: 100%; object-fit: cover; }
.result-kicker { margin: 0; text-transform: uppercase; letter-spacing: .16em; font-weight: 800; font-size: .8rem; color: var(--green); }
.result-avatar.is-loser + .result-kicker { color: var(--red); }
.result-name { margin: 6px 0; font-size: clamp(1.8rem, 6vw, 2.5rem); font-weight: 800; line-height: 1.15; word-break: break-word; }
.result-name.pop { animation: namePop .55s cubic-bezier(.2, 1.5, .3, 1); }
.result-dialog.is-win .result-name { color: var(--primary); }
.result-sub { margin: 0 0 20px; color: var(--muted); }
.result-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.stat-num.is-tick { animation: countTick .55s ease; }

@keyframes dialogPop { from { transform: scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } 100% { transform: none; } }
@keyframes namePop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.18); opacity: 1; } 100% { transform: none; } }
@keyframes starSpin { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 60% { transform: scale(1.4) rotate(12deg); opacity: 1; } 100% { transform: none; } }
@keyframes confettiFall { 0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; } 100% { transform: translate3d(var(--x), 420px, 0) rotate(540deg); opacity: 0; } }
@keyframes countTick { 0% { transform: scale(1); } 40% { transform: scale(1.18); color: var(--primary); } 100% { transform: none; } }

/* ---------- Toast ---------- */

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #323232; color: #fff; padding: 12px 18px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); z-index: 200; max-width: calc(100% - 32px); font-size: .93rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card { transition: none; }
  .live-dot, .result-fx i, .result-name.pop, .result-avatar.pop, .result-dialog.is-win, .result-burst, .stat-num.is-tick { animation: none; }
}
