:root {
  --ink: #16213e; --muted: #56607a; --line: #dfe3ec; --bg: #f6f7fb; --card: #fff;
  --brand: #1d4ed8; --brand-dark: #1e3a8a; --accent: #f59e0b; --good: #15803d; --bad: #b91c1c; --flag: #d97706;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--brand); }
img, svg { max-width: 100%; height: auto; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: var(--brand); }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
.session { display: flex; align-items: center; gap: 10px; min-width: 120px; justify-content: flex-end; font-size: .95rem; }
.session .who { font-weight: 600; color: var(--ink); text-decoration: none; }

/* buttons */
.btn { display: inline-block; border: 0; border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-small { padding: 7px 14px; font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; }

/* home */
.hero { padding: 64px 0 48px; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.1; margin: 0 0 16px; letter-spacing: -0.02em; max-width: 18ch; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 56ch; margin: 0 0 28px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 8px 0 56px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); }
.section-title { font-size: 1.6rem; margin: 0 0 18px; letter-spacing: -0.01em; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 56px; counter-reset: step; }
.steps .card::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; margin-bottom: 10px; }
.note { font-size: .9rem; color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: .9rem; }

/* plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 380px)); gap: 20px; margin: 24px 0; }
.plan h2 { margin: 0 0 6px; }
.plan .price { font-size: 2rem; font-weight: 800; margin: 6px 0 2px; }
.plan .billing { color: var(--muted); margin: 0 0 14px; }
.plan ul { padding-left: 20px; margin: 14px 0 20px; }
.plan li { margin-bottom: 6px; }

/* forms */
.auth { max-width: 420px; margin: 40px auto; }
.auth form { display: grid; gap: 12px; }
.auth label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.auth input { font: inherit; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; }
.auth input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.auth .switch { margin-top: 14px; color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; margin: 0; }
.gate { max-width: 560px; margin: 48px auto; text-align: center; }
.placeholder { min-height: 200px; }

/* tests list */
.page-head { padding: 32px 0 8px; }
.page-head h1 { margin: 0 0 6px; }
.page-head p { margin: 0; color: var(--muted); }
.test-group { margin: 26px 0; }
.test-group h2 { font-size: 1.15rem; margin: 0 0 10px; }
.test-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.paper { display: flex; flex-direction: column; gap: 6px; }
.paper .meta { color: var(--muted); font-size: .92rem; }
.paper .last { font-size: .92rem; }
.paper .btn { align-self: flex-start; margin-top: 8px; }

/* test runner */
.runner { padding: 20px 0 40px; }
.bar { position: sticky; top: 0; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.bar .title { font-weight: 700; flex: 1; min-width: 180px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem; min-width: 64px; }
.timer.low { color: var(--bad); }
.work { display: grid; gap: 16px; grid-template-columns: 1fr; }
.work.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .work.split { grid-template-columns: 1fr; } }
.passage-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; max-height: 72vh; overflow: auto; font-size: 1rem; }
.passage-panel p { margin: 0 0 10px; }
.qpanel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.qnum { color: var(--muted); font-weight: 700; margin: 0 0 8px; font-size: .95rem; }
.qbody { font-size: 1.05rem; margin-bottom: 16px; overflow-x: auto; }
.qbody blockquote { border: 1.5px solid #333; padding: 8px 12px; margin: 8px 0 12px; }
.options { display: grid; gap: 10px; }
.options.pics { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.opt { display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; cursor: pointer; color: var(--ink); }
.opt:hover { border-color: #9fb0d8; }
.opt[aria-pressed="true"] { border-color: var(--brand); background: #eef3ff; box-shadow: 0 0 0 2px var(--brand) inset; }
.opt .letter { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--muted); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.opt[aria-pressed="true"] .letter { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt .otext { flex: 1; min-width: 0; }
.qactions { display: flex; gap: 10px; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; }
.flag-btn[aria-pressed="true"] { background: #fff7e6; border-color: var(--flag); color: var(--flag); }
.navgrid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.navgrid button { width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--brand); background: #fff; color: var(--brand); font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; }
.navgrid button.answered { background: var(--brand); color: #fff; }
.navgrid button.flagged { background: var(--flag); border-color: var(--flag); color: #fff; }
.navgrid button.current { outline: 3px solid var(--ink); outline-offset: 1px; }
.intro { max-width: 640px; margin: 24px auto; }
.intro ul { padding-left: 20px; }
.notice { background: #fff7e6; border: 1px solid #f3d59a; border-radius: 10px; padding: 10px 14px; margin: 10px 0; }

/* results */
.score-big { font-size: 2.6rem; font-weight: 800; margin: 4px 0; }
.topics { display: grid; gap: 8px; margin: 14px 0; }
.topic { display: grid; grid-template-columns: minmax(0, 2fr) 70px minmax(80px, 1fr); gap: 10px; align-items: center; font-size: .95rem; }
.meter { height: 10px; background: #e7eaf2; border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); }
.topic.weak .meter i { background: var(--accent); }
.review-item { border-top: 1px solid var(--line); padding: 16px 0; }
.review-item .verdict { font-weight: 700; }
.review-item .verdict.right { color: var(--good); }
.review-item .verdict.wrong { color: var(--bad); }
.review-item .expl { background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-top: 8px; white-space: pre-line; }
.review-item .expl-visual { white-space: normal; }
.opt.correct { border-color: var(--good); background: #eefaf1; }
.opt.chosen-wrong { border-color: var(--bad); background: #fdeeee; }
.opt[disabled] { cursor: default; }
table.history { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
table.history th, table.history td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: .95rem; }
table.history th { background: #eef1f8; }

/* paper content (questions and passages) */
.dgwrap { margin: 6px 0 12px; text-align: center; }
.qbody .after { margin-top: 6px; }
.eq { font-size: 1.15rem; margin: 8px 0 8px 18px; line-height: 1.8; }
.prices { display: flex; gap: 24px; margin: 8px 0 10px 18px; flex-wrap: wrap; }
.prices span { border: 1.4px solid #333; border-radius: 6px; padding: 6px 12px; font-weight: bold; }
table.plain td { padding: 2px 14px 2px 0; }
table.tt, table.grid { border-collapse: collapse; margin: 8px auto 10px; }
table.tt td, table.tt th, table.grid td, table.grid th { border: 1px solid #555; padding: 4px 12px; }
table.tt th, table.grid th { background: #e8e8e8; }
.small { font-size: .85rem; color: #444; margin: 2px 0 0; text-align: center; }
.mixed { white-space: nowrap; display: inline-flex; align-items: center; }
.fr { display: inline-flex; flex-direction: column; text-align: center; font-size: 85%; line-height: 1.05; vertical-align: middle; margin-left: 1px; }
.fr .nu { border-bottom: 1px solid #111; padding: 0 2px; }
.box { border: 1.3px solid #333; padding: 8px 12px; margin: 4px 0 10px; }
.speaker { margin: 6px 0 10px; }
[hidden] { display: none !important; }

/* guides */
.nav .lang { color: var(--brand); }
.article { max-width: 760px; }
.article h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15; margin: .3em 0 .2em; letter-spacing: -0.01em; }
.article h2 { margin: 1.8em 0 .5em; font-size: 1.3rem; }
.article h3 { margin: 1.3em 0 .3em; font-size: 1.05rem; }
.article p, .article li { font-size: 1.02rem; }
.article .lead { font-size: 1.15rem; color: var(--muted); }
.article li { margin: .35em 0; }
.article .small { text-align: left; color: var(--muted); }
.crumb { margin: 22px 0 0; font-size: .92rem; }
.guide-table { width: 100%; border-collapse: collapse; margin: 1em 0; background: var(--card); font-size: .95rem; }
.guide-table th, .guide-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.guide-table th { background: #eef2ff; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 20px 0 32px; }
.guide-card { display: block; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.guide-card:hover { border-color: var(--brand); }
.guide-card h3 { color: var(--brand); }
.guide-next { margin: 2.5em 0 0; }
.guide-next p { margin: 0 0 12px; }
.res li { margin: .7em 0; }
.home-guides { margin: 0 0 48px; }
@media (max-width: 520px) {
  .guide-table { font-size: .88rem; }
  .guide-table th, .guide-table td { padding: 6px 7px; }
}
.nav { flex-wrap: wrap; row-gap: 6px; }
.nav a { white-space: nowrap; }
.guide-table .nw { white-space: nowrap; }

/* phone header */
@media (max-width: 720px) {
  .site-header .wrap { gap: 10px 16px; padding-top: 10px; padding-bottom: 8px; min-height: 0;}
  .site-header .logo { order: 1; flex: 1;}
  .site-header .session { order: 2; margin-left: auto;}
  .site-header .nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; gap: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 4px 0 2px;}
  .site-header .nav::-webkit-scrollbar { display: none;}
  .site-header .nav a { white-space: nowrap; flex: none;}
}
