:root {
  --ink: #16233a; --muted: #5b6779; --bg: #f5f7fb; --card: #ffffff; --line: #dfe5ee;
  --brand: #1f4e8c; --brand-dark: #163a69; --accent: #0f8a7b; --warn: #b7791f;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 17px; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .4rem; }
a { color: var(--brand); }
.muted, small { color: var(--muted); }

.site-header { background: var(--brand-dark); color: #fff; position: sticky; top: 0; z-index: 10; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--brand-dark); margin-right: 6px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { color: #dbe6f5; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
nav a:hover { background: rgba(255,255,255,.14); color: #fff; }

.hero { padding: 2.5rem 0 1rem; }
.hero.small { padding-top: 1.6rem; }
.hero p { max-width: 46rem; color: var(--muted); font-size: 1.08rem; }

.btn { font: inherit; font-size: .95rem; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; padding: 11px 20px; }
.btn.primary:hover { background: var(--brand-dark); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.card h3 { margin-top: .5rem; }
.card p { margin: .3rem 0 0; color: var(--muted); font-size: .95rem; }
.card.live { border-color: var(--brand); box-shadow: 0 2px 10px rgba(31,78,140,.12); }
.card.live:hover { transform: translateY(-2px); }
.card.soon { opacity: .7; }
.card.plain h3 { margin-top: 0; }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #e9edf3; color: var(--muted); }
.tag.ok { background: #d9f2ee; color: #0a6257; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 20px 18px; margin-top: 1.6rem; }
.panel h2 { margin-top: 1rem; }
.section-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 8px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: .6rem; }

.progress-box { max-width: 30rem; margin-top: 1rem; }
.progress-label { display: flex; justify-content: space-between; font-weight: 600; font-size: .95rem; }
.progress-track { height: 10px; background: #dfe5ee; border-radius: 99px; overflow: hidden; margin: 4px 0; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

.topic { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.topic > summary { cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; list-style: none; }
.topic > summary::-webkit-details-marker { display: none; }
.topic > summary::before { content: "▸"; color: var(--brand); }
.topic[open] > summary::before { content: "▾"; }
.topic-title { font-weight: 700; font-size: 1.08rem; flex: 1; min-width: 12rem; }
.topic-area { font-size: .8rem; color: var(--muted); }
.topic-body { padding: 0 18px 16px; border-top: 1px solid var(--line); }
.status { font: inherit; font-size: .85rem; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.status[data-v="1"] { background: #fdf3dc; border-color: #ecd08f; }
.status[data-v="2"] { background: #d9f2ee; border-color: #8fd2c7; }
.skills { margin: .3rem 0; padding-left: 1.2rem; }
.skills li { margin: .15rem 0; }

.question { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: #fbfcfe; overflow-x: auto; }
.q-head { display: flex; gap: 8px; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.q-num { font-weight: 700; color: var(--ink); }
.pill { font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; }
.pill.nc { background: #e6ecfa; color: #27457d; }
.pill.calc { background: #fbe9d7; color: #8a4b0b; }
.marks { margin-left: auto; font-weight: 600; }
.solution { margin-top: 8px; }
.solution > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .95rem; }
.solution-body { margin-top: 6px; padding: 10px 12px; background: #eef6f4; border-left: 4px solid var(--accent); border-radius: 6px; overflow-x: auto; }
.solution-body p, .question p { margin: .4rem 0; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 28px; }
.formulae { list-style: none; padding: 0; margin: 0; }
.formulae li { padding: 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.formulae .f-name { display: block; font-size: .85rem; color: var(--muted); }
.links { padding-left: 1.2rem; }
.links li { margin: .35rem 0; }
.note { background: #fdf6e3; border-left: 4px solid var(--warn); padding: 8px 12px; border-radius: 6px; font-size: .95rem; }
table.exam { border-collapse: collapse; width: 100%; max-width: 36rem; }
table.exam th, table.exam td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }

.site-footer { margin-top: 3rem; padding: 18px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

@media print {
  .no-print, .site-header, .site-footer, .status { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .topic, .panel, .question { border-color: #999; break-inside: avoid; }
  .topic:not([open]) { display: none; }
  body.print-questions .solution { display: none; }
  #formulae, #exam { break-before: page; }
}
