/* ЕГЭ на числовой прямой. Метки: 1 — сплошная, 2 — мягкая, 3+ — контур; В синие, П оранжевые. */

/* Вкладки задач */
.ege-tabs, .ege-sub { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.55rem; }
.ege-tab, .ege-subbtn { font: inherit; min-height: 44px; padding: 0.4rem 0.85rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; }
.ege-tab:hover, .ege-subbtn:hover { border-color: var(--muted); }
.ege-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ege-tab .ts { display: none; }
.ege-sub[hidden] { display: none; }
.ege-subbtn { font-size: 0.95rem; }
.ege-subbtn[aria-pressed="true"] { border: 2px solid var(--ink); font-weight: 700; }

/* Своя задача */
.ege-custom { margin: 0 0 0.6rem; }
.ege-fields { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: flex-end; }
.ege-fields label { display: grid; gap: 0.2rem; font-size: 0.92rem; }
.ege-fields label[hidden] { display: none; }
.ege-fields input, .ege-fields select { min-height: 44px; font-weight: 400; background: #fff; }
#c-ops { width: 12rem; font-family: var(--mono); }
.ege-fields input[type="number"] { width: 7rem; }
.ege-dir { margin: 0.5rem 0 0; font-size: 0.92rem; }
.ege-custom .error { margin: 0.5rem 0 0; }

.ege-cond { margin: 0.1rem 0 0.7rem; font-size: 1.05rem; max-width: 62rem; }
.ege-cond.stale { visibility: hidden; } /* условие прошлой задачи, пока грузится новая */

/* Вопросы и ответ: ответ в одной строке с кнопками, чтобы прямая была выше */
.ege-qrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; }
.ege-qs { display: flex; gap: 0.5rem; }
.ege-qs .btn { font-weight: 700; font-size: 1.05rem; min-width: 5.4rem; }
.ege-qs .btn[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.ege-ans { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.4rem; font-size: 1.35rem; font-weight: 800; color: var(--ok); }
.ege-ans .none { color: var(--muted); font-size: 1.1rem; }
.ege-ans .more { color: var(--muted); font-size: 0.95rem; font-weight: 600; }
.ege-av { font: inherit; min-width: 44px; min-height: 44px; padding: 0 0.45rem; border: 2px solid var(--ok); border-radius: 8px; background: #fff; color: var(--ok); cursor: pointer; font-variant-numeric: tabular-nums; line-height: 1; }
.ege-av:hover { background: #ecfdf3; }
.ege-av[aria-pressed="true"] { background: var(--ok); color: #fff; }
.ege-qtext { margin: 0.35rem 0 0.6rem; min-height: 1.45em; color: var(--muted); }

/* Числовая прямая */
.ege-line { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; scrollbar-width: thin; overscroll-behavior-x: contain; min-height: 6rem; }
.ege-line:focus-visible { outline: 3px solid var(--win); outline-offset: 2px; }
.ege-line[aria-busy="true"] { opacity: 0.6; }
.ege-line[aria-busy="true"] .ege-svg { cursor: progress; } /* пока грузится другая задача, старая прямая не отвечает */
.ege-svg { display: block; cursor: pointer; font-family: var(--font); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

.axis { stroke: #9aa3b1; stroke-width: 2; }
.zone { stroke: #c3cad5; stroke-width: 1; }
.zt, .zc { text-anchor: middle; fill: #374151; paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round; }
.zt { font-size: 0.85rem; font-weight: 700; dominant-baseline: central; }
.zc { font-size: 0.82rem; font-weight: 600; }

.pt .bd, .pt .lb, .pt .sn { transition: opacity 0.2s; }
.pt .bd { stroke-width: 2; }
.pt .lb { font-size: 0.8rem; font-weight: 800; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pt .lb.sm { font-size: 0.6rem; }
.pt .tk { stroke: #9aa3b1; stroke-width: 1.5; }
.pt .sn { font-size: 0.82rem; text-anchor: middle; fill: var(--ink); font-variant-numeric: tabular-nums; }
.pt .sn.md { font-size: 0.8rem; }
.pt .sn.sm { font-size: 0.66rem; }
.pt.v1 .bd { fill: #1d4ed8; stroke: #1d4ed8; }
.pt.v1 .lb { fill: #fff; }
.pt.v2 .bd { fill: #bfdbfe; stroke: #3b82f6; }
.pt.v2 .lb { fill: #1e3a8a; }
.pt.v3 .bd { fill: #fff; stroke: #93c5fd; }
.pt.v3 .lb { fill: #1d4ed8; }
.pt.p1 .bd { fill: #c2410c; stroke: #c2410c; }
.pt.p1 .lb { fill: #fff; }
.pt.p2 .bd { fill: #fed7aa; stroke: #f97316; }
.pt.p2 .lb { fill: #7c2d12; }
.pt.p3 .bd { fill: #fff; stroke: #fdba74; }
.pt.p3 .lb { fill: #c2410c; }
.pt.end .bd { fill: #e5e7eb; stroke: #9ca3af; }
.pt.end .lb { fill: #374151; }
.pt.sel .sn, .pt.ans .sn { font-weight: 800; }
.pt.ans .sn { fill: var(--ok); }
/* В режиме вопроса прочие позиции бледнее, но номера S читаются и на проекторе */
.qmode .pt:not(.ans):not(.sel):not(.tgt) .bd, .qmode .pt:not(.ans):not(.sel):not(.tgt) .lb { opacity: 0.35; }
.qmode .pt:not(.ans):not(.sel):not(.tgt) .sn { opacity: 0.75; }
.ring-sel { fill: none; stroke: var(--ink); stroke-width: 3; }
.ring-ans { fill: none; stroke: var(--ok); stroke-width: 3.5; }

/* Дуги ходов */
.arc { fill: none; stroke-width: 3; stroke-linecap: round; }
.arc.v1 { stroke: #1d4ed8; } .head.v1 { fill: #1d4ed8; }
.arc.v2 { stroke: #3b82f6; } .head.v2 { fill: #3b82f6; }
.arc.v3 { stroke: #93c5fd; } .head.v3 { fill: #93c5fd; }
.arc.p1 { stroke: #c2410c; } .head.p1 { fill: #c2410c; }
.arc.p2 { stroke: #f97316; } .head.p2 { fill: #f97316; }
.arc.p3 { stroke: #fdba74; } .head.p3 { fill: #fdba74; }
.arc.end { stroke: #4b5563; stroke-dasharray: 7 5; } .head.end { fill: #4b5563; }
.arc-hint { font-size: 0.95rem; fill: var(--muted); }
.op { font-size: 0.88rem; font-weight: 800; fill: var(--ink); text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round; }

.ege-caption { margin: 0.6rem 0 0.2rem; font-size: 1.05rem; min-height: 1.5em; }

/* Ходы из позиции с двумя кучами */
.ege-next { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.3rem 0 0.4rem; }
.ege-next:empty { display: none; }
.ege-chip { padding: 0.35rem 0.75rem; border-radius: 999px; border: 2px solid; font-variant-numeric: tabular-nums; background: #fff; }
.ege-chip.v1 { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.ege-chip.v2 { background: #bfdbfe; border-color: #3b82f6; color: #1e3a8a; }
.ege-chip.v3 { border-color: #93c5fd; color: #1d4ed8; }
.ege-chip.p1 { background: #c2410c; border-color: #c2410c; color: #fff; }
.ege-chip.p2 { background: #fed7aa; border-color: #f97316; color: #7c2d12; }
.ege-chip.p3 { border-color: #fdba74; color: #c2410c; }
.ege-chip.end { background: #e5e7eb; border-color: #9ca3af; color: #374151; }
.ege-chip.bad { outline: 3px solid var(--bad); outline-offset: 2px; }

/* Легенда */
.ege-legend { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.7rem 0 0.3rem; }
.lg { display: inline-flex; align-items: center; padding: 0.1rem 0.55rem; border-radius: 6px; border: 2px solid; font-weight: 800; font-size: 0.88rem; }
.lg.v1 { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.lg.v2 { background: #bfdbfe; border-color: #3b82f6; color: #1e3a8a; }
.lg.v3 { background: #fff; border-color: #93c5fd; color: #1d4ed8; }
.lg.p1 { background: #c2410c; border-color: #c2410c; color: #fff; }
.lg.p2 { background: #fed7aa; border-color: #f97316; color: #7c2d12; }
.lg.p3 { background: #fff; border-color: #fdba74; color: #c2410c; }
.lg.end { border-color: #c3cad5; color: #374151; font-weight: 600; }
.lg.end::before { content: ""; width: 1.3em; height: 0.95em; margin-right: 0.35em; border-radius: 3px; background: repeating-linear-gradient(45deg, #f1f3f6 0 4px, #b4bcc8 4px 7px); }
.lg.none { background: #e5e7eb; border-color: #9ca3af; color: #374151; font-weight: 600; }
.lg[hidden] { display: none; }
.ege-meaning { margin: 0.3rem 0 0.6rem; font-size: 0.92rem; }

.ege-py pre { margin: 0.3rem 0 0.2rem; font-size: 0.85rem; line-height: 1.4; }

@media (min-width: 641px) {
  .pt .lb, .pt .sn { font-size: 0.9rem; }
}
@media (max-width: 640px) {
  /* короткие подписи вкладок: одна строка вместо трёх, прямая ближе к началу экрана */
  .ege-tab .tl { display: none; }
  .ege-tab .ts { display: inline; }
  .ege-tabs, .ege-sub { gap: 0.3rem; }
  .ege-tab, .ege-subbtn { padding: 0.35rem 0.5rem; font-size: 0.92rem; }
  .ege-qs { flex: 1 1 100%; }
  .ege-qs .btn { min-width: 0; flex: 1; }
  .ege-ans { font-size: 1.25rem; }
  #c-ops { width: 100%; }
  .ege-fields label:first-child { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .pt .bd, .pt .lb, .pt .sn { transition: none; }
}
