/* ============ Ranglar va o'lchamlar ============ */
:root {
  color-scheme: light;
  --bg: #f3f5fa;
  --bg-glow-1: rgba(124, 58, 237, 0.12);
  --bg-glow-2: rgba(37, 99, 235, 0.09);
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eaedf5;
  --border: #e0e4ee;
  --border-strong: #c9cfdd;
  --text: #121826;
  --muted: #586178;
  --faint: #8a92a6;
  --primary: #6d28d9;
  --primary-2: #7c3aed;
  --primary-soft: #efe9fd;
  --on-primary: #ffffff;
  --t1: #2563eb;
  --t1-strong: #1d4ed8;
  --t1-soft: #e3ebfd;
  --t2: #ea580c;
  --t2-strong: #c2410c;
  --t2-soft: #fdebdd;
  --t3: #0d9488;
  --t3-strong: #0f766e;
  --t3-soft: #d5f3ef;
  --t4: #db2777;
  --t4-strong: #be185d;
  --t4-soft: #fce1ee;
  --t5: #9333ea;
  --t5-strong: #7e22ce;
  --t5-soft: #f1e4fd;
  --t6: #ca8a04;
  --t6-strong: #a16207;
  --t6-soft: #fbf0cf;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --ok-line: #22c55e;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --bad-line: #ef4444;
  --gold: #b45309;
  --gold-bg: #fef3c7;
  --mk-cause: #e6dcfd;
  --mk-motor: #fbd5d5;
  --mk-sens: #fcecb3;
  --mk-keep: #cff3dc;
  --g1: #4f46e5;
  --g2: #0d9488;
  --g3: #db2777;
  --g4: #d97706;
  --shadow-sm: 0 1px 2px rgba(18, 24, 38, 0.06);
  --shadow: 0 1px 2px rgba(18, 24, 38, 0.05), 0 12px 32px -14px rgba(18, 24, 38, 0.2);
  --radius: 20px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-latin: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1019;
    --bg-glow-1: rgba(124, 58, 237, 0.2);
    --bg-glow-2: rgba(37, 99, 235, 0.14);
    --surface: #151b28;
    --surface-2: #1b2232;
    --surface-3: #252d40;
    --border: #283047;
    --border-strong: #3a445e;
    --text: #eef1f7;
    --muted: #a6aec1;
    --faint: #737c93;
    --primary: #7c3aed;
    --primary-2: #a78bfa;
    --primary-soft: #2a2047;
    --t1: #5b8fff;
    --t1-strong: #8cb0ff;
    --t1-soft: #172648;
    --t2: #fb8c3f;
    --t2-strong: #ffad73;
    --t2-soft: #3b2314;
    --t3: #2dd4bf;
    --t3-strong: #5eead4;
    --t3-soft: #0f302d;
    --t4: #f472b6;
    --t4-strong: #f9a8d4;
    --t4-soft: #3d1529;
    --t5: #c084fc;
    --t5-strong: #d8b4fe;
    --t5-soft: #2e1a47;
    --t6: #facc15;
    --t6-strong: #fde047;
    --t6-soft: #3a300b;
    --ok: #4ade80;
    --ok-bg: #11301e;
    --bad: #f87171;
    --bad-bg: #3b1518;
    --gold: #fbbf24;
    --gold-bg: #3a2c0c;
    --mk-cause: #3b2e66;
    --mk-motor: #5a2329;
    --mk-sens: #514113;
    --mk-keep: #17402a;
    --g1: #818cf8;
    --g2: #2dd4bf;
    --g3: #f472b6;
    --g4: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1019;
  --bg-glow-1: rgba(124, 58, 237, 0.2);
  --bg-glow-2: rgba(37, 99, 235, 0.14);
  --surface: #151b28;
  --surface-2: #1b2232;
  --surface-3: #252d40;
  --border: #283047;
  --border-strong: #3a445e;
  --text: #eef1f7;
  --muted: #a6aec1;
  --faint: #737c93;
  --primary: #7c3aed;
  --primary-2: #a78bfa;
  --primary-soft: #2a2047;
  --t1: #5b8fff;
  --t1-strong: #8cb0ff;
  --t1-soft: #172648;
  --t2: #fb8c3f;
  --t2-strong: #ffad73;
  --t2-soft: #3b2314;
  --t3: #2dd4bf;
  --t3-strong: #5eead4;
  --t3-soft: #0f302d;
  --t4: #f472b6;
  --t4-strong: #f9a8d4;
  --t4-soft: #3d1529;
  --t5: #c084fc;
  --t5-strong: #d8b4fe;
  --t5-soft: #2e1a47;
  --t6: #facc15;
  --t6-strong: #fde047;
  --t6-soft: #3a300b;
  --ok: #4ade80;
  --ok-bg: #11301e;
  --bad: #f87171;
  --bad-bg: #3b1518;
  --gold: #fbbf24;
  --gold-bg: #3a2c0c;
  --mk-cause: #3b2e66;
  --mk-motor: #5a2329;
  --mk-sens: #514113;
  --mk-keep: #17402a;
  --g1: #818cf8;
  --g2: #2dd4bf;
  --g3: #f472b6;
  --g4: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.7);
}

.t1 { --tc: var(--t1); --tc-strong: var(--t1-strong); --tc-soft: var(--t1-soft); }
.t2 { --tc: var(--t2); --tc-strong: var(--t2-strong); --tc-soft: var(--t2-soft); }
.t3 { --tc: var(--t3); --tc-strong: var(--t3-strong); --tc-soft: var(--t3-soft); }
.t4 { --tc: var(--t4); --tc-strong: var(--t4-strong); --tc-soft: var(--t4-soft); }
.t5 { --tc: var(--t5); --tc-strong: var(--t5-strong); --tc-soft: var(--t5-soft); }
.t6 { --tc: var(--t6); --tc-strong: var(--t6-strong); --tc-soft: var(--t6-soft); }

/* ============ Asos ============ */
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
@media (min-width: 1700px) { html { font-size: 18px; } }
@media (min-width: 2300px) { html { font-size: 22px; } }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 0% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--muted); }

.ic {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em;
}
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--tc); flex: none; box-shadow: 0 0 0 3px var(--tc-soft); }

.container { max-width: 1340px; margin: 0 auto; padding: clamp(16px, 2.6vw, 32px); }
.screen { animation: fadeIn 0.28s ease both; }

.site-footer {
  max-width: 1340px; margin: 0 auto;
  padding: 18px clamp(16px, 2.6vw, 32px) 28px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem; color: var(--faint); text-align: center;
}
.site-footer b { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 2.2vw, 28px);
}

/* ============ Tugmalar ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform 0.12s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--on-primary); border-color: transparent;
  box-shadow: 0 10px 22px -10px var(--primary);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
:root[data-theme="dark"] .btn.soft { color: var(--primary-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.soft { color: var(--primary-2); } }
.btn.small { padding: 8px 14px; font-size: 0.9rem; border-radius: 10px; }
.btn.big { padding: 15px 26px; font-size: 1.1rem; border-radius: 16px; }
.link {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}

.seg-group { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; }
.seg {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px;
  font-weight: 700; font-size: 0.92rem; color: var(--muted); cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.seg:hover:not(:disabled) { color: var(--text); }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg:disabled { cursor: default; }
.team-seg.active { background: var(--tc); color: #fff; }
.team-seg:disabled:not(.active) { opacity: 0.5; }

.kicker {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
}
:root[data-theme="dark"] .kicker { color: var(--primary-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kicker { color: var(--primary-2); } }
.lead { font-size: clamp(1.05rem, 1.5vw, 1.22rem); color: var(--muted); max-width: 62ch; }
.lead b { color: var(--text); }

/* ============ Yuqori panel ============ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px clamp(16px, 2.6vw, 32px);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  box-shadow: 0 8px 18px -8px var(--primary);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text { font-weight: 900; font-size: 1.15rem; line-height: 1.05; }
.brand-text small { display: block; font-size: 0.72rem; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }

.scoreboard { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; min-width: 0; }
.topbar.many { flex-wrap: wrap; row-gap: 8px; }
.topbar.many .scoreboard { order: 3; width: 100%; justify-content: center; margin-left: 0; gap: 6px; }
.topbar.many .pill { padding: 3px 12px 3px 10px; gap: 6px; }
.topbar.many .pill-name { max-width: 10ch; font-size: 0.95rem; }
.topbar.many .pill-score { font-size: 1.1rem; }
.topbar.many .tools { margin-left: auto; }
.vs { font-size: 0.75rem; font-weight: 800; color: var(--faint); text-transform: uppercase; }
.pill {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 5px 14px 5px 12px; border-radius: 999px;
  background: var(--surface); border: 2px solid var(--tc);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.pill:focus-visible { outline-offset: 3px; border-radius: 999px; }
.pill.bump { animation: bump 0.5s ease; }
.pill-name { font-weight: 700; max-width: 13ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-score { min-width: 2.4ch; text-align: center; font-size: 1.3rem; font-weight: 900; color: var(--tc); font-variant-numeric: tabular-nums; }
/* Ballni qo'lda tuzatish: pill ostida ochiladigan popover (joylashuv siljimaydi). */
.pill-adj-wrap {
  position: absolute; z-index: 40; top: 100%; left: 50%; transform: translate(-50%, -4px);
  display: flex; gap: 4px; padding-top: 8px;
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.pill:hover .pill-adj-wrap, .pill:focus-within .pill-adj-wrap { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.pill-adj {
  padding: 6px 10px; border-radius: 10px; border: 1px solid var(--tc); cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--tc-strong); font-weight: 900; font-size: 0.85rem; line-height: 1;
  box-shadow: var(--shadow);
}
.pill-adj:hover { background: var(--tc-soft); }
.tools { display: flex; gap: 6px; flex: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; transition: border-color 0.2s, background-color 0.2s;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn .ic { width: 20px; height: 20px; vertical-align: 0; }

.float-pts {
  position: fixed; z-index: 60; pointer-events: none;
  font-weight: 900; font-size: 1.5rem; color: var(--tc);
  text-shadow: 0 2px 10px var(--surface);
  animation: floatUp 1.15s ease-out forwards;
}

/* ============ Bosh sahifa ============ */
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(16px, 3vw, 40px); align-items: center; padding: clamp(4px, 2vw, 20px) 0 clamp(20px, 3vw, 36px); }
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 4.3rem); font-weight: 900; margin: 16px 0 14px; letter-spacing: -0.03em; }
.grad { background: linear-gradient(90deg, var(--t1), var(--primary-2) 50%, var(--t2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-art { position: relative; text-align: center; }
.plexus-art { width: 100%; height: auto; max-height: 300px; overflow: visible; }
.plexus-art .s1 { stop-color: var(--t1); }
.plexus-art .s2 { stop-color: var(--primary-2); }
.plexus-art .s3 { stop-color: var(--t2); }
.pl-lines { opacity: 0.55; }
.pl-flow path { stroke: #fff; stroke-opacity: 0.9; stroke-dasharray: 6 22; animation: flow 1.4s linear infinite; mix-blend-mode: overlay; }
.pl-flow .pl-radial { stroke: var(--t1); stroke-opacity: 1; mix-blend-mode: normal; stroke-dasharray: 10 12; }
.pl-nodes circle { fill: var(--surface); stroke: var(--primary-2); stroke-width: 3; }
.pl-roots text { font: 700 15px var(--font); fill: var(--muted); }
.pl-names text { font: italic 15px var(--font-latin); fill: var(--muted); }
.pl-names .hot { fill: var(--t1); font-weight: 700; }
.art-caption { display: inline-block; margin-top: 6px; font: italic 0.95rem var(--font-latin); color: var(--faint); }

.teams-card { margin-bottom: clamp(20px, 3vw, 36px); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 1.35rem; margin-bottom: 4px; }
.card-head p { font-size: 0.95rem; }
.card-head .btn { flex: none; white-space: nowrap; }
.team-count { margin-bottom: 16px; }
.small-note { font-weight: 600; font-size: 0.9rem; }
.team-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.team-input {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 16px;
  background: var(--tc-soft); border: 2px solid transparent;
  transition: border-color 0.2s;
}
.team-input:focus-within { border-color: var(--tc); }
.team-input input {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 1.2rem; font-weight: 800; color: var(--text); padding: 6px 0;
}
.ti-score { font-size: 1.5rem; font-weight: 900; color: var(--tc); font-variant-numeric: tabular-nums; }
.ti-unit { font-size: 0.85rem; color: var(--muted); }

.section-title { font-size: 1.5rem; margin-bottom: 16px; }
.games { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.game-card {
  --gc: var(--g1);
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); text-decoration: none; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.game-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--gc); }
.game-card:hover { transform: translateY(-4px); border-color: var(--gc); box-shadow: 0 18px 40px -18px var(--gc); }
.g1 { --gc: var(--g1); } .g2 { --gc: var(--g2); } .g3 { --gc: var(--g3); } .g4 { --gc: var(--g4); }
.gc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.gicon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none;
  color: var(--gc); background: color-mix(in srgb, var(--gc) 14%, transparent);
}
.gicon .ic { width: 24px; height: 24px; vertical-align: 0; }
.step { font-size: 0.78rem; font-weight: 800; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.game-card h3 { font-size: 1.3rem; }
.gsub { font-size: 0.9rem; font-weight: 700; color: var(--gc); }
.game-card p { color: var(--muted); font-size: 0.95rem; flex: 1; }
.gmeta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 0.88rem; color: var(--muted); }
.go { font-weight: 800; color: var(--gc); display: inline-flex; align-items: center; gap: 4px; }

/* ============ Ichki sahifalar: sarlavha qatori ============ */
.bar-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; min-height: 40px; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 700; font-size: 0.92rem; text-decoration: none; cursor: pointer; color: var(--text);
}
.crumb:hover { border-color: var(--border-strong); }
.bar-title { font-weight: 800; color: var(--muted); }
.prog { margin-left: auto; display: flex; align-items: center; gap: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.prog-track { width: clamp(80px, 14vw, 200px); height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.prog-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width 0.4s; }

/* ============ O'yin kirish sahifasi ============ */
.intro { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.intro-head { display: flex; align-items: center; gap: 16px; }
.intro-head .gicon { width: 60px; height: 60px; border-radius: 18px; }
.intro-head .gicon .ic { width: 30px; height: 30px; }
.intro-head h1 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); margin-top: 8px; font-weight: 900; }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.rule { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 14px 16px; border-radius: 14px; background: var(--tc-soft); border-left: 5px solid var(--tc); }
.rule b { font-size: 1.1rem; }
.rule span:last-child { width: 100%; color: var(--muted); }
.rule u { text-decoration-color: var(--tc); text-decoration-thickness: 3px; text-underline-offset: 3px; color: var(--text); font-weight: 800; }
.example {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px 20px;
  padding: 18px; border-radius: 16px; background: var(--surface-2); border: 1px dashed var(--border-strong);
}
.ex-lat { font: italic 2rem var(--font-latin); }
.ex-arrow { color: var(--faint); }
.ex-uz { font-size: 1.8rem; font-weight: 900; letter-spacing: 0.08em; }
.ex-ans { display: flex; gap: 8px; }
.chip { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 12px; background: var(--tc); color: #fff; font-weight: 900; font-size: 1.2rem; }
.chip.first { background: var(--t1); }
.chip.last { background: var(--t2); }
.notes { margin: 0; padding-left: 1.2em; color: var(--muted); display: grid; gap: 6px; }
.notes b { color: var(--text); }
.settings { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; padding: 16px 0 4px; border-top: 1px solid var(--border); }
.setting { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.intro > .btn.big { align-self: flex-start; }
.sub-title { font-size: 1.15rem; }
.set-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.set-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer;
  padding: 20px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-2);
  transition: border-color 0.2s, transform 0.15s, background-color 0.2s;
}
.set-card:hover { border-color: var(--g2); transform: translateY(-2px); background: var(--surface); }
.set-card b { font-size: 1.2rem; }
.set-card span { color: var(--muted); }
.set-card em { font-style: normal; font-weight: 800; font-size: 0.88rem; color: var(--g2); margin-top: 4px; }

/* ============ Duel: ikki guruh bir vaqtda ============ */
.duel-grid { display: grid; gap: clamp(12px, 1.6vw, 22px); align-items: stretch; }
.duel-grid.n2 { grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.35fr) minmax(240px, 1fr); }
.duel-grid.n1 { grid-template-columns: minmax(320px, 1.35fr) minmax(260px, 1fr); }
/* 3+ guruh: so'z chapda, guruh panellari o'ngda to'r bo'lib (proyektor ekraniga sig'ishi uchun). */
.duel-grid.nmany { grid-template-columns: minmax(250px, 0.85fr) minmax(0, 2fr); }
.duel-teams { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: clamp(10px, 1.2vw, 16px); align-content: start; }
.nmany .stage { min-height: 250px; }
.nmany .latin { font-size: clamp(2rem, min(5.5vw, calc(48vw / var(--len, 8))), 5rem); }
.nmany .statement { font-size: clamp(1.1rem, 1.7vw, 1.6rem); }
.nmany .uz-word { font-size: clamp(1.7rem, 3.2vw, 3rem); }
.nmany .team-panel { padding: 10px 12px 12px; gap: 8px; border-top-width: 5px; }
.nmany .tp-head b { font-size: 1.05rem; }
.nmany .tp-locked, .nmany .tp-result { min-height: 120px; padding: 12px; gap: 6px; }
.nmany .tp-locked .ic { width: 32px; height: 32px; }
.nmany .res-ic { width: 42px; height: 42px; }
.nmany .res-ic .ic { width: 24px; height: 24px; }
.nmany .res-title { font-size: 1.1rem; }
.nmany .res-ans { font-size: 1.5rem; }
.nmany .pad { gap: 4px; }
.nmany .key { aspect-ratio: auto; height: clamp(24px, 3.8vh, 38px); font-size: clamp(0.8rem, 1vw, 1.05rem); border-radius: 8px; }
.n1 .key { aspect-ratio: auto; height: clamp(34px, 6.5vh, 56px); }
.duel:has(.nmany) .hint { display: none; }
.nmany .pad-tf { gap: 8px; }
.nmany .key.tf { height: auto; padding: 14px 8px; font-size: 1.05rem; }
.team-panel {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--tc-soft); border-top: 6px solid var(--tc);
  box-shadow: var(--shadow);
  transition: border-color 0.3s, background-color 0.3s;
}
.team-panel.is-ok { border-color: var(--ok-line); }
.team-panel.is-bad { border-color: var(--bad-line); border-top-color: var(--tc); }
.team-panel.is-part { border-color: var(--gold); border-top-color: var(--tc); }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.slot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 10px; border-radius: 10px; border: 2px dashed var(--border-strong);
  font-size: 0.85rem; color: var(--muted);
}
.slot em { font-style: normal; font-weight: 700; }
.slot b { font-size: 1rem; }
.slot.current { border-style: solid; border-color: var(--tc); color: var(--tc-strong); background: var(--tc-soft); }
.slot.filled { border-style: solid; border-color: var(--ok-line); color: var(--ok); }
.slot .ic { width: 16px; height: 16px; stroke-width: 3; }
.tp-head { display: flex; align-items: center; gap: 10px; }
.tp-head b { display: block; font-size: 1.2rem; line-height: 1.2; overflow-wrap: anywhere; }
.tp-head em { font-style: normal; font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--tc); }
.pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.key {
  aspect-ratio: 1; min-width: 0; padding: 0;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 800; font-size: clamp(0.9rem, 1.25vw, 1.25rem); cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.key:hover { background: var(--tc-soft); border-color: var(--tc); color: var(--tc-strong); }
.key:active { transform: scale(0.94); }
.pad-tf { grid-template-columns: 1fr; gap: 12px; flex: 1; align-content: center; }
.key.tf { aspect-ratio: auto; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 26px 12px; font-size: 1.3rem; border-width: 2px; }
.key.tf .ic { width: 1.4em; height: 1.4em; }
.key.tf.yes:hover { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.key.tf.no:hover { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.tp-locked, .tp-result {
  flex: 1; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; border-radius: 16px; text-align: center;
}
.tp-locked { background: var(--tc-soft); color: var(--tc-strong); animation: popIn 0.25s ease both; }
.tp-locked .ic { width: 44px; height: 44px; }
.tp-locked b { font-size: 1.15rem; }
.tp-locked .link { font-size: 0.9rem; font-weight: 600; opacity: 0.85; }
.tp-result { animation: popIn 0.3s ease both; }
.is-ok .tp-result { background: var(--ok-bg); }
.is-bad .tp-result { background: var(--bad-bg); }
.is-part .tp-result { background: var(--gold-bg); }
.res-ic.part { background: var(--gold); }
.res-rows { display: grid; gap: 6px; width: 100%; max-width: 220px; }
.res-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px;
  background: var(--surface); font-weight: 800;
}
.res-row em { font-style: normal; font-weight: 700; font-size: 0.82rem; color: var(--muted); margin-right: auto; }
.res-row b { font-size: 1.2rem; }
.res-row s { opacity: 0.55; }
.res-row.ok { color: var(--ok); }
.res-row.bad b { color: var(--text); }
.res-row .ic { width: 18px; height: 18px; stroke-width: 3; }
.c-sep { color: var(--faint); margin: 0 6px; }
.res-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.res-ic.ok { background: var(--ok-line); }
.res-ic.bad { background: var(--bad-line); }
.res-ic .ic { width: 30px; height: 30px; stroke-width: 3; vertical-align: 0; }
.res-title { font-size: 1.35rem; }
.res-ans { font-size: 2rem; font-weight: 900; }
.res-ans.strike { text-decoration: line-through; opacity: 0.6; font-size: 1.5rem; }
.res-pts { font-weight: 900; color: var(--ok); font-size: 1.1rem; }
.res-correct { color: var(--muted); }
.res-correct b { color: var(--text); font-size: 1.2rem; }

.stage { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 18px; text-align: center; min-height: 420px; }
.stage-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage-label { font-size: 0.8rem; font-weight: 800; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.prompt { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; }
.latin {
  font-family: var(--font-latin); font-style: italic; font-weight: 600;
  font-size: clamp(2.4rem, min(7.5vw, calc(64vw / var(--len, 8))), 6.5rem); line-height: 1.05; overflow-wrap: anywhere;
  animation: popIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.statement { font-size: clamp(1.25rem, 2.2vw, 1.9rem); font-weight: 700; line-height: 1.35; max-width: 34ch; animation: popIn 0.35s ease both; }
.revealed .prompt { flex: 0; }
.revealed .latin { font-size: clamp(1.8rem, 3vw, 2.6rem); animation: none; color: var(--muted); }
.revealed .statement { font-size: clamp(1.05rem, 1.6vw, 1.3rem); animation: none; color: var(--muted); }
.reveal-box { display: flex; flex-direction: column; align-items: center; gap: 12px; animation: popIn 0.35s ease both; }
.uz-word { font-size: clamp(2.2rem, 4.6vw, 4.2rem); font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.1; }
.hl1, .hl2 { border-radius: 10px; padding: 0 0.08em; }
.hl1 { color: var(--t1); background: var(--t1-soft); }
.hl2 { color: var(--t2); background: var(--t2-soft); }
.reveal-sub { color: var(--muted); font-size: 1.05rem; }
.verdict-chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 999px; font-weight: 900; font-size: 1.4rem; letter-spacing: 0.05em; }
.verdict-chip.yes { background: var(--ok-bg); color: var(--ok); }
.verdict-chip.no { background: var(--bad-bg); color: var(--bad); }
.explain { font-size: 1.08rem; max-width: 46ch; }
.stage-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hint { margin-top: 14px; text-align: center; font-size: 0.88rem; color: var(--faint); }

/* Taymer */
.timer { position: relative; width: 66px; height: 66px; flex: none; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.timer-bar { fill: none; stroke: var(--primary-2); stroke-width: 5; stroke-linecap: round; transition: stroke 0.3s; }
.timer-num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.timer.low .timer-bar { stroke: var(--bad-line); }
.timer.low .timer-num { color: var(--bad); }
.timer.low { animation: pulse 1s ease-in-out infinite; }
.timer.done .timer-num { color: var(--faint); }
.revealed .timer { opacity: 0.35; animation: none; }

/* ============ Yakuniy oyna ============ */
.end { max-width: 960px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.end h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 900; }
.end-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 14px; width: min(100%, calc(var(--n, 2) * 280px)); }
.end-score {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 20px 16px 16px; border-radius: 18px; background: var(--tc-soft); border: 2px solid transparent;
}
.end-score.winner { border-color: var(--tc); box-shadow: 0 16px 36px -18px var(--tc); }
.end-score b { font-size: 2.6rem; font-weight: 900; color: var(--tc); line-height: 1.1; font-variant-numeric: tabular-nums; }
.end-score em { font-style: normal; color: var(--muted); font-size: 0.92rem; }
.es-name { font-weight: 800; font-size: 1.1rem; }
.crown { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-bg); color: var(--gold); box-shadow: var(--shadow-sm); }
.crown .ic { width: 20px; height: 20px; vertical-align: 0; fill: currentColor; }
.end-scores.compact { width: 100%; }
.end-scores.compact .end-score b { font-size: 2rem; }
.verdict { font-size: 1.2rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.table-wrap { width: 100%; overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
.sum { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.98rem; }
.sum th, .sum td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sum th { background: var(--surface-2); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
.sum th small { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--faint); }
.sum tr:last-child td { border-bottom: 0; }
.sum td.lat { font-family: var(--font-latin); font-style: italic; font-size: 1.1rem; }
.sum td.stmt { max-width: 46ch; }
.c-ok { color: var(--ok); font-weight: 800; white-space: nowrap; }
.c-bad { color: var(--bad); font-weight: 800; white-space: nowrap; }
.c-none { color: var(--faint); }

/* ============ Natijalar ============ */
.results { max-width: 900px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: clamp(8px, 3vw, 32px); }
.results h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 900; }
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 26px 18px; width: min(100%, calc(var(--n, 2) * 320px)); margin-top: 18px; }
.place { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--tc); }
.podium-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 34px 20px 24px; border-radius: 24px; background: var(--surface); border: 2px solid var(--tc-soft);
  box-shadow: var(--shadow);
}
.podium-card.winner { border-color: var(--tc); transform: translateY(-8px); box-shadow: 0 24px 50px -22px var(--tc); }
.podium-card .crown { width: 46px; height: 46px; top: -22px; }
.podium-card .crown .ic { width: 26px; height: 26px; }
.pname { font-size: 1.3rem; font-weight: 800; overflow-wrap: anywhere; }
.pscore { font-size: clamp(3.4rem, 8vw, 5.5rem); line-height: 1; font-weight: 900; color: var(--tc); font-variant-numeric: tabular-nums; }
.punit { color: var(--muted); font-weight: 700; }
.pbar { width: 100%; height: 10px; margin-top: 14px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--tc); border-radius: inherit; transition: width 0.6s; }

/* ============ Juftini top ============ */
.mem-moves { margin-left: auto; color: var(--muted); font-weight: 700; }
.mem-moves b { color: var(--text); font-variant-numeric: tabular-nums; }
.turns { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 12px 10px; margin-bottom: 14px; padding-top: 6px; }
.turn-team {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 14px; background: var(--surface); border: 2px solid var(--border);
  transition: border-color 0.25s, background-color 0.25s, box-shadow 0.25s, opacity 0.25s;
  opacity: 0.65;
}
.turn-team b { font-size: 1.1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-team .found { margin-left: auto; color: var(--muted); white-space: nowrap; }
.turn-team .found b { color: var(--tc); font-size: 1.2rem; }
.turn-flag { display: none; position: absolute; top: -10px; right: 10px; padding: 3px 10px; border-radius: 99px; background: var(--tc); color: #fff; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.turn-team.active { opacity: 1; border-color: var(--tc); background: var(--tc-soft); box-shadow: 0 10px 26px -16px var(--tc); }
.turn-team.active .turn-flag { display: inline-block; animation: popIn 0.3s ease both; }
.turns.solo .turn-team { opacity: 1; }
.turns.solo .turn-flag { display: none; }

.mem-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: clamp(8px, 1vw, 14px); }
.mcard {
  height: clamp(96px, calc((100vh - 280px) / var(--rows)), 230px);
  padding: 0; border: 0; background: none; cursor: pointer; perspective: 1000px; border-radius: 16px;
}
.many-teams .mcard { height: clamp(90px, calc((100vh - 330px) / var(--rows)), 230px); }
.mcard-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(0.2, 0.75, 0.3, 1); }
.mcard.open .mcard-inner, .mcard.matched .mcard-inner { transform: rotateY(180deg); }
.mcard-face {
  position: absolute; inset: 0; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 12px; text-align: center;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.mcard-back {
  color: rgba(255, 255, 255, 0.92);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18) 0 2px, transparent 3px) 0 0 / 18px 18px,
    linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow);
  transition: transform 0.2s, filter 0.2s;
}
.mcard:hover:not(.open):not(.matched) .mcard-back { filter: brightness(1.08); transform: translateY(-2px); }
.mcard-back .logo { width: 38%; max-width: 64px; height: auto; opacity: 0.9; }
.mcard-front { transform: rotateY(180deg); background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow); }
.mcard-front.side-a { background: var(--surface-2); }
.tag { position: absolute; top: 7px; left: 10px; font-style: normal; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.mtxt { font-weight: 800; font-size: clamp(0.9rem, 1.2vw, 1.12rem); line-height: 1.25; overflow-wrap: anywhere; }
.mtxt.is-latin { font-family: var(--font-latin); font-style: italic; font-weight: 600; }
.set-atamalar .mtxt { font-size: clamp(1.15rem, 2vw, 1.8rem); }
.set-nervlar .mtxt.is-latin { font-size: clamp(1rem, 1.5vw, 1.35rem); }
.mcard-front small { color: var(--muted); font-size: 0.82rem; line-height: 1.2; }
.mcard.matched { cursor: default; }
.mcard.matched .mcard-front { border-color: var(--tc); background: var(--tc-soft); }
.mcard.matched .mcard-inner { animation: matchPop 0.45s ease; }
.mcard.matched .tag { color: var(--tc); }
.mcard.nomatch { animation: shake 0.4s ease; }
.mcard.nomatch .mcard-front { border-color: var(--bad-line); }

/* ============ Vaziyatli masalalar ============ */
.case-list { display: grid; gap: 12px; }
.case-item {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 16px;
  border: 2px solid var(--border); background: var(--surface-2); text-decoration: none;
  transition: border-color 0.2s, transform 0.15s, background-color 0.2s;
}
.case-item:hover { border-color: var(--g3); transform: translateY(-2px); background: var(--surface); }
.ci-num { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; font-weight: 900; font-size: 1.4rem; color: var(--g3); background: color-mix(in srgb, var(--g3) 14%, transparent); }
.ci-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ci-body b { font-size: 1.2rem; }
.ci-body > span { color: var(--muted); }
.ci-body em { font-style: normal; font-size: 0.88rem; color: var(--faint); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.ci-state { font-weight: 800; color: var(--g3); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }

.case-grid { display: grid; grid-template-columns: minmax(300px, 0.85fr) 1.3fr; gap: clamp(14px, 1.8vw, 24px); align-items: start; }
.case-card { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 14px; }
.patient { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.avatar { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--g3); background: color-mix(in srgb, var(--g3) 14%, transparent); }
.avatar .ic { width: 26px; height: 26px; vertical-align: 0; }
.patient b { display: block; font-size: 1.15rem; }
.patient span { color: var(--muted); font-size: 0.92rem; }
.case-h { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.case-text { font-size: clamp(1rem, 1.25vw, 1.12rem); line-height: 1.7; }
.case-text mark { background: transparent; color: inherit; border-radius: 5px; transition: background-color 0.35s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.case-text.show-marks mark { padding: 0.05em 0.1em; }
.case-text.show-marks .m-cause { background: var(--mk-cause); }
.case-text.show-marks .m-motor { background: var(--mk-motor); }
.case-text.show-marks .m-sens { background: var(--mk-sens); }
.case-text.show-marks .m-keep { background: var(--mk-keep); }
.case-card > .btn { align-self: flex-start; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.lg { padding: 4px 10px; border-radius: 8px; font-size: 0.82rem; font-weight: 700; }
.lg.m-cause { background: var(--mk-cause); }
.lg.m-motor { background: var(--mk-motor); }
.lg.m-sens { background: var(--mk-sens); }
.lg.m-keep { background: var(--mk-keep); }

.qsteps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.qstep {
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface);
  font-weight: 900; cursor: pointer; display: grid; place-items: center; transition: all 0.2s;
}
.qstep:hover { border-color: var(--border-strong); }
.qstep.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.qstep.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.qstep.current { border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); transform: translateY(-2px); }
.qstep.current:not(.ok):not(.bad) { background: var(--primary); color: #fff; border-color: var(--primary); }
.qstep.finish .ic { width: 20px; height: 20px; vertical-align: 0; }

.qcard { display: flex; flex-direction: column; gap: 14px; }
.q-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.q-num { font-weight: 900; color: var(--primary); font-size: 1.05rem; }
:root[data-theme="dark"] .q-num { color: var(--primary-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .q-num { color: var(--primary-2); } }
.q-num small { color: var(--faint); font-weight: 700; }
.discuss { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.discuss-label { font-size: 0.88rem; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-right: 2px; }
.discuss .seg { background: var(--surface-3); padding: 6px 10px; font-size: 0.85rem; }
.discuss .seg.active { background: var(--primary); color: #fff; }
.dtimer-slot.timer { width: 54px; height: 54px; }
.dtimer-slot .timer-num { font-size: 0.9rem; }
.q-text { font-size: clamp(1.25rem, 2vw, 1.7rem); font-weight: 800; line-height: 1.3; }
.quiz { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.quiz-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 8px; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; background: var(--primary-soft); color: var(--primary); }
:root[data-theme="dark"] .badge { color: var(--primary-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { color: var(--primary-2); } }
.badge.gold { background: var(--gold-bg); color: var(--gold); }
.badge .ic { width: 14px; height: 14px; }
.quiz-q { font-weight: 700; }
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; color: var(--muted); font-size: 0.95rem; }
.options { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer;
  padding: 12px 16px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface);
  font-size: 1.02rem; transition: border-color 0.15s, background-color 0.2s, transform 0.1s, opacity 0.2s;
}
.opt:hover:not(:disabled) { border-color: var(--primary-2); transform: translateX(3px); }
.opt:disabled { cursor: default; }
.opt-letter { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); font-weight: 900; }
.opt.correct { border-color: var(--ok-line); background: var(--ok-bg); }
.opt.correct .opt-letter { background: var(--ok-line); color: #fff; }
.opt.wrong { border-color: var(--bad-line); background: var(--bad-bg); }
.opt.wrong .opt-letter { background: var(--bad-line); color: #fff; }
.opt.dim { opacity: 0.5; }
.fb { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; font-weight: 700; animation: popIn 0.3s ease both; }
.fb.ok { background: var(--ok-bg); color: var(--ok); }
.fb.bad { background: var(--bad-bg); color: var(--bad); }
.answer-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.answer-panel {
  width: 100%; padding: 16px 20px; border-radius: 14px; line-height: 1.65;
  background: var(--primary-soft); border-left: 5px solid var(--primary-2);
  animation: popIn 0.3s ease both;
}
.answer-panel ol { margin: 0 0 8px; padding-left: 1.3em; display: grid; gap: 6px; }

.bonus { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; border: 2px dashed color-mix(in srgb, var(--gold) 55%, transparent); background: color-mix(in srgb, var(--gold-bg) 55%, transparent); }
.bonus.is-done { border-style: solid; }
.bonus-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bonus-head b { font-size: 1.08rem; }
.bonus-rule { color: var(--muted); font-size: 0.92rem; }
.order-done { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 6px; }
.order-done li {
  counter-increment: step; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--ok-line);
  animation: popIn 0.25s ease both;
}
.order-done li::before { content: counter(step); width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--ok-line); color: #fff; font-weight: 900; font-size: 0.85rem; }
.order-done li.placeholder { border-style: dashed; border-color: var(--border-strong); color: var(--faint); background: transparent; animation: none; }
.order-done li.placeholder::before { background: var(--surface-3); color: var(--muted); }
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.step-chip {
  padding: 9px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: left; font-weight: 600; transition: border-color 0.15s, transform 0.1s;
}
.step-chip:hover { border-color: var(--gold); transform: translateY(-1px); }
.step-chip.shake { border-color: var(--bad-line); background: var(--bad-bg); animation: shake 0.4s ease; }
.bonus-status { font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bonus.is-done .bonus-status { color: var(--ok); }

.qnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.qcard.is-end { text-align: center; align-items: center; }
.q-summary { list-style: none; margin: 0; padding: 0; width: 100%; text-align: left; display: grid; gap: 8px; }
.q-summary li { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.qs-text { flex: 1; color: var(--muted); }

/* ============ Konfetti ============ */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; display: none; }

/* ============ Animatsiyalar ============ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes flow { to { stroke-dashoffset: -28; } }
@keyframes matchPop { 0% { transform: rotateY(180deg) scale(1); } 50% { transform: rotateY(180deg) scale(1.06); } 100% { transform: rotateY(180deg) scale(1); } }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, 4px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, 44px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .pl-flow { display: none; }
}

/* ============ Moslashuvchan joylashuv ============ */
@media (max-width: 1100px) {
  .games { grid-template-columns: repeat(2, 1fr); }
  .case-grid { grid-template-columns: minmax(280px, 0.8fr) 1.2fr; }
}
@media (max-width: 960px) {
  .case-grid { grid-template-columns: 1fr; }
  .case-card { position: static; }
  .duel-grid.n2 { grid-template-columns: 1fr 1fr; }
  .duel-grid.n1, .duel-grid.nmany { grid-template-columns: minmax(0, 1fr); }
  .duel-teams { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .stage { grid-column: 1 / -1; order: -1; min-height: 300px; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 560px; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand-text small { display: none; }
  .scoreboard { order: 3; width: 100%; justify-content: center; margin-left: 0; }
  .pill { flex: 1 1 140px; min-width: 0; }
  .topbar.many { position: static; }
  .topbar.many .pill { flex: 1 1 96px; }
  .pill-name { flex: 1; min-width: 0; max-width: none; }
  .tools { margin-left: auto; }
  .set-choice { grid-template-columns: minmax(0, 1fr); }
  .turns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .turns.solo { grid-template-columns: minmax(0, 1fr); }
  .podium-card.winner { transform: none; }
  .mem-grid { grid-template-columns: repeat(3, 1fr); }
  .mem-grid.set-nervlar { grid-template-columns: repeat(2, 1fr); }
  .mcard { height: auto; }
  .mcard-inner { min-height: 110px; }
  .set-nervlar .mcard-inner { min-height: 140px; }
  .set-atamalar .mtxt { font-size: 1.1rem; }
  .bar-title { width: 100%; order: 3; }
  .prog { margin-left: auto; }
}
@media (max-width: 600px) {
  .duel-grid.n2, .duel-teams { grid-template-columns: minmax(0, 1fr); }
  .games { grid-template-columns: 1fr; }
  .tp-locked, .tp-result { min-height: 140px; }
  .pad { grid-template-columns: repeat(6, 1fr); }
  .key.tf { padding: 18px 12px; }
  .case-item { flex-wrap: wrap; }
  .ci-state { width: 100%; justify-content: flex-end; }
  .qnav .btn { flex: 1; }
  .q-summary li { flex-wrap: wrap; }
  .sum th, .sum td { padding: 8px 10px; }
}
@media (max-width: 420px) {
  .brand-text { display: none; }
  .pill { padding: 4px 10px; gap: 6px; }
  .pill-score { font-size: 1.1rem; }
  .icon-btn { width: 38px; height: 38px; }
}
