/* Экран теста: спокойный и контрастный, как настоящий экзамен. Бунт живёт снаружи. */
.ag-player {
  --ink: #15191e;
  --ink-2: #4a525c;
  --line: #d9dee4;
  --paper: #ffffff;
  --bg: #f3f5f7;
  --accent: #1d6b45;
  --accent-ink: #ffffff;
  --ok: #157347;
  --ok-bg: #e6f4ec;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn: #9a5b00;
  --focus: #2b6cff;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100%;
  line-height: 1.5;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}
.ag-player *, .ag-modal * { box-sizing: border-box; }
.ag-player :focus-visible, .ag-modal :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.ag-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 22px; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.ag-top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ag-top-right .ag-link-btn { white-space: nowrap; }
.ag-top-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-brand-dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #e11d2a; position: relative; flex: none; }
.ag-brand-dot::after { content: ""; position: absolute; left: 50%; top: -1px; width: 3px; height: 10px; background: #e11d2a; transform: translateX(-50%) rotate(-45deg); }
.ag-top-right { display: flex; align-items: center; gap: 16px; }

.ag-progress { height: 4px; background: var(--line); }
.ag-progress > span { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }

.ag-main { max-width: 1180px; margin: 0 auto; padding: 28px 22px 64px; }
.ag-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; max-width: 760px; margin: 24px auto; }
.ag-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 6px; }
.ag-player h1 { font-size: clamp(26px, 3.2vw, 34px); line-height: 1.2; margin: 0 0 12px; }
.ag-player h2 { font-size: 21px; margin: 0 0 10px; }
.ag-lead { font-size: 18px; color: var(--ink-2); margin: 0 0 18px; }
.ag-note { color: var(--ink-2); font-size: 15px; }
.ag-facts { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0 0 22px; }
.ag-facts li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.ag-rules { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 18px; }
.ag-rules ul { margin: 0; padding-left: 20px; }
.ag-rules li { margin: 4px 0; }

.ag-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.ag-btn { -webkit-appearance: none; appearance: none; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); font: inherit; font-weight: 650; padding: 11px 20px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; }
.ag-btn:hover { background: var(--bg); }
.ag-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ag-btn-primary:hover { background: #155636; }
.ag-btn:disabled { opacity: .45; cursor: not-allowed; }
.ag-btn-kofi { background: #ff5e5b; border-color: #ff5e5b; color: #fff; }
.ag-btn-kofi:hover { background: #e94d4a; }
.ag-link-btn { appearance: none; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 15px; text-decoration: underline; cursor: pointer; padding: 8px 4px; }
.ag-link-btn:hover { color: var(--ink); }

/* Вопрос */
.ag-main-q { padding-top: 18px; }
.ag-qhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ag-qcount { font-weight: 700; color: var(--ink-2); }
.ag-badge { background: #fff4d6; color: #6b4a00; border: 1px solid #f0d48a; border-radius: 999px; padding: 3px 12px; font-size: 14px; font-weight: 600; }
.ag-clockwrap { display: flex; flex-direction: column; align-items: flex-end; }
.ag-clock { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 800; letter-spacing: .02em; padding: 2px 14px; border-radius: 8px; background: var(--paper); border: 2px solid var(--line); }
.ag-clock.is-low { border-color: #e8a33d; color: var(--warn); }
.ag-clock.is-critical { border-color: var(--bad); color: var(--bad); }
.ag-clock.is-critical::before { content: "⏱ "; }
.ag-pace { font-size: 13px; color: var(--ink-2); margin-top: 4px; min-height: 18px; }
.ag-pace.is-over { color: var(--warn); font-weight: 600; }

.ag-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.ag-single { max-width: 780px; margin: 0 auto; }
.ag-stimulus { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.ag-passage { max-height: 70vh; overflow: auto; }
.ag-passage h3 { margin: 0 0 10px; font-size: 18px; }
.ag-passage p { margin: 0 0 12px; }
.ag-qcol { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.ag-instruction { color: var(--ink-2); font-size: 15px; margin: 0 0 8px; font-style: italic; }
.ag-question { font-size: 19px; font-weight: 600; line-height: 1.45; margin: 0 0 18px; }
.ag-question .ag-q-line { display: block; }
.ag-question .ag-q-last { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

.ag-options { display: grid; gap: 10px; }
.ag-option { display: flex; align-items: center; gap: 12px; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--paper); transition: border-color .12s, background .12s; }
.ag-option:hover { border-color: #9aa5b1; }
.ag-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ag-option-key { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink-2); display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.ag-option:has(input:checked) { border-color: var(--accent); background: #eef7f2; }
.ag-option:has(input:checked) .ag-option-key { background: var(--accent); border-color: var(--accent); color: #fff; }
.ag-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.ag-option.is-correct { border-color: var(--ok); background: var(--ok-bg); }
.ag-option.is-correct .ag-option-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.ag-option.is-correct .ag-option-text::after { content: "  ✓ correct"; font-weight: 700; color: var(--ok); }
.ag-option.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.ag-option.is-wrong .ag-option-text::after { content: "  ✗ your answer"; font-weight: 700; color: var(--bad); }
.ag-option:has(input:disabled) { cursor: default; }

.ag-qactions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.ag-explain:empty { display: none; }
.ag-explain-card { margin-top: 16px; border-radius: 10px; padding: 14px 16px; border-left: 5px solid; }
.ag-explain-card p { margin: 6px 0; }
.ag-explain-card.is-ok { background: var(--ok-bg); border-color: var(--ok); }
.ag-explain-card.is-bad { background: var(--bad-bg); border-color: var(--bad); }
.ag-explain-card.is-hint { background: #eef2ff; border-color: #4f5bd5; }
.ag-verdict { font-weight: 800; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.ag-why-wrong { color: #7a1a12; }
.ag-tip { background: #fff8e1; border-radius: 8px; padding: 8px 10px; }

/* Визуальные задачи */
.ag-visual { display: grid; gap: 14px; }
.ag-visual-pair { grid-template-columns: 1fr 1fr; }
.ag-visual-quad { grid-template-columns: repeat(4, 1fr); }
.ag-split:has(.ag-visual) { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.ag-fig { margin: 0; }
.ag-fig svg { width: 100%; height: auto; display: block; border-radius: 6px; }
.ag-fig figcaption { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.ag-zoom-btn { appearance: none; -webkit-appearance: none; color: var(--ink); min-height: 36px; border: 1.5px solid var(--ink-2); background: var(--paper); border-radius: 8px; padding: 4px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.ag-zoom-btn::before { content: "⌕ "; }
.ag-codes { width: 100%; border-collapse: collapse; font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 20px; letter-spacing: .06em; }
.ag-codes th { font-family: system-ui, sans-serif; font-size: 13px; letter-spacing: 0; text-transform: uppercase; color: var(--ink-2); text-align: left; padding: 6px 10px; border-bottom: 2px solid var(--line); }
.ag-codes td { padding: 10px; border-bottom: 1px solid var(--line); }
.ag-codes td:first-child { color: var(--ink-2); font-family: system-ui, sans-serif; font-size: 15px; width: 3em; }

/* Модальные окна */
.ag-modal { position: fixed; inset: 0; background: rgba(10, 14, 18, .94); z-index: 1000; display: flex; flex-direction: column; padding: 16px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.ag-modal-bar { display: flex; justify-content: space-between; align-items: center; color: #fff; padding: 0 4px 10px; }
.ag-modal-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.ag-modal-close { width: 48px; height: 48px; border-radius: 50%; border: 2px solid #fff; background: #15191e; color: #fff; font-size: 22px; cursor: pointer; }
.ag-modal-body { flex: 1; overflow: auto; background: #fff; border-radius: 12px; display: grid; place-items: center; padding: 12px; }
.ag-modal-body svg { width: min(100%, 1200px); height: auto; max-height: 100%; }
.ag-dialog { align-items: center; justify-content: center; }
.ag-dialog-box { background: #fff; color: #15191e; border-radius: 14px; padding: 26px; max-width: 460px; width: 100%; }
.ag-dialog-box h2 { margin: 0 0 8px; font-size: 21px; }
.ag-dialog-box .ag-btn { border: 2px solid #15191e; background: #fff; color: #15191e; font: inherit; font-weight: 650; padding: 10px 18px; border-radius: 10px; cursor: pointer; }
.ag-dialog-box .ag-btn-primary { background: #1d6b45; border-color: #1d6b45; color: #fff; }
.ag-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #15191e; color: #fff; padding: 12px 18px; border-radius: 10px; max-width: min(92vw, 560px); z-index: 1100; font-family: system-ui, sans-serif; font-size: 15px; box-shadow: 0 8px 30px rgba(0,0,0,.3); transition: opacity .6s; }
.ag-toast.is-out { opacity: 0; }
.ag-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Перерыв и отчёт */
.ag-break { text-align: left; }
.ag-report { max-width: 980px; }
.ag-report h1 { font-size: clamp(28px, 4vw, 40px); }
.ag-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 20px 0 8px; }
.ag-stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.ag-stat-label { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 700; }
.ag-stat-value { font-size: 30px; line-height: 1.15; }
.ag-stat-hint { font-size: 13px; color: var(--ink-2); }
.ag-section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 16px; }
.ag-insights { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ag-insight { display: flex; gap: 12px; align-items: flex-start; }
.ag-insight-tag { flex: none; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border-radius: 6px; padding: 3px 8px; margin-top: 2px; min-width: 68px; text-align: center; }
.ag-insight.is-time .ag-insight-tag { background: #fff1d6; color: #7a4a00; }
.ag-insight.is-error .ag-insight-tag { background: var(--bad-bg); color: var(--bad); }
.ag-insight.is-tip .ag-insight-tag { background: #e7efff; color: #2340a8; }
.ag-insight.is-info .ag-insight-tag { background: var(--bg); color: var(--ink-2); }
.ag-nums { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; column-gap: 28px; margin: 6px 0; }
.ag-nums dt { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; grid-row: 1; }
.ag-nums dd { margin: 0; font-size: 28px; font-weight: 800; grid-row: 2; }
.ag-nums .is-ok { color: var(--ok); } .ag-nums .is-bad { color: var(--bad); } .ag-nums .is-skip, .ag-nums .is-unsent { color: var(--ink-2); }
.ag-timeline { position: relative; height: 120px; display: flex; align-items: flex-end; gap: 4px; padding: 8px 0 0; border-bottom: 2px solid var(--line); margin: 16px 0; }
.ag-tbar { flex: 1; min-width: 8px; border-radius: 4px 4px 0 0; position: relative; background: #9aa5b1; }
.ag-tbar.is-correct { background: #2f9e66; }
.ag-tbar.is-wrong { background: repeating-linear-gradient(45deg, #c0392b 0 5px, #d9534f 5px 10px); }
.ag-tbar.is-skipped { background: #c7cdd4; }
.ag-tbar.is-unsent { background: transparent; border: 2px dashed #c7cdd4; border-bottom: 0; }
.ag-tbar.is-hinted { background: #7c87e0; }
.ag-tbar-mark { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: var(--ink-2); }
.ag-tline { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--warn); pointer-events: none; }
.ag-tline::after { content: "pace target"; position: absolute; right: 0; top: -18px; font-size: 11px; color: var(--warn); font-weight: 700; }
.ag-skills-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ag-skills { width: 100%; border-collapse: collapse; font-size: 15px; }
.ag-skills th, .ag-skills td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.ag-skills th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.ag-review { margin-top: 14px; }
.ag-review summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.ag-review-item { border-top: 1px solid var(--line); padding: 12px 0; }
.ag-review-item p { margin: 5px 0; }
.ag-review-meta { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.ag-review-q { font-weight: 600; }
.ag-review-visual { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 520px; }
.ag-review-visual svg { width: 100%; height: auto; }
.ag-support { display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; background: #15191e; color: #fff; border-radius: var(--radius); padding: 24px; margin-top: 22px; }
.ag-support h2 { color: #fff; }
.ag-support p { margin: 0; color: #c9d1d9; }
.ag-support-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ag-support .ag-btn:not(.ag-btn-kofi) { background: transparent; color: #fff; border-color: #fff; }

@media (max-width: 860px) {
  .ag-split, .ag-split:has(.ag-visual) { grid-template-columns: 1fr; }
  .ag-visual-quad { grid-template-columns: repeat(2, 1fr); }
  .ag-passage { max-height: none; }
  .ag-card { padding: 22px; }
}
@media (max-width: 520px) {
  .ag-top { padding: 10px 14px; }
  .ag-main { padding: 16px 12px 48px; }
  .ag-nums { column-gap: 16px; }
  .ag-nums dd { font-size: 22px; }
  .ag-skills th, .ag-skills td { padding: 6px 4px; font-size: 13px; }
  .ag-visual { gap: 8px; }
  .ag-qcol, .ag-stimulus { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .ag-progress > span, .ag-option, .ag-toast { transition: none; }
}
