:root {
  --bg: #eef2f6;
  --bg-soft: #e3eaf2;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --ink: #1a2332;
  --muted: #5b6b7c;
  --accent: #0b7a5a;
  --accent-soft: #d8f3e8;
  --danger: #c23b2e;
  --danger-soft: #fde8e6;
  --ok: #0b7a5a;
  --ok-soft: #d8f3e8;
  --line: #d5dee8;
  --shadow: 0 8px 22px rgba(26, 35, 50, 0.06);
  --elev-1: 0 1px 0 rgba(26, 35, 50, 0.04);
  --radius: 14px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --text: 1.125rem;
  --leading: 1.55;
  --pad: 12px;
  --app-max: 980px;
  --header-h: 64px;
  --tabs-h: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--text);
  line-height: var(--leading);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 10% -10%, rgba(11, 122, 90, 0.07), transparent 42%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 45%, var(--bg-soft) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

.app {
  width: min(var(--app-max), calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 calc(28px + var(--safe-bottom));
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--elev-1);
}

.brand {
  cursor: pointer;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(11, 122, 90, 0.25);
}
.brand-badge svg {
  display: block;
  width: 32px;
  height: 32px;
}
.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-mark {
  display: block;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}
.brand-pdd {
  color: var(--accent);
}
.brand-baza {
  color: var(--ink);
  font-weight: 700;
}
.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

@media (max-width: 520px) {
  .brand { gap: 8px; }
  .brand-badge { width: 32px; height: 32px; }
  .brand-badge svg { width: 28px; height: 28px; }
  .brand-mark { font-size: 1.12rem; }
  .brand-sub { font-size: 0.72rem; }
}

.player-panel {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.account-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
  border-radius: 12px;
  padding: 8px 12px;
  min-height: 44px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  max-width: min(220px, 48vw);
  box-shadow: none;
}
.account-chip:hover { border-color: #9bb5c8; background: #eef3f8; }
.account-chip.on {
  background: var(--accent-soft);
  border-color: #b7dccb;
}
.account-chip-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-chip-meta {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-chip.on .account-chip-meta { color: var(--accent); }
.nick-btn { display: none !important; }
.stats {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
  text-align: right;
  white-space: nowrap;
}
.stats strong { color: var(--accent); font-weight: 600; }

.main-nav {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--elev-1);
  display: grid;
  gap: 12px;
}
.main-nav-group { min-width: 0; }
.main-nav-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.main-nav-row {
  display: grid;
  gap: 8px;
}
.main-nav-row-primary,
.main-nav-row-modes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 52px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.15;
  position: relative;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.nav-ico {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  opacity: 0.42;
  transition: opacity 0.18s ease;
}
.nav-ico svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover { border-color: #c5d3e0; background: #eef3f8; }
.nav-item:hover .nav-ico { opacity: 0.62; }
.nav-item.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(11, 122, 90, 0.22);
}
.nav-item.active .nav-ico { opacity: 0.92; }
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 5px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
}
.nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface-2);
  pointer-events: none;
}
.nav-item.active .nav-badge {
  background: #fff;
  color: var(--danger);
  box-shadow: 0 0 0 2px var(--accent);
}

.errors-summary-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 4px;
}
.errors-summary-head h2 {
  margin: 0;
}
.errors-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.errors-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
}
.errors-stat.is-open {
  background: var(--danger-soft);
  border-color: #e3a39c;
}
.errors-stat-n {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
}
.errors-stat.is-open .errors-stat-n {
  color: var(--danger);
}
.errors-stat-l {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
}

body.quiz-open #site-header,
body.quiz-open #main-nav {
  display: none !important;
}

.section-hint {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.tab, button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 16px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  min-height: 44px;
}
.tab:hover, button:hover { border-color: #9bb5c8; }
button:focus-visible, .nav-item:focus-visible, .answer:focus-visible, .account-chip:focus-visible, .nav-chip:focus-visible {
  outline: 3px solid rgba(11, 122, 90, 0.35);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  min-height: 44px;
}
.btn-primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.view { animation: rise 0.28s ease; }
.hidden { display: none !important; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes quiz-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.ticket {
  text-align: left;
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--elev-1);
  min-height: 92px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.ticket:hover { transform: translateY(-1px); border-color: #b7c4d4; }
.ticket .n {
  font-family: var(--mono);
  font-size: 1.25rem;
  margin-bottom: 6px;
  font-weight: 500;
}
.ticket .meta { color: var(--muted); font-size: 0.88rem; }
.ticket.mastered {
  border-color: #7bc9ab;
  background: linear-gradient(180deg, #f7fcf9, #eef8f3);
}
.ticket.mastered .n { color: var(--ok); }
.ticket.in-progress {
  border-color: #7aa7d9;
  background: linear-gradient(180deg, #f7fafc, #eef4fa);
}
.ticket.in-progress .meta { color: #3d6a94; font-weight: 600; }
.ticket.has-wrong { border-color: #e3a39c; background: #fff8f7; }

.exam-desc {
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.55;
}
.exam-timer {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 500;
}
.exam-timer.urgent {
  color: var(--danger);
  animation: timer-pulse 1s ease infinite;
}
.exam-score {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}
.exam-result.pass { border-color: #7bc9ab; background: #f3fbf7; }
.exam-result.fail { border-color: #e3a39c; background: #fff8f7; }

.marathon-faq {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: none;
}
.marathon-faq > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.92rem;
  list-style: none;
}
.marathon-faq > summary::-webkit-details-marker { display: none; }
.marathon-faq-body {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.marathon-faq-body p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.marathon-faq-body p:last-child { margin-bottom: 0; }
.marathon-faq-body strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}
.marathon-progress {
  margin: 12px 0 4px;
}
.marathon-progress p {
  margin: 0 0 10px;
  color: var(--muted);
}
.marathon-history {
  margin-top: 8px;
}
.marathon-nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.marathon-progress-label {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 4.5rem;
  text-align: center;
}
.marathon-step {
  min-width: 36px;
  min-height: 36px;
  padding: 6px 10px;
  font-weight: 700;
}
.marathon-step:disabled {
  opacity: 0.4;
  cursor: default;
}
.marathon-mobile-line {
  display: none;
}
.marathon-nav .quiz-toolbar-desktop {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}


.nav-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.quiz-toolbar-desktop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.quiz-mobile-line {
  display: block;
}
.quiz-head-mobile {
  display: none;
}
.quiz-icon-btn {
  display: none;
}
.nav-strip-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px 0 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: none;
}
.nav-strip-toggle:hover {
  background: #e8eef5;
}
.nav-strip-toggle-meta {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.nav-strip-toggle-progress {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.nav-error-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e8a39b;
  box-shadow: 0 0 0 3px rgba(194, 59, 46, 0.12);
}
.nav-strip-toggle.has-errors {
  border-color: #f0cfc9;
}
.nav-strip-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, color 0.15s ease;
}
.nav-strip-chevron svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-strip-toggle.is-open {
  background: var(--accent-soft);
  border-color: #c5e6d6;
}
.nav-strip-toggle.is-open .nav-strip-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}
.quiz-back-icon {
  display: none;
}
.quiz-mobile-timer {
  display: none;
}
.quiz-where {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.quiz-where span {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
.quiz-back {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 10px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  white-space: nowrap;
}
.quiz-back:hover { filter: brightness(1.05); border-color: var(--accent); }
.nav-strip-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-strip-row {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 4px;
}
.nav-chip {
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  background: #f7f9fc;
  display: grid;
  place-items: center;
}
.nav-chip.wide {
  font-size: 0.68rem;
  letter-spacing: -0.03em;
  padding: 0 1px;
}
body.quiz-mixed .nav-strip-row {
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
}
.nav-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.nav-chip.ok { background: var(--ok-soft); border-color: #7bc9ab; }
.nav-chip.bad { background: var(--danger-soft); border-color: #e3a39c; }
.nav-chip.done:not(.active) { border-color: #7bc9ab; }
.nav-chip.active.ok,
.nav-chip.active.bad {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: clamp(16px, 3vw, 22px);
  box-shadow: var(--elev-1);
}
.panel + .panel { margin-top: 14px; }
.panel.lobby {
  max-width: 560px;
}
.module-card h2 { margin-top: 0; }
.quiz-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}
.quiz-head-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.q-fav {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: #9aa8b5;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: none;
}
.q-fav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.q-fav.on {
  color: #c49212;
  background: #fff6df;
  border-color: #edd9a0;
}
.q-fav.on svg {
  fill: currentColor;
  stroke: currentColor;
}
.question-text {
  font-size: clamp(1.22rem, 2.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.quiz-panel-body {
  animation: quiz-in 0.28s ease;
}
.q-image {
  width: 100%;
  max-height: min(360px, 48vh);
  object-fit: contain;
  border-radius: 12px;
  background: #f4f7fa;
  margin-bottom: 0;
  border: 1px solid var(--line);
  display: block;
}
.q-image-btn {
  display: block;
  width: 100%;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 12px;
  cursor: zoom-in;
  position: relative;
  box-shadow: none;
  min-height: 0;
  line-height: 0;
  transform: none;
}
.q-image-btn:hover,
.q-image-btn:focus-visible {
  border-color: transparent;
  background: transparent;
  outline: none;
  transform: none;
}
.q-image-btn:focus-visible .q-image {
  outline: 3px solid rgba(11, 122, 90, 0.35);
  outline-offset: 2px;
}
.image-zoom-dialog {
  margin: 0;
  padding: 0;
  border: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  background: rgba(10, 14, 20, 0.94);
  color: #fff;
  overflow: hidden;
}
.image-zoom-dialog::backdrop {
  background: rgba(10, 14, 20, 0.88);
}
.image-zoom-dialog[open] {
  display: grid;
  place-items: center;
}
.image-zoom-dialog img {
  max-width: min(100vw, 100%);
  max-height: min(100dvh, 100vh);
  width: auto;
  height: auto;
  object-fit: contain;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-drag: none;
}
.image-zoom-close {
  position: fixed;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  z-index: 2;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  box-shadow: none;
}
.image-zoom-close:hover {
  background: rgba(255, 255, 255, 0.22);
}
.answers { display: grid; gap: 10px; }
.answer {
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.05rem);
  line-height: 1.45;
  min-height: 52px;
  overflow-wrap: anywhere;
  box-shadow: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.answer:not(:disabled):hover,
.answer:not(:disabled):focus-visible {
  border-color: #b7c4d4;
  background: var(--surface-2);
  color: var(--ink);
}
.answer .pos {
  font-family: var(--mono);
  color: var(--accent);
  margin-right: 8px;
  font-weight: 500;
  opacity: 0.75;
}
.answer:not(:disabled):hover .pos,
.answer.revealed .pos { opacity: 1; }
.answer.revealed { color: var(--ink); }
.answer.correct { border-color: #7bc9ab; background: var(--ok-soft); color: var(--ink); }
.answer.wrong { border-color: #e3a39c; background: var(--danger-soft); color: var(--ink); }
.answer.pending {
  border-color: #c4b48a;
  background: rgba(196, 180, 138, 0.16);
  color: var(--ink);
}
.answer:disabled { cursor: default; }

.next-row {
  margin-top: 14px;
  display: flex;
  justify-content: stretch;
}
.btn-next {
  width: 100%;
  min-height: 48px;
  font-size: 1.05rem;
}
.hint-block {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}
.hint-actions {
  display: grid;
  gap: 8px;
}
@media (min-width: 520px) {
  .hint-actions {
    grid-template-columns: 1fr 1fr;
  }
}
.btn-hint {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
.btn-hint:hover {
  background: #e8eef5;
  border-color: #b7c4d4;
}
.btn-hint.on {
  background: var(--accent-soft);
  border-color: #c5e6d6;
  color: var(--accent);
}
.btn-ai-hint.on {
  background: #eef3fb;
  border-color: #b7c8e0;
  color: #2f5f98;
}
.btn-ai-hint:disabled {
  opacity: 0.7;
  cursor: wait;
}
.hint-text {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f3faf7;
  border: 1px solid #cfe8dc;
  color: var(--muted);
  line-height: 1.55;
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}
.hint-text.ai-tip {
  background: #f3f6fb;
  border-color: #c9d7ea;
}
.ai-tip-body {
  display: grid;
  gap: 8px;
}
.ai-tip-body p,
.ai-tip-detail p {
  margin: 0;
  line-height: 1.5;
}
.ai-tip-body .ai-sec,
.ai-tip-detail .ai-sec {
  margin: 0 0 12px;
  padding: 0 0 10px;
  border-bottom: 1px solid #d7e2ef;
}
.ai-tip-body .ai-sec:last-of-type,
.ai-tip-detail .ai-sec:last-of-type {
  border-bottom: 0;
  margin-bottom: 4px;
  padding-bottom: 0;
}
.ai-tip-body h3,
.ai-tip-detail h3 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #2f5f98;
}
.ai-tip-body ul,
.ai-tip-detail ul,
.ai-tip-body ol,
.ai-tip-detail ol {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 4px;
}
.ai-tip-body li,
.ai-tip-detail li {
  line-height: 1.45;
}
.ai-tip-body strong,
.ai-tip-detail strong {
  color: var(--ink);
}
.ai-more-link {
  display: inline-block;
  margin: 10px 0 0;
  padding: 0;
  min-height: 0;
  border: 0;
  background: none;
  color: #2f5f98;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  box-shadow: none;
  border-radius: 0;
}
.ai-more-link:hover {
  color: #1e4570;
  background: none;
  border: 0;
}
.ai-more-link:disabled {
  opacity: 0.65;
  cursor: wait;
}
.hint-text.ai-tip-detail {
  font-size: 0.98rem;
}

.feedback {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.feedback-verdict {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.feedback-verdict.ok { color: var(--ok); }
.feedback-verdict.bad { color: var(--danger); }
.feedback-verdict.sync { color: var(--muted); font-weight: 600; }
.frequent-dismiss {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  justify-items: start;
}
.frequent-dismiss-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.sync-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2, #eef3f0);
  color: var(--muted);
  font-size: 0.92rem;
  border: 1px solid var(--line);
}
.feedback .tip {
  color: var(--muted);
  line-height: 1.55;
  margin: 10px 0 0;
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.footer-actions { margin-top: 18px; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 480px; }
.table th, .table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.9rem; }

/* —— Рейтинг —— */
.lb-panel { padding-bottom: 8px; }
.lb-head h2 { margin: 0 0 6px; }
.lb-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 42em;
}
.lb-podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}
.lb-podium-flat {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  align-items: stretch;
}
.lb-podium-card {
  text-align: center;
  padding: 14px 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  position: relative;
}
.lb-podium-card.place-1 {
  background: linear-gradient(180deg, #fff8e6 0%, var(--surface) 55%);
  border-color: #e6d4a0;
  padding-top: 18px;
  padding-bottom: 22px;
  box-shadow: var(--elev-1);
}
.lb-podium-card.place-2 {
  background: linear-gradient(180deg, #f0f3f6 0%, var(--surface-2) 60%);
  border-color: #c5ced8;
}
.lb-podium-card.place-3 {
  background: linear-gradient(180deg, #f7efe6 0%, var(--surface-2) 60%);
  border-color: #d9c4a8;
}
.lb-podium-card.is-me {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.lb-medal {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.lb-medal.gold {
  background: linear-gradient(145deg, #f0c14b, #c99212);
}
.lb-medal.silver {
  background: linear-gradient(145deg, #cfd6de, #8a96a3);
}
.lb-medal.bronze {
  background: linear-gradient(145deg, #d4a574, #a56b3a);
}
.lb-medal-num { line-height: 1; }
.lb-podium-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  word-break: break-word;
}
.lb-podium-score {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.lb-podium-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.lb-you {
  font-weight: 600;
  font-size: 0.75em;
  color: var(--accent);
  text-transform: lowercase;
}
.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.lb-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 64px 56px;
  gap: 8px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.lb-row.is-me {
  background: var(--accent-soft);
  margin: 0 -8px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 10px;
  border-bottom-color: transparent;
}
.lb-rank {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
  font-size: 0.95rem;
}
.lb-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-acc {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  text-align: right;
}
.lb-score {
  font-family: var(--mono);
  font-weight: 700;
  text-align: right;
  font-size: 0.95rem;
}
@media (max-width: 560px) {
  .lb-podium {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .lb-podium-card.place-1 { order: -1; }
  .lb-row {
    grid-template-columns: 28px minmax(0, 1fr) 52px 48px;
    gap: 6px;
  }
}
.empty {
  color: var(--muted);
  padding: 28px 8px;
  text-align: center;
  font-size: 1rem;
}
.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 8px 0;
}
.empty-state .empty {
  padding: 0;
  text-align: left;
}
.empty-state .actions { margin-top: 0; }

.nick-dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  width: min(440px, calc(100% - 24px));
  box-shadow: 0 18px 48px rgba(26, 35, 50, 0.14);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background:
    linear-gradient(180deg, #f4faf7 0%, transparent 120px),
    var(--surface);
}
.nick-dialog.account-dialog {
  width: min(420px, calc(100% - 24px));
  max-width: calc(100vw - 24px);
  overflow-x: hidden;
}
.nick-dialog::backdrop { background: rgba(26, 35, 50, 0.42); }
.confirm-dialog .confirm-form {
  margin: 0;
  padding: 22px;
}
.confirm-dialog h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.confirm-dialog .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.confirm-dialog .actions .btn-primary {
  flex: 1 1 auto;
}
.nick-dialog form {
  margin: 0;
  padding: 22px;
}
#email-account-panel {
  margin: 0;
  padding: 0;
}
.account-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(26, 168, 122, 0.12), transparent 55%),
    linear-gradient(180deg, #f6fbf8, var(--surface));
}
.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, #0b7a5a, #1aa87a);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 22px rgba(11, 122, 90, 0.28);
}
.account-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.account-nick {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.account-email {
  margin: 5px 0 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
}
.account-section {
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.account-section-head {
  margin-bottom: 10px;
}
.account-section-title {
  margin: 0 0 2px;
  font-size: 0.98rem;
  font-weight: 700;
}
.account-section-hint {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.35;
}
.settings-toggles {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}
.settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--ink);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.settings-toggle input[type="checkbox"] {
  margin: 2px 0 0;
  width: 18px !important;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0 !important;
  flex: 0 0 18px;
  accent-color: var(--accent);
  border: none;
  background: transparent;
  box-shadow: none;
}
.settings-toggle span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.settings-danger {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e3a39c;
  background: #fff8f7;
}
.settings-danger-text {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 700;
  min-height: 44px;
  width: 100%;
}
.btn-danger:hover {
  filter: brightness(1.05);
  border-color: var(--danger);
}
.settings-in-form {
  margin: 16px 0 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.account-actions-stack {
  display: grid;
  gap: 6px;
}
.account-row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7f9fc;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.account-row-btn:hover {
  border-color: #b7c4d4;
  background: #eef3f8;
}
.account-row-chevron {
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}
.account-actions .btn-ghost,
.account-actions .btn-primary {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.92rem;
}
.account-footer {
  display: flex;
  gap: 8px;
  padding: 14px 18px 18px;
  background: #fafbfc;
}
.account-footer .btn-primary {
  flex: 1;
}
.account-logout {
  color: var(--danger);
}
.tg-link-panel {
  margin-top: 4px;
}
.tg-accounts {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.tg-accounts:empty {
  display: none;
}
.tg-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f0f7f4;
  border: 1px solid #d5e8df;
  font-size: 0.92rem;
}
.tg-account-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
}
.tg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2aabee;
  flex-shrink: 0;
}
.tg-unlink {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
.tg-confirm-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 10px;
}
.tg-confirm-row input {
  flex: 1;
  min-width: 0;
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 1rem;
}
.tg-site-code {
  margin: 0 0 10px;
  padding: 12px;
  border-radius: 12px;
  background: #eef5fb;
  border: 1px dashed #9bb8d6;
  font-family: var(--mono);
  font-size: 1.3rem;
  letter-spacing: 0.16em;
  text-align: center;
  color: var(--ink);
  font-weight: 600;
}

.nick-dialog h2 { margin: 0 0 8px; font-size: 1.35rem; }
.nick-hint { color: var(--muted); margin: 0 0 14px; font-size: 0.98rem; }
.auth-name-line {
  margin: 0 0 4px;
  font-size: 1.08rem;
  font-weight: 700;
}
.auth-email-line {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0 16px;
  word-break: break-all;
  color: var(--muted);
}
.nick-dialog .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nick-dialog .actions .btn-primary {
  flex: 1 1 100%;
}
.nick-dialog input:not([type="checkbox"]) {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.nick-error { color: var(--danger); margin: 8px 0 0; font-size: 0.95rem; }

/* Планшет: сетка номеров остаётся видимой */
@media (max-width: 900px) {
  :root { --app-max: 960px; }
  .nav-strip-row {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 4px;
  }
  .nav-chip {
    height: 30px;
    min-height: 30px;
    font-size: 0.7rem;
  }
}

/* Телефон */
@media (max-width: 640px) {
  :root {
    --text: 1.05rem;
    --app-max: 100%;
  }
  .app { width: calc(100% - 16px); padding-top: 10px; }
  .top {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }
  .player-panel {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  .stats { text-align: right; font-size: 0.68rem; white-space: normal; }
  .account-chip { max-width: min(180px, 52vw); }
  .main-nav-row-primary,
  .main-nav-row-modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .nav-item { min-height: 48px; font-size: 0.85rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .ticket { min-height: 84px; padding: 12px; }
  .panel { padding: 14px; }
  .answer { min-height: 48px; padding: 12px 14px; }
  .btn-next {
    position: sticky;
    bottom: calc(8px + var(--safe-bottom));
    z-index: 5;
  }
}

@media (max-width: 640px) {
  .q-image {
    max-height: min(280px, 38vh);
  }
}

/* Узкие экраны */
@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .stats { font-size: 0.72rem; }
  .errors-stats { gap: 6px; }
  .errors-stat { padding: 8px 8px; }
  .errors-stat-n { font-size: 1.15rem; }
  .errors-stat-l { font-size: 0.7rem; }
}

/* Широкие мониторы: не растягиваем вопросы шире 980px */
@media (min-width: 1280px) {
  :root { --app-max: 980px; --text: 1.12rem; }
  .nav-chip { height: 34px; min-height: 34px; font-size: 0.78rem; }
}

/* Telegram Mini App */
body.tg-webapp {
  background: var(--tg-theme-bg-color, var(--bg));
  color: var(--tg-theme-text-color, var(--ink));
  padding-top: env(safe-area-inset-top, 0px);
}
body.tg-webapp .app {
  padding-bottom: calc(12px + var(--safe-bottom));
}
body.tg-webapp .brand-sub::after {
  content: " · Telegram";
}

/*
  Телефон + Mini App: nav-strip скрыт, пока не раскрыт.
  Управление (назад + прогресс▾) живёт в quiz-head — верх экрана свободен.
*/
@media (max-width: 640px) {
  .quiz-toolbar-desktop,
  .quiz-nav-label-desktop {
    display: none !important;
  }
  .nav-strip:not(.marathon-nav):not(.is-open) {
    display: none !important;
  }
  .nav-strip:not(.marathon-nav).is-open {
    display: block;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 14px;
    box-shadow: var(--elev-1);
  }
  .nav-strip:not(.marathon-nav).is-open > .nav-strip-row {
    display: flex !important;
    min-width: 0;
    grid-template-columns: none !important;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0;
    mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 18px), transparent);
  }
  .nav-strip:not(.marathon-nav).is-open > .nav-strip-row::-webkit-scrollbar {
    display: none;
  }
  .quiz-mobile-line {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .marathon-mobile-line {
    display: flex !important;
  }
  .marathon-nav {
    padding: 8px 10px;
  }
  .marathon-nav .quiz-back-icon,
  .marathon-nav .quiz-icon-btn {
    display: grid;
  }
  .quiz-panel {
    padding-top: 12px;
  }
  .quiz-head {
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  .quiz-head-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }
  .quiz-head-label,
  .quiz-head-progress {
    display: none !important;
  }
  .quiz-head-right {
    flex-shrink: 0;
  }
  .quiz-icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--ink);
    flex-shrink: 0;
    box-shadow: none;
  }
  .quiz-icon-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .quiz-icon-btn:hover {
    background: #e8eef5;
  }
  .quiz-back-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: none;
  }
  .nav-chip {
    flex: 0 0 auto;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 10px;
    font-size: 0.78rem;
  }
  .nav-chip.wide {
    width: auto;
    min-width: 48px;
    padding: 0 8px;
  }
  body.quiz-mixed .nav-strip-row {
    grid-template-columns: none !important;
  }
  .quiz-mobile-timer {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 40px;
    padding: 0 10px;
    border-radius: 12px;
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
  }
  .question-text {
    margin-top: 2px;
  }
}

body.tg-webapp .quiz-toolbar-desktop,
body.tg-webapp .quiz-nav-label-desktop {
  display: none !important;
}
body.tg-webapp .nav-strip:not(.marathon-nav):not(.is-open) {
  display: none !important;
}
body.tg-webapp .nav-strip:not(.marathon-nav).is-open {
  display: block;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 14px;
  box-shadow: var(--elev-1);
}
body.tg-webapp .nav-strip:not(.marathon-nav).is-open > .nav-strip-row {
  display: flex !important;
  min-width: 0;
  grid-template-columns: none !important;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
body.tg-webapp .quiz-mobile-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
body.tg-webapp .marathon-mobile-line {
  display: flex !important;
}
body.tg-webapp .marathon-nav {
  padding: 8px 10px;
}
body.tg-webapp .marathon-nav .quiz-back-icon,
body.tg-webapp .marathon-nav .quiz-icon-btn {
  display: grid;
}
body.tg-webapp .quiz-panel {
  padding-top: 12px;
}
body.tg-webapp .quiz-head {
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
body.tg-webapp .quiz-head-mobile {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
body.tg-webapp .quiz-head-label,
body.tg-webapp .quiz-head-progress {
  display: none !important;
}
body.tg-webapp .quiz-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  flex-shrink: 0;
  box-shadow: none;
}
body.tg-webapp .quiz-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.tg-webapp .nav-chip {
  flex: 0 0 auto;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 10px;
}
body.tg-webapp .quiz-back-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: none;
}
body.tg-webapp .quiz-mobile-timer {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

/* Cookie consent + analytics */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  padding: 12px 12px calc(12px + var(--safe-bottom));
  pointer-events: none;
}
.cookie-banner.hidden {
  display: none;
}
.cookie-banner-inner {
  pointer-events: auto;
  width: min(720px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(26, 35, 50, 0.14);
}
.cookie-banner-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}
.cookie-banner-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-banner-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  align-items: center;
}
.cookie-banner-actions .btn-primary,
.cookie-banner-actions .btn-ghost {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}
@media (max-width: 640px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-banner-actions {
    width: 100%;
  }
  .cookie-banner-actions .btn-primary,
  .cookie-banner-actions .btn-ghost {
    flex: 1;
  }
}
body.tg-webapp .cookie-banner {
  display: none !important;
}
