:root {
  --paper: #f5f2eb;
  --card: #ffffff;
  --ink: #1d1b19;
  --muted: #6d675f;
  --line: #e2ddd2;
  --accent: #3b4cca;
  --brand: #24306e;   /* цвет логотипа */
  --accent-ink: #ffffff;
  --ok: #1f8a4c;
  --bad: #c8372d;
  --a0: #e0523a;
  --a1: #138f86;
  --a2: #b9770e;
  --a3: #3b4cca;
  --a4: #7a45b0;
  --a5: #b2457a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 25, .06), 0 6px 20px rgba(29, 27, 25, .06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); line-height: 1.4; -webkit-text-size-adjust: 100%; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
a { color: var(--accent); }
button, input { font: inherit; color: inherit; }

.logo { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.logo span { color: var(--brand); }
.logo-mark { width: .92em; height: .92em; vertical-align: -.12em; margin-right: .28em; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

label { display: block; font-weight: 600; font-size: .95rem; }
input[type=text], input:not([type]), input[inputmode] {
  display: block; width: 100%; margin-top: 6px;
  padding: 12px 14px; font-size: 1.15rem;
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: transform .05s, background .15s, border-color .15s;
}
.btn:hover { border-color: #cfc8ba; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #2f3eb0; }
.btn.danger { color: var(--bad); }
.btn.big { padding: 14px 22px; font-size: 1.2rem; width: 100%; }
.btn.small { padding: 6px 10px; font-size: .85rem; }

.error { color: var(--bad); font-weight: 600; margin: 10px 0 0; }
.muted { color: var(--muted); }

/* Варианты ответа */
.a0 { --c: var(--a0); } .a1 { --c: var(--a1); } .a2 { --c: var(--a2); } .a3 { --c: var(--a3); }
.a4 { --c: var(--a4); } .a5 { --c: var(--a5); }
.letter {
  display: inline-grid; place-items: center; flex: none;
  width: 1.8em; height: 1.8em; border-radius: 50%;
  background: rgba(255, 255, 255, .22); font-weight: 800;
}

/* Индикатор связи */
body.offline::before {
  content: "Нет связи — переподключаюсь…";
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--bad); color: #fff; text-align: center; padding: 6px; font-weight: 700; font-size: .9rem;
}

/* ------------------------- Телефон ученика ------------------------- */
.player main { max-width: 520px; margin: 0 auto; padding: 24px 16px 90px; min-height: 100dvh; }
.player .screen { min-height: calc(100dvh - 114px); display: flex; flex-direction: column; }
.player .center { justify-content: center; align-items: center; text-align: center; }
.player #s-join { justify-content: center; gap: 18px; }
.player #s-join .card { display: grid; gap: 16px; }
.player #pin { font-size: 1.8rem; letter-spacing: .25em; text-align: center; font-weight: 800; }
.player .hint { text-align: center; font-size: .95rem; }
.big-emoji { font-size: 4.5rem; line-height: 1; margin-bottom: 12px; }
.player #msg-title { font-size: 1.9rem; }
.player #msg-text { font-size: 1.15rem; color: var(--muted); white-space: pre-line; margin: 0 0 18px; }
.player #msg-text strong { color: var(--ink); }

.qbar { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.timer {
  min-width: 2.6em; text-align: center; padding: 4px 10px; border-radius: 999px;
  background: var(--ink); color: #fff; font-variant-numeric: tabular-nums; font-weight: 800;
}
.timer.low { background: var(--bad); }
.player .q-text { font-size: 1.3rem; font-weight: 700; margin: 0 0 16px; }
.player .answers { display: grid; gap: 12px; flex: 1; grid-auto-rows: 1fr; }
.answer-btn {
  display: flex; align-items: center; gap: 14px; text-align: left;
  border: 0; border-radius: var(--radius); padding: 16px 18px; min-height: 76px;
  background: var(--c); color: #fff; font-size: 1.2rem; font-weight: 700; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18);
  transition: transform .06s, opacity .2s, filter .2s;
}
.answer-btn:active { transform: scale(.98); }
.answer-btn:disabled { cursor: default; }
.answers.locked .answer-btn:not(.chosen) { opacity: .3; filter: grayscale(.6); }
.answer-btn.chosen { outline: 4px solid var(--ink); outline-offset: 2px; }

.result-ok { color: var(--ok); }
.result-bad { color: var(--bad); }
.result-part { color: var(--a2); }
.q-hint { margin: -8px 0 14px; font-weight: 700; color: var(--a3); }
#q-submit { margin-top: 14px; }
/* Множественный выбор: отметка в кружке-букве */
.answers.multi .answer-btn .letter { border-radius: 8px; }
.answers.multi .answer-btn.chosen .letter { position: relative; background: #fff; color: transparent; }
.answers.multi .answer-btn.chosen .letter::before {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--c); font-weight: 900;
}
.answers.multi:not(.locked) .answer-btn:not(.chosen) { opacity: .85; }
.multi-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #e9ebfb; color: var(--a3); font-weight: 700; font-size: .8rem; }
.stage-badge { display: inline-block; padding: 6px 16px; border-radius: 999px; background: var(--a3); color: #fff; font-weight: 800; font-size: clamp(.95rem, 1.6vw, 1.3rem); }

.me {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; font-weight: 700;
}
.me span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------- Экран ведущего ------------------------- */
.host header.top, .account header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--card);
}
.host header.top .logo, .account header.top .logo { font-size: 1.6rem; }
.host main { padding: 24px; max-width: 1100px; margin: 0 auto; }
.host .stage { max-width: none; min-height: calc(100dvh - 64px); display: flex; flex-direction: column; padding: 24px clamp(16px, 3vw, 48px); }
.host .row, .account .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.host .spacer { flex: 1; }
.host .grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .host .grid2 { grid-template-columns: 1fr; } }

.drop {
  display: grid; place-items: center; text-align: center; gap: 6px;
  border: 2px dashed #cdc6b7; border-radius: var(--radius); padding: 28px 16px;
  background: #fbfaf7; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #f1f2fc; }
.drop strong { font-size: 1.1rem; }
.drop input { display: none; }

.report { margin-top: 14px; }
.report ul { margin: 6px 0 0; padding-left: 20px; color: var(--bad); }
.report .fix-hint { margin: 8px 0 0; color: var(--ink); font-weight: 400; }
.report li { color: var(--ink); font-weight: 400; }
.report li b { color: var(--bad); }
.format-help { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.format-help summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.format-help p, .format-help ul { margin: 10px 0 0; }
.format-help ul { padding-left: 20px; display: grid; gap: 4px; font-size: .95rem; }
.format-help code { background: #f1f2fc; padding: 0 4px; border-radius: 4px; }
.format-scroll { overflow-x: auto; margin-top: 8px; }
.host .grid2 > * { min-width: 0; } /* иначе широкая таблица-пример растягивает колонку */
.format-table { border-collapse: collapse; font-size: .76rem; width: 100%; min-width: 520px; }
.format-table th, .format-table td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.format-table td:first-child { min-width: 7em; }
.format-table th { background: var(--accent); color: #fff; font-weight: 700; white-space: nowrap; }
.format-table th.opt { background: #d9ddf5; color: var(--ink); }
.format-table td.ok { background: #c8ebd3; color: #14532d; font-weight: 700; }
.format-table td.c { text-align: center; }
.format-table td { overflow-wrap: normal; }
.format-table td:not(:first-child) { white-space: nowrap; }
.notice { padding: 10px 14px; border-radius: 10px; background: #eef7f1; color: var(--ok); font-weight: 600; }
.notice.warn { background: #fdf0ee; color: var(--bad); }

.qlist { display: grid; gap: 10px; margin-top: 16px; }
.qitem { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px; }
.qitem .num { font-weight: 800; color: var(--muted); min-width: 1.6em; }
.qitem .qt { font-weight: 700; margin-bottom: 6px; }
.qitem ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 2px; font-size: .95rem; }
.qitem li.ok { color: var(--ok); font-weight: 700; }
.qitem li.ok::after { content: " ✓"; }
.qitem .meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.saved { display: grid; gap: 8px; margin-top: 10px; }
.saved .item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.saved .item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* Лобби */
.lobby-head { display: grid; grid-template-columns: 1fr auto auto; gap: 24px; align-items: center; }
.join-qr {
  width: clamp(150px, 20vw, 260px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 16px;
  background: #fff; box-shadow: var(--shadow); cursor: zoom-in; overflow: hidden;
}
.join-qr svg, .qr-zoom-box svg { display: block; width: 100%; height: 100%; }
.qr-zoom {
  position: fixed; inset: 0; z-index: 50; background: rgba(29, 27, 25, .92); cursor: zoom-out;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh;
}
.qr-zoom-box { width: min(80vh, 90vw); aspect-ratio: 1; background: #fff; border-radius: 20px; overflow: hidden; }
.qr-zoom-pin { color: #fff; font-size: clamp(2rem, 6vh, 4rem); font-weight: 700; letter-spacing: .05em; }
@media (max-width: 700px) {
  .lobby-head { grid-template-columns: 1fr auto; }
  .join-box { grid-column: 1 / -1; }
}
.join-box { background: var(--ink); color: #fff; border-radius: 20px; padding: 24px 32px; }
.join-box .url { font-size: clamp(1.1rem, 2.2vw, 1.8rem); font-weight: 600; opacity: .85; }
.join-box .url b { word-break: break-all; }
.join-box .pin { font-size: clamp(3.5rem, 10vw, 8rem); font-weight: 900; letter-spacing: .08em; line-height: 1; font-variant-numeric: tabular-nums; }
.count-badge { text-align: center; }
.count-badge b { display: block; font-size: clamp(3rem, 7vw, 5.5rem); line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; align-content: flex-start; flex: 1; }
.chip {
  border: 0; background: var(--card); box-shadow: var(--shadow); border-radius: 999px;
  padding: 10px 18px; font-size: clamp(1rem, 1.8vw, 1.4rem); font-weight: 700; cursor: pointer;
  animation: pop .25s ease-out;
}
.chip:hover { background: #fdf0ee; color: var(--bad); text-decoration: line-through; }
.chip.off { opacity: .45; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Вопрос на проекторе */
.stage-top { display: flex; align-items: center; gap: 16px; font-weight: 700; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.3rem); }
.big-timer {
  width: clamp(80px, 9vw, 130px); height: clamp(80px, 9vw, 130px); border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: #fff;
  font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 900; font-variant-numeric: tabular-nums; flex: none;
}
.big-timer.low { background: var(--bad); }
.stage-q { font-size: clamp(1.6rem, 3.6vw, 3.2rem); font-weight: 800; text-align: center; margin: 3vh auto; max-width: 1200px; }
.stage-mid { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 3vh; }
.answered-box { text-align: center; font-weight: 700; color: var(--muted); }
.answered-box b { display: block; font-size: clamp(2rem, 4vw, 3.4rem); color: var(--ink); line-height: 1; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: auto; }
.tile {
  display: flex; align-items: center; gap: 16px; min-height: clamp(80px, 13vh, 150px);
  padding: 16px 22px; border-radius: var(--radius); background: var(--c); color: #fff;
  font-size: clamp(1.2rem, 2.4vw, 2.1rem); font-weight: 800; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18);
}
.tile.dim { opacity: .28; filter: grayscale(.5); }
.tile .cnt { margin-left: auto; font-size: .9em; font-variant-numeric: tabular-nums; }

/* Результаты вопроса */
.reveal-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; flex: 1; margin-top: 2vh; }
@media (max-width: 860px) { .reveal-grid { grid-template-columns: 1fr; } }
.bars { display: flex; align-items: flex-end; gap: 14px; height: clamp(180px, 34vh, 360px); }
.bar { flex: 1; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; }
.bar .fill { background: var(--c); border-radius: 10px 10px 0 0; min-height: 6px; transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.bar .num { text-align: center; font-weight: 900; font-size: clamp(1.4rem, 2.6vw, 2.2rem); margin-bottom: 6px; }
.bar.dim .fill { opacity: .28; }
.bar .lbl { margin-top: 8px; text-align: center; font-weight: 700; font-size: clamp(.9rem, 1.4vw, 1.15rem); }
.bar .lbl .letter { background: var(--c); color: #fff; }
.correct-line { font-size: clamp(1.1rem, 2vw, 1.6rem); font-weight: 800; color: var(--ok); margin-top: 18px; }

.leader { display: grid; gap: 10px; align-content: start; }
.leader h3 { font-size: clamp(1.2rem, 2vw, 1.6rem); }
.lrow {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow); font-size: clamp(1.05rem, 1.8vw, 1.45rem); font-weight: 700;
}
.lrow .rk { width: 1.8em; color: var(--muted); }
.lrow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .sc { font-variant-numeric: tabular-nums; }

/* Финал */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin: 4vh 0 3vh; }
.step { width: clamp(120px, 18vw, 230px); text-align: center; }
.step .nm { font-size: clamp(1.1rem, 2.2vw, 1.9rem); font-weight: 800; margin-bottom: 8px; word-break: break-word; }
.step .sc { color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.step .block { border-radius: 14px 14px 0 0; display: grid; place-items: center; color: #fff; font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 900; }
.step.p1 .block { height: clamp(140px, 26vh, 260px); background: var(--a2); }
.step.p2 .block { height: clamp(100px, 18vh, 190px); background: var(--a3); }
.step.p3 .block { height: clamp(70px, 12vh, 130px); background: var(--a0); }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.table td:last-child, .table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: var(--shadow);
}

/* Длинные тексты: не вылезают за экран и уменьшаются */
.answer-btn > span:last-child, .tile > span:not(.letter):not(.cnt) { min-width: 0; }
.player .q-text.long { font-size: 1.05rem; }
.player .answers.long .answer-btn { font-size: 1rem; min-height: 60px; padding: 12px 14px; }
.stage-q.long { font-size: clamp(1.2rem, 2.4vw, 2.1rem); margin: 2vh auto; }
.tiles.long .tile { font-size: clamp(1rem, 1.6vw, 1.45rem); min-height: clamp(64px, 10vh, 120px); padding: 12px 18px; }
.tiles.long { gap: 10px; }

/* Пауза таймера */
.paused-note {
  margin: 0 auto 1vh; padding: 8px 16px; border-radius: 999px; width: fit-content; max-width: 100%;
  background: var(--ink); color: #fff; font-weight: 700; text-align: center;
}
.big-timer.paused, #q-timer.paused { background: var(--a2); color: #fff; }
.answers.paused { opacity: .45; pointer-events: none; }

/* Типы вопросов на телефоне */
.typed input { width: 100%; font-size: 1.4rem; font-weight: 700; padding: 18px; border-radius: var(--radius); border: 3px solid var(--line); background: var(--card); }
.typed input:focus { outline: none; border-color: var(--accent); }
.q-actions { display: flex; gap: 10px; margin-top: 14px; }
.q-actions .btn.big { flex: 1; }
.answers.t-order .answer-btn.chosen .letter { background: #fff; color: var(--c); }
.answers.t-order:not(.locked) .answer-btn:not(.chosen) { opacity: .85; }
.player .answers.t-truefalse { grid-auto-rows: minmax(110px, 1fr); }
.player .answers.t-truefalse .answer-btn { font-size: 1.6rem; justify-content: center; }
.player .answers.t-truefalse .letter { display: none; }

/* Типы вопросов на проекторе */
.tiles.six { grid-template-columns: 1fr 1fr 1fr; }
.typed-tile { grid-column: 1 / -1; justify-content: center; background: var(--card); color: var(--muted); box-shadow: var(--shadow); }
.reveal-big { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; text-align: center; }
.reveal-answer { font-size: clamp(2rem, 5vw, 4rem); font-weight: 900; color: var(--ok); }
.reveal-order { margin: 0; padding-left: 1.6em; text-align: left; font-size: clamp(1.2rem, 2.4vw, 2rem); font-weight: 800; display: grid; gap: 6px; }
.reveal-big .muted { font-size: clamp(1rem, 1.8vw, 1.4rem); font-weight: 700; }
.reveal-label { color: var(--ok); font-weight: 800; font-size: clamp(1rem, 1.8vw, 1.4rem); }

/* Редактор вопросов */
.qedit { padding: 14px; display: grid; gap: 10px; transition: box-shadow .3s; }
.qedit.bad { box-shadow: var(--shadow), inset 3px 0 0 var(--bad); }
.qedit.flash { box-shadow: 0 0 0 3px var(--bad); }
.qhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qhead .num { font-weight: 800; color: var(--muted); min-width: 1.4em; }
.qhead select { font: inherit; font-size: .9rem; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.btn.icon { min-width: 34px; padding: 6px 8px; }
.qtext { width: 100%; font: inherit; font-weight: 700; font-size: 1.05rem; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; resize: vertical; background: var(--card); }
.qtext:focus, .qopt input[type=text]:focus { outline: none; border-color: var(--accent); }
.opts { display: grid; gap: 6px; }
.opts .row { gap: 8px; }
.qopt { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.qopt .letter { background: var(--c, var(--muted)); color: #fff; width: 1.7em; height: 1.7em; font-size: .85rem; }
.qopt input[type=text] { flex: 1; min-width: 0; padding: 8px 10px; border: 2px solid var(--line); border-radius: 8px; font-size: 1rem; background: var(--card); margin: 0; }
.qopt .mark { width: 20px; height: 20px; flex: none; accent-color: var(--ok); margin: 0; }
.qopt span.mark { display: inline-grid; place-items: center; font-weight: 800; color: var(--muted); }
.qopt span.mark.ok { color: var(--ok); }
.qopt span.mark.num { color: var(--ink); }
.muted.small, .small { font-size: .85rem; }
.tf { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tfbtn.on { background: #eaf6ee; border-color: var(--ok); color: var(--ok); }
.qerr { margin: 0; color: var(--bad); font-weight: 700; font-size: .9rem; }
.qadd { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0 2px; }
@media (max-width: 520px) { .qhead select { flex: 1; } .qhead .spacer { display: none; } }

/* Аккаунт */
.logo-link { color: inherit; text-decoration: none; }
.acc-main { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 16px; }
.acc-main:has(#v-account:not([hidden])) { max-width: 760px; } /* профилю — шире: тарифы рядом */
.acc-view { display: grid; gap: 16px; }
.acc-view.card, .acc-view > .card { padding: 22px; }
.acc-view h2 { margin: 0 0 4px; }
.acc-form { display: grid; gap: 14px; margin-top: 12px; }
.acc-form input[type=email], .acc-form input[type=password] {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font-size: 1.05rem;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; outline: none;
}
.acc-form input:focus { border-color: var(--accent); }
.acc-links { margin: 14px 0 0; text-align: center; }
details.card { padding: 16px 22px; }
details.card summary { cursor: pointer; }
/* «про» справа от логотипа — у тех, у кого тариф Про */
.logo .pro-tag { display: inline-block; vertical-align: middle; margin-left: .35em; padding: .18em .6em .22em; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: .42em; font-weight: 800; letter-spacing: .04em; line-height: 1.2; position: relative; top: -.12em; }
.logo .pro-tag[hidden] { display: none; }
.saved .item.current { border-color: var(--accent); background: #f1f2fc; }
#acct a.btn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Предложение подписки */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(29, 27, 25, .55); display: grid; place-items: center; padding: 16px; }
.modal-box { max-width: 440px; width: 100%; padding: 22px; }
.modal-box h3 { margin-top: 0; }
.upsell-list { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 4px; }

/* Результат вопроса на телефоне */
.res-line { margin-top: 10px; white-space: pre-line; }
.res-line.pts { font-size: 1.3rem; font-weight: 800; }
.res-line.mine { color: var(--muted); }
.res-line .ans { font-weight: 700; color: var(--ink); } /* свой ответ — спокойно, без зачёркивания и красного */
.res-line.right { color: var(--ok); font-weight: 700; }


/* Тарифы: Базовый и Про рядом, на телефоне — друг под другом */
.tariffs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 12px 0 4px; }
.tariff { border: 2px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.tariff.current { border-color: var(--accent); }
.tariff-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tariff h3 { margin: 0; font-size: 1.25rem; }
.tariff-now { font-size: .78rem; font-weight: 700; color: var(--accent); background: #eceefb; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.tariff-price { font-size: 1.35rem; font-weight: 800; white-space: nowrap; }
.tariff-price .muted { font-size: .9rem; font-weight: 600; }
.tariff ul { margin: 4px 0 6px; padding-left: 1.2em; }
.tariff li { margin: 3px 0; }
#plan-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
#plan-actions p { margin: 0; }
.renew-check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; font-weight: 400; cursor: pointer; }
.nowrap { white-space: nowrap; }
.renew-check input { margin-top: 3px; flex: none; width: auto; }
.renew-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #eef7f1; }
.renew-box p { margin: 0; }

/* Согласие при регистрации, подвал со ссылками на документы */
.consent-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: .92rem; cursor: pointer; }
.consent-check input { margin-top: 3px; flex: none; width: auto; }
.site-foot { text-align: center; font-size: .85rem; color: var(--muted); padding: 8px 16px 24px; }
.site-foot a, .legal-nav a { color: var(--muted); }

/* Оферта, политика, согласие */
.legal { max-width: 820px; margin: 24px auto 48px; padding: 28px clamp(16px, 4vw, 36px); line-height: 1.55; }
.legal h1 { font-size: 1.6rem; margin: 12px 0 4px; }
.legal h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.legal p { margin: 0 0 10px; }
.legal-nav { color: var(--muted); }
.legal-contacts { margin: 18px 0 8px; padding: 4px 18px 8px; border: 2px solid var(--line); border-radius: 12px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 6px 0 12px; }
.legal-table th, .legal-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
@media (max-width: 600px) { .legal-table, .legal-table tbody, .legal-table tr, .legal-table td { display: block; } .legal-table thead { display: none; }
  .legal-table tr { margin-bottom: 10px; } .legal-table td:first-child { font-weight: 700; } }
mark.todo { background: #fdf0ee; color: var(--bad); padding: 0 4px; border-radius: 4px; font-weight: 700; }

/* ------------------------- Главная: рассказ для учителей ------------------------- */
.landing { border-top: 1px solid var(--line); background: var(--card); padding: 8px 16px 0; }
.landing > section { max-width: 1040px; margin: 0 auto; padding: 48px 0; }
.landing > section + section { border-top: 1px solid var(--line); }
.landing h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); letter-spacing: -.02em; margin: 0 0 22px; line-height: 1.15; }
.landing h3 { margin: 0 0 6px; font-size: 1.1rem; }
.landing p { margin: 0; }
.l-hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
.l-hero h2 { font-size: clamp(2rem, 4.4vw, 3rem); margin-bottom: 16px; }
.l-lead { font-size: 1.15rem; color: var(--muted); line-height: 1.5; }
.l-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 26px; }
.l-cta .btn { text-decoration: none; }
/* Макет: экран в классе и телефон ученика */
.l-mock { position: relative; padding: 0 40px 36px 0; }
.l-screen { background: var(--paper); border: 2px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.l-screen-top { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: .9rem; }
.l-timer { background: var(--ink); color: #fff; border-radius: 999px; padding: 0 10px; }
.l-screen-q { font-weight: 800; font-size: 1.25rem; margin: 12px 0 14px; }
.l-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.l-grid span, .l-phone span { background: var(--c); color: #fff; font-weight: 800; border-radius: 10px; }
.l-grid span { padding: 14px 12px; font-size: 1.1rem; }
.l-phone { position: absolute; right: 0; bottom: 0; width: 120px; background: var(--ink); border-radius: 22px; padding: 22px 9px 12px;
  display: grid; gap: 6px; box-shadow: 0 10px 30px rgba(29, 27, 25, .25); }
.l-phone-q { color: #fff; font-size: .72rem; font-weight: 700; text-align: center; opacity: .8; }
.l-phone span { text-align: center; padding: 9px 0; font-size: .9rem; }
.l-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
.l-steps li { counter-increment: step; background: var(--paper); border-radius: var(--radius); padding: 20px; line-height: 1.5; }
.l-steps li::before { content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 12px; }
.l-steps b { display: block; font-size: 1.1rem; margin-bottom: 4px; }
.l-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.l-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 18px; line-height: 1.45; }
.l-card p, .l-features li { color: var(--muted); }
.l-pro { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: .7rem; font-weight: 800; }
.l-features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; line-height: 1.5; }
.l-features b { color: var(--ink); }
#tariffs .tariffs { max-width: 760px; margin: 0 0 14px; }
#tariffs .tariff .btn { margin-top: auto; text-align: center; text-decoration: none; }
.l-faq details { border-bottom: 1px solid var(--line); padding: 14px 0; max-width: 760px; }
.l-faq summary { font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.l-faq details p { margin-top: 8px; color: var(--muted); line-height: 1.5; }
.l-final { text-align: center; }
.l-final .btn { text-decoration: none; }
.landing .site-foot { padding: 20px 16px 28px; }
@media (max-width: 820px) {
  .l-hero, .l-steps, .l-cards, .l-features { grid-template-columns: 1fr; }
  .landing > section { padding: 36px 0; }
  .l-mock { max-width: 420px; }
}
@media (min-width: 821px) and (max-width: 1000px) { .l-cards { grid-template-columns: 1fr 1fr; } }
.landing .btn.big { width: auto; padding-left: 34px; padding-right: 34px; }
.l-mock { padding: 0 64px 48px 0; }
.l-screen-q { padding-right: 24px; }
.l-phone { width: 112px; }

/* Картинка вопроса в редакторе */
.qimg { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.qimg.has { align-items: flex-end; }
.qimg img { max-width: min(100%, 360px); max-height: 220px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); object-fit: contain; }
.qimg-actions { display: flex; gap: 6px; }
.qimg-missing { padding: 10px 14px; border-radius: 10px; background: #fdf0ee; color: var(--bad); font-weight: 600; font-size: .9rem; }
.qedit.drop { outline: 3px dashed var(--accent); outline-offset: 3px; }

/*
 * Картинка вопроса в игре. Экран вопроса с картинкой — ровно в высоту окна: сначала место получают
 * вопрос и варианты ответа, картинка занимает то, что осталось (но не меньше минимума).
 * На большом экране — между таймером и счётчиком ответов, на телефоне — над кнопками.
 */
.host .stage.with-image { height: calc(100dvh - 64px); min-height: 560px; }
.host .with-image .stage-q { margin: 1.2vh auto; }
.host .with-image .stage-mid { flex: 1 1 0; min-height: 140px; margin-bottom: 1.6vh; }
.stage-img { flex: 1; min-width: 0; height: 100%; object-fit: contain; border-radius: 16px; }
.host .with-image .tile { min-height: clamp(52px, 8.5vh, 110px); padding-top: 10px; padding-bottom: 10px; }
.host .with-image .tiles.long .tile { min-height: clamp(52px, 8vh, 100px); }
.host .with-image .tiles { gap: 10px; }

/* Телефон: экран не фиксируем по высоте (иначе лишнее уходило бы под нижнюю плашку с очками),
   картинка растёт только в свободное место: нет места — остаётся маленькой, а страница листается */
.player .q-image { display: block; flex: 1 1 0; width: 100%; min-height: 84px; max-height: 40vh; object-fit: contain;
  border-radius: 12px; margin: -6px 0 12px; }
.player .with-image .q-text { margin-bottom: 10px; }
.player .with-image .answers { flex: 0 0 auto; grid-auto-rows: minmax(56px, auto); gap: 10px; }
.player .with-image .answer-btn { min-height: 56px; padding: 10px 14px; font-size: 1.1rem; }
.player .with-image .answers.t-truefalse { grid-auto-rows: minmax(84px, auto); }
/* 5–6 коротких вариантов рядом с картинкой — в две колонки, чтобы всё поместилось на экране */
.player .answers.cols2 { grid-template-columns: 1fr 1fr; }
.player .answers.cols2 .answer-btn { gap: 10px; padding: 10px 12px; }
.player .q-image[hidden], .stage-img[hidden] { display: none; }

/* Плашка «Идёт игра — вернуться» над редактором */
.resume { display: grid; gap: 8px; margin: 0 0 16px; background: #eceefb; color: var(--ink); }
.resume-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
