/* TugQuiz · SL165. Тихий тёплый интерфейс, один зелёный акцент лицея.
   Яркость только в сцене каната и цветных кнопках ответов; фирменная деталь — жёлтая лента с каната (.ribbon). */
:root {
  /* нейтральная тёплая гамма */
  --bg: #f6f5f1; --card: #ffffff; --raised: #efede6; --hover: #fbfaf7; --line: rgba(29, 31, 26, .09); --line-2: rgba(29, 31, 26, .16);
  --ink: #1d1f1a; --sub: #565a52; --muted: #767a70;
  /* акцент — зелёный эмблемы лицея; жёлтый — только лента */
  --accent: #0f6b38; --accent-ink: #0b5a2f; --accent-soft: #e6efe8; --ribbon: #f2d50f;
  /* смысловые цвета */
  --ok: #16a34a; --ok-s: #e7f4ec; --bad: #dc2626; --bad-s: #fbeaea; --part: #b98900; --part-s: #fbf3dc;
  --red: #d83c41; --red-d: #b22a2f; --blue: #3657c9; --blue-d: #26439f;
  /* кнопки ответов A–F */
  --o1: #d83c41; --o2: #3657c9; --o3: #c98a00; --o4: #138a49; --o5: #7d4bb7; --o6: #0a7f99;
  /* тёмная сцена для доски и телефона */
  --d-bg: #121412; --d-card: #1a1d1a; --d-raised: #242824; --d-line: rgba(238, 240, 233, .09); --d-ink: #eef0e9; --d-sub: #a9ada3; --d-muted: #868a80;
  --r-sm: 6px; --r: 10px; --r-card: 14px; --r-panel: 18px;
  --sh: 0 1px 2px rgba(0, 0, 0, .05); --sh-float: 0 8px 24px rgba(0, 0, 0, .08);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --display: 'Montserrat', 'Onest', 'Segoe UI', system-ui, sans-serif;
  --body: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 28px; letter-spacing: -.01em; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 12px; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
img, video, iframe { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* фирменная деталь: жёлтая лента с каната */
.ribbon { display: inline-block; width: 8px; height: 16px; background: var(--ribbon); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); flex: none; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; height: 40px; font-weight: 500; cursor: pointer; background: var(--card); color: var(--ink); text-decoration: none; white-space: nowrap; transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease); }
.btn:hover { background: var(--raised); } .btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--sub); } .btn.ghost:hover { background: var(--raised); color: var(--ink); }
.btn.danger { color: var(--bad); } .btn.danger:hover { background: var(--bad-s); }
.btn.big { height: 48px; padding: 0 20px; font-size: 16px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 0; width: 40px; } .btn.sm.icon { width: 32px; }
.btn svg { width: 18px; height: 18px; flex: none; stroke-width: 1.75; }
.btn.sm svg { width: 16px; height: 16px; }
label.field { display: block; } label.field > span { display: block; font-weight: 500; font-size: 13px; margin-bottom: 4px; color: var(--sub); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line-2); background: var(--card); border-radius: var(--r); padding: 8px 12px; min-height: 40px; outline: none; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 107, 56, .14); }
textarea.input { resize: vertical; min-height: 88px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--raised); border-radius: var(--r); padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 6px; font-weight: 500; cursor: pointer; color: var(--sub); transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--sh); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 500; background: var(--raised); color: var(--sub); }
.chip .dot, .chips .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button.chip { cursor: pointer; height: 32px; padding: 0 12px; font-size: 13px; background: var(--card); border: 1px solid var(--line); color: var(--sub); transition: border-color .15s var(--ease), color .15s var(--ease); }
.chips button.chip:hover { color: var(--ink); }
.chips button.chip.on { border-color: var(--ink); color: var(--ink); }

/* ---------- карточки ---------- */
.card { background: var(--card); border-radius: var(--r-card); border: 1px solid var(--line); padding: 20px; }
.card.pad-lg { padding: 24px; }
.qcard { display: flex; flex-direction: column; gap: 8px; transition: border-color .15s var(--ease); }
.qcard:hover { border-color: var(--line-2); }
.qcard h3 { margin: 4px 0 0; font-size: 15px; }
.qcard .meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.qcard .acts { display: flex; gap: 4px; margin-top: auto; padding-top: 8px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 28px; font-weight: 600; line-height: 1; color: var(--ink); }
.stat span { color: var(--muted); font-size: 12px; }
.empty { text-align: center; padding: 48px 20px; color: var(--sub); }
.empty svg { width: 32px; height: 32px; color: var(--muted); margin-bottom: 8px; stroke-width: 1.5; }

/* ---------- шапка и подвал ---------- */
.top { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.top .in { max-width: 1440px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand img { width: 36px; height: 36px; }
.brand b { font-weight: 600; font-size: 16px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang { display: inline-flex; border-radius: 8px; background: var(--raised); padding: 4px; gap: 2px; }
.lang button { border: 0; background: transparent; color: var(--sub); font-weight: 500; height: 24px; padding: 0 8px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.lang button.on { background: var(--card); color: var(--ink); box-shadow: var(--sh); }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; margin-top: 64px; }
.foot .in { max-width: 1440px; margin: 0 auto; padding: 24px; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.foot b { color: var(--sub); font-weight: 500; }
.dev { font-size: 12px; color: var(--muted); }
.wrap { max-width: 1440px; margin: 0 auto; padding: 32px 24px; }

/* ---------- главная ---------- */
.hero .in { max-width: 1440px; margin: 0 auto; padding: 72px 24px 32px; display: grid; gap: 48px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(36px, 5vw, 60px); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 20px; }
.hero h1 em { font-style: normal; color: var(--accent); display: block; }
.hero p.lead { color: var(--sub); font-size: 18px; line-height: 1.6; max-width: 34rem; margin-bottom: 32px; }
.join-box { max-width: 440px; }
.join-box form { display: flex; gap: 8px; }
.join-box form > * + * { margin: 0; }
.join-box .input { flex: 1; }
.join-box .note { margin-top: 16px; color: var(--muted); font-size: 14px; }
.pin-input { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: .24em; text-align: center; height: 48px; }
.hero-scene { border-radius: var(--r-panel); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--sh-float); }
.section { max-width: 1440px; margin: 0 auto; padding: 48px 24px 0; }
.section > h2 { font-size: 24px; margin-bottom: 24px; }
.roles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.role { display: flex; flex-direction: column; gap: 12px; }
.role h2 { margin: 0; }
.role ul { margin: 0 0 4px; padding-left: 18px; color: var(--sub); line-height: 1.8; }
.role .btn { align-self: flex-start; }
.modes { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.mode-card { border-radius: var(--r-card); padding: 20px; background: var(--card); border: 1px solid var(--line); }
.mode-card h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.mode-card svg { width: 18px; height: 18px; color: var(--muted); flex: none; stroke-width: 1.75; }
.mode-card p { color: var(--sub); margin: 0; font-size: 14px; }

/* ---------- кабинет учителя ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); max-width: 1440px; margin: 0 auto; min-height: calc(100vh - 61px); }
.side { padding: 24px 12px; border-right: 1px solid var(--line); position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.side a { position: relative; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 12px; border-radius: 8px; color: var(--sub); text-decoration: none; font-weight: 500; transition: background-color .15s var(--ease), color .15s var(--ease); }
.side a svg { width: 18px; height: 18px; color: var(--muted); flex: none; stroke-width: 1.75; }
.side a:hover { background: var(--raised); color: var(--ink); }
.side a.on { background: var(--raised); color: var(--ink); }
.side a.on svg { color: var(--ink); }
.side a.on::before { content: ''; position: absolute; left: -12px; top: 10px; width: 8px; height: 16px; background: var(--ribbon); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.side .sep { height: 1px; background: var(--line); margin: 12px; }
.side a.create { margin-bottom: 16px; min-height: 40px; justify-content: center; color: #fff; background: var(--accent); }
.side a.create:hover { background: var(--accent-ink); color: #fff; }
.side a.create svg { color: #fff; }
.main { padding: 32px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head a.small { color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 4px; }
.page-head a.small:hover { color: var(--ink); }
.quick { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quick button { text-align: left; border: 1px solid var(--line); background: var(--card); cursor: pointer; border-radius: var(--r-card); padding: 16px; color: var(--ink); display: grid; grid-template-columns: 20px 1fr; column-gap: 12px; row-gap: 2px; align-items: start; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.quick button:hover { border-color: var(--line-2); background: var(--hover); }
.quick button b { font-weight: 500; font-size: 15px; }
.quick button span:last-child { grid-column: 2; color: var(--muted); font-size: 13px; }
.quick button svg { width: 20px; height: 20px; color: var(--accent); grid-row: span 2; stroke-width: 1.75; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.mnav { display: none; }

/* ---------- окна и уведомления ---------- */
.overlay { position: fixed; inset: 0; background: rgba(18, 20, 18, .48); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .2s var(--ease); }
.modal { background: var(--card); border-radius: var(--r-panel); width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 64px rgba(0, 0, 0, .18); animation: rise .24s var(--ease); }
.modal.wide { width: min(960px, 100%); }
.modal > header { padding: 20px 24px 0; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal > header h2 { margin: 0; font-size: 18px; }
.modal > .body { padding: 16px 24px; }
.modal > footer { padding: 0 24px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r); font-size: 14px; box-shadow: var(--sh-float); animation: rise .24s var(--ease); max-width: 90vw; }
.toast.err { background: var(--bad); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.spinner { width: 28px; height: 28px; border: 3px solid var(--raised); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 32px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- контент вопросов ---------- */
.rich { overflow-wrap: anywhere; }
.rich ul, .rich ol { margin: 4px 0; padding-left: 20px; text-align: left; }
.rich a { color: var(--blue); }
.media { margin: 12px auto; max-width: 720px; }
.media img { display: block; margin: 0 auto; max-height: 340px; border-radius: var(--r); object-fit: contain; }
.media .vid { position: relative; padding-top: 56.25%; border-radius: var(--r); overflow: hidden; background: #000; }
.media .vid iframe, .media .vid video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media video.plain { width: 100%; border-radius: var(--r); max-height: 380px; background: #000; }
.katex { font-size: 1.08em; }

/* ---------- редактор ---------- */
.editor { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 296px; align-items: start; }
.editor aside { position: sticky; top: 92px; }
.qedit .qhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qedit .num { font-weight: 600; background: var(--raised); color: var(--ink); border-radius: 8px; min-width: 32px; height: 32px; display: grid; place-items: center; }
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; background: var(--raised); border: 1px solid var(--line-2); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; padding: 4px; }
.toolbar button { border: 0; background: transparent; border-radius: 6px; min-width: 32px; height: 32px; cursor: pointer; color: var(--sub); display: inline-grid; place-items: center; padding: 0 8px; }
.toolbar button:hover { background: var(--card); color: var(--ink); }
.toolbar button svg { width: 16px; height: 16px; stroke-width: 1.75; }
.toolbar + textarea.input { border-radius: 0 0 var(--r) var(--r); }
.preview-box { background: var(--bg); border: 1px dashed var(--line-2); border-radius: var(--r); padding: 12px; min-height: 44px; }
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-row .mark { width: 40px; height: 40px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--card); cursor: pointer; display: grid; place-items: center; font-weight: 600; color: var(--sub); flex: none; }
.opt-row .mark.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.fx-pal { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.fx-pal button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; min-height: 48px; cursor: pointer; transition: border-color .15s var(--ease); }
.fx-pal button:hover { border-color: var(--accent); }

/* ---------- сцена «Арқан тартыс» — главное яркое место ---------- */
.tug { width: 100%; display: block; user-select: none; }
.tug .shift { transition: transform .9s cubic-bezier(.25, 1.4, .4, 1); }
.tug .fig { transform-box: fill-box; transform-origin: 50% 100%; animation: strain 1.8s ease-in-out infinite; }
@keyframes strain { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-2.5deg) translateX(-2px); } }
.tug .heave .fig { animation: heave .7s var(--ease); }
@keyframes heave { 30% { transform: rotate(-12deg) translateX(-10px); } 100% { transform: rotate(0) translateX(0); } }
.tug .stumble .fig { animation: stumble .7s var(--ease); }
@keyframes stumble { 30% { transform: rotate(10deg) translateX(8px); } 100% { transform: none; } }
.tug .fall .fig { animation: fall 1s forwards cubic-bezier(.5, 0, .7, 1.4); }
@keyframes fall { to { transform: rotate(70deg) translate(10px, 10px); } }
.tug .cheer .fig { animation: cheer .6s ease-in-out infinite alternate; }
@keyframes cheer { from { transform: translateY(0); } to { transform: translateY(-16px); } }
.tug .dust circle { animation: dust .8s ease-out forwards; }
@keyframes dust { from { opacity: .8; } to { opacity: 0; transform: translate(var(--dx), -18px) scale(2); } }
.tug .flag { transform-box: fill-box; transform-origin: 50% 0; animation: flagwave 1.4s ease-in-out infinite alternate; }
@keyframes flagwave { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .tug *, .tug { animation: none !important; transition: none !important; } }

/* ---------- экран ведущего (доска) ---------- */
.stage { min-height: 100vh; background: var(--d-bg); color: var(--d-ink); display: flex; flex-direction: column; }
.stage .bar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; flex-wrap: wrap; border-bottom: 1px solid var(--d-line); }
.stage .bar img { width: 36px; }
.stage .bar .ttl { font-weight: 600; font-size: 15px; }
.stage .btn, .play .btn { background: var(--d-raised); border-color: var(--d-line); color: var(--d-ink); }
.stage .btn:hover, .play .btn:hover { background: #2e332e; }
.stage .btn.primary, .play .btn.primary { background: var(--d-ink); border-color: var(--d-ink); color: var(--d-bg); }
.stage .btn.primary:hover, .play .btn.primary:hover { background: #fff; }
.stage .body { flex: 1; display: flex; flex-direction: column; padding: 24px; gap: 16px; min-height: 0; max-width: 1600px; width: 100%; margin: 0 auto; }
.stage .chip, .play .chip { background: var(--d-raised); color: var(--d-ink); height: 28px; font-size: 13px; }
.pin-big { font-family: var(--display); font-weight: 700; font-size: clamp(56px, 9vw, 112px); color: var(--ribbon); letter-spacing: .04em; line-height: 1; }
.lobby { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: start; }
.lobby .qr { background: #fff; border-radius: var(--r-card); padding: 12px; width: 216px; }
.lobby .qr img { display: block; width: 100%; }
.teams-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.team-col { border-radius: var(--r-card); padding: 16px; min-height: 160px; background: var(--d-card); border: 1px solid var(--d-line); border-top: 4px solid var(--d-raised); }
.team-col.A { border-top-color: var(--red); } .team-col.B { border-top-color: var(--blue); }
.team-col h3 { display: flex; justify-content: space-between; font-size: 16px; }
.team-col h3 span:last-child { color: var(--d-sub); font-weight: 500; }
.pl { display: inline-flex; align-items: center; gap: 6px; background: var(--d-raised); height: 32px; padding: 0 12px; border-radius: 8px; margin: 4px; font-weight: 500; animation: rise .3s var(--ease); cursor: pointer; border: 0; color: var(--d-ink); transition: background-color .15s var(--ease); }
.pl.off { opacity: .4; }
.pl:hover { background: #333833; }
.qbox { background: #fff; color: var(--ink); border-radius: var(--r-panel); padding: 24px 32px; text-align: center; }
.qbox .rich { font-size: clamp(22px, 2.6vw, 38px); font-weight: 600; line-height: 1.3; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { border: 0; border-radius: var(--r-card); padding: 16px 20px; color: #fff; font-weight: 600; font-size: clamp(16px, 1.8vw, 24px); display: flex; align-items: center; gap: 16px; text-align: left; min-height: 72px; position: relative; overflow: hidden; transition: opacity .2s var(--ease), transform .12s var(--ease); }
.opt .L { background: rgba(0, 0, 0, .18); border-radius: 8px; min-width: 40px; height: 40px; display: grid; place-items: center; flex: none; font-weight: 600; }
.opt img { max-height: 88px; border-radius: 8px; }
.opt .bar-fill { position: absolute; inset: auto 0 0 0; height: 6px; background: rgba(255, 255, 255, .55); transform-origin: left; }
.opt .cnt { margin-left: auto; font-weight: 600; }
.opt.dim { opacity: .28; }
.opt.win { box-shadow: inset 0 0 0 4px #fff; }
.o0 { background: var(--o1); } .o1 { background: var(--o2); } .o2 { background: var(--o3); } .o3 { background: var(--o4); } .o4 { background: var(--o5); } .o5 { background: var(--o6); }
.timer { position: relative; width: 88px; height: 88px; flex: none; }
.timer svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; font-weight: 600; }
.timer.low b { color: #ff7a7a; }
.leadin { position: fixed; inset: 0; display: grid; place-items: center; background: var(--d-bg); z-index: 50; text-align: center; color: var(--d-ink); }
.leadin b { font-family: var(--display); font-weight: 700; font-size: clamp(96px, 20vw, 200px); color: var(--ribbon); animation: rise .3s var(--ease); display: block; line-height: 1; }
.board-lb { background: var(--d-card); border: 1px solid var(--d-line); border-radius: var(--r-card); padding: 16px; }
.board-lb h3 { font-size: 15px; color: var(--d-sub); font-weight: 500; }
.lb-row { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 8px; border-radius: 8px; font-weight: 500; }
.lb-row + .lb-row { margin-top: 2px; }
.lb-row .pos { color: var(--d-muted); width: 24px; }
.lb-row .sc { margin-left: auto; font-weight: 600; }
.streak { display: inline-flex; align-items: center; gap: 4px; color: var(--d-sub); font-size: 13px; }
.streak svg { width: 14px; height: 14px; stroke-width: 1.75; }
.tA { color: #ff8f93; } .tB { color: #94aaff; }
.bgA { background: var(--red); color: #fff; } .bgB { background: var(--blue); color: #fff; }
.scorebar { display: flex; height: 52px; border-radius: var(--r-card); overflow: hidden; font-size: 20px; font-weight: 600; }
.scorebar > div { display: flex; align-items: center; padding: 0 16px; transition: flex-grow .8s var(--ease); min-width: 88px; }
.scorebar > div:last-child { justify-content: flex-end; }
.turn { text-align: center; font-size: 18px; font-weight: 600; padding: 12px; border-radius: var(--r-card); }
.grade-list { display: grid; gap: 8px; }
.grade-item { display: flex; align-items: center; gap: 12px; background: #fff; color: var(--ink); padding: 8px 12px 8px 16px; border-radius: var(--r-card); font-weight: 500; font-size: 18px; }
.grade-item .n { background: var(--raised); border-radius: 6px; padding: 0 8px; font-size: 13px; height: 24px; display: inline-flex; align-items: center; }
.grade-item .seg button.on.g1 { background: var(--ok); color: #fff; } .grade-item .seg button.on.g05 { background: var(--part); color: #fff; } .grade-item .seg button.on.g0 { background: var(--bad); color: #fff; }
.winner { text-align: center; animation: rise .4s var(--ease); }
.winner h1 { font-family: var(--display); font-weight: 700; font-size: clamp(36px, 6vw, 72px); letter-spacing: -.02em; color: var(--d-ink); }
.winner .ribbon { width: 16px; height: 32px; margin-bottom: 12px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin-top: 20px; }
.podium > div { width: min(200px, 28vw); text-align: center; }
.podium .col { border-radius: var(--r-card) var(--r-card) 0 0; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 40px; color: var(--d-bg); }
.podium .p1 .col { height: 188px; background: var(--ribbon); } .podium .p2 .col { height: 140px; background: #d9dcd4; } .podium .p3 .col { height: 100px; background: #d9a77a; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 8px; height: 16px; animation: drop linear forwards; }
@keyframes drop { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- экран ученика ---------- */
.play { min-height: 100vh; display: flex; flex-direction: column; background: var(--d-bg); color: var(--d-ink); border-top: 6px solid var(--d-raised); }
.play.A { border-top-color: var(--red); } .play.B { border-top-color: var(--blue); }
.play .phead { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-weight: 500; gap: 12px; border-bottom: 1px solid var(--d-line); }
.play .pbody { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px; gap: 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.play .card { color: var(--ink); }
.play .card .rich { font-size: 20px; font-weight: 600; text-align: center; }
.play .opts { grid-template-columns: 1fr 1fr; }
.play .opt { min-height: 96px; font-size: 17px; cursor: pointer; }
.play .opt:active { transform: scale(.97); }
.play .opt.picked { box-shadow: inset 0 0 0 4px #fff; }
.play .team-badge { background: var(--d-card); border: 1px solid var(--d-line); border-radius: var(--r-card); padding: 12px; font-weight: 500; }
.big-mark { display: grid; place-items: center; margin: 0 auto; animation: rise .3s var(--ease); }
.big-mark svg { width: 64px; height: 64px; stroke-width: 1.5; }
.big-mark.text { font-family: var(--display); font-weight: 700; font-size: 72px; line-height: 1; }
.timebar { height: 6px; background: var(--d-raised); border-radius: 3px; overflow: hidden; }
.timebar i { display: block; height: 100%; background: var(--ribbon); transform-origin: left; }
.team-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.team-pick button { border: 0; border-radius: var(--r-card); padding: 28px 12px; color: #fff; font-size: 18px; font-weight: 600; cursor: pointer; opacity: .55; transition: opacity .15s var(--ease); }
.team-pick button.on { opacity: 1; box-shadow: inset 0 0 0 3px #fff; }
.wait-dots::after { content: '...'; animation: dots 1.2s steps(4) infinite; display: inline-block; width: 1.2em; text-align: left; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }

/* ---------- канат на доске (одно устройство) ---------- */
.bt { height: 100vh; display: grid; grid-template-columns: 1fr minmax(380px, 1.25fr) 1fr; gap: 12px; padding: 12px; background: var(--bg); overflow: hidden; }
.bt .side-p { border-radius: var(--r-panel); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; color: #fff; transition: box-shadow .2s var(--ease); }
.bt .side-p.A { background: var(--red); } .bt .side-p.B { background: var(--blue); }
.bt .side-p.good { box-shadow: inset 0 0 0 6px var(--ok); } .bt .side-p.bad { animation: shake .4s; box-shadow: inset 0 0 0 6px var(--ink); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.bt .tname { font-weight: 600; font-size: 20px; display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; }
.bt .bq { background: #fff; color: var(--ink); border-radius: var(--r-card); padding: 16px; text-align: center; font-size: clamp(20px, 2.4vw, 34px); font-weight: 600; min-height: 112px; display: grid; place-items: center; }
.bt .disp { background: rgba(0, 0, 0, .2); border-radius: var(--r-card); text-align: center; font-size: 36px; font-weight: 600; min-height: 64px; display: grid; place-items: center; }
.bt .pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex: 1; min-height: 0; }
.bt .pad button, .bt .bopts button { border: 0; border-radius: var(--r-card); background: #fff; color: var(--ink); font-size: clamp(22px, 2.6vw, 36px); font-weight: 600; cursor: pointer; touch-action: manipulation; transition: transform .1s var(--ease); }
.bt .pad button:active, .bt .bopts button:active { transform: scale(.96); }
.bt .pad .ok { background: var(--ink); color: #fff; } .bt .pad .del { background: #f1e3e3; }
.bt .bopts { display: grid; gap: 8px; flex: 1; }
.bt .bopts button { font-size: clamp(20px, 2.6vw, 34px); padding: 8px; }
.bt .mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--ink); }
.bt .mid h2 { font-size: clamp(18px, 2vw, 26px); margin: 0; }
.bt .clock { font-family: var(--display); font-weight: 700; font-size: 44px; }
.bt .score { display: flex; gap: 16px; font-size: 32px; font-weight: 600; }

/* ---------- отчёты ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: var(--hover); }
.pbar { height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; min-width: 80px; }
.pbar i { display: block; height: 100%; border-radius: 4px; }
.chart { width: 100%; height: auto; display: block; }
.tbl-wrap { overflow-x: auto; }
.card.dark { background: var(--d-bg); color: var(--d-ink); border-color: var(--d-bg); }
.card.dark .stat b { color: var(--d-ink); } .card.dark .stat span { color: var(--d-sub); }

/* ---------- гайд и тур ---------- */
.tour-hole { position: fixed; z-index: 150; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(18, 20, 18, .55); transition: left .35s var(--ease), top .35s var(--ease), width .35s var(--ease), height .35s var(--ease); pointer-events: none; outline: 2px solid var(--ribbon); }
.tour-tip { position: fixed; z-index: 151; background: var(--card); border-radius: var(--r-card); padding: 16px 20px; width: min(340px, calc(100vw - 24px)); box-shadow: var(--sh-float); transition: left .35s var(--ease), top .35s var(--ease); }
.guide-step { display: grid; grid-template-columns: 32px 1fr; gap: 16px; }
.guide-step .n { width: 32px; height: 32px; border-radius: 8px; background: var(--raised); color: var(--ink); font-weight: 600; display: grid; place-items: center; }
.guide-step h3 { margin-top: 4px; }
.guide-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.code { font-family: ui-monospace, Consolas, monospace; background: var(--raised); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.prompt-box { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--raised); color: var(--sub); border-radius: var(--r); padding: 12px; max-height: 260px; overflow: auto; margin: 0; }
.steps3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.badge-big { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; text-align: center; font-size: 12px; color: var(--sub); }
.badge-big i { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-style: normal; }
.badge-big i svg { width: 22px; height: 22px; stroke-width: 1.75; }
.badge-big.off { opacity: .4; } .badge-big.off i { background: var(--raised); color: var(--muted); }
.lvl { height: 8px; background: rgba(255, 255, 255, .14); border-radius: 4px; overflow: hidden; } .lvl i { display: block; height: 100%; background: var(--ribbon); }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .hero .in { grid-template-columns: 1fr; padding-top: 48px; gap: 32px; }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 20px 16px 96px; }
  .mnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 4px 8px; border-radius: 8px; }
  .mnav a.on { color: var(--ink); background: var(--raised); }
  .mnav svg { width: 20px; height: 20px; stroke-width: 1.75; }
  .editor { grid-template-columns: 1fr; } .editor aside { position: static; }
  .lobby { grid-template-columns: 1fr; } .lobby .qr { width: 160px; }
  .bt { grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; }
  .bt .mid { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 560px) {
  .top .in { padding: 0 16px; }
  .brand small { display: none; }
  .wrap, .section { padding-left: 16px; padding-right: 16px; }
  .opts { grid-template-columns: 1fr; }
  .play .opts { grid-template-columns: 1fr 1fr; }
  .teams-cols { grid-template-columns: 1fr; }
  .modal > header, .modal > .body, .modal > footer { padding-left: 16px; padding-right: 16px; }
  .top .hide-sm { display: none; }
  .join-box form { flex-direction: column; }
}

/* ---------- печать отчёта (PDF) ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .top, .side, .mnav, .foot, .no-print, .toasts { display: none !important; }
  .shell { display: block; } .main { padding: 0; }
  .card { break-inside: avoid; }
  .print-head { display: flex !important; }
  a { color: inherit; text-decoration: none; }
}
.print-head { display: none; align-items: center; gap: 12px; border-bottom: 1px solid var(--line-2); padding-bottom: 12px; margin-bottom: 16px; }
.print-head img { width: 48px; }
