/* ME Education Online */
:root {
	--ink: #17203a; --muted: #5d6781; --line: #e0e5ef; --bg: #f5f7fb; --card: #fff;
	--brand: #1f4e9c; --brand-2: #e8eefb; --accent: #f2a516;
	--ok: #1e8a4c; --ok-bg: #e5f5ec; --bad: #c0392b; --bad-bg: #fbe9e7; --warn: #a76b00; --warn-bg: #fff4dc;
	--r: 12px; --shadow: 0 1px 2px rgba(23,32,58,.06), 0 4px 16px rgba(23,32,58,.05);
}
@media (prefers-color-scheme: dark) {
	:root { --ink: #e8ecf6; --muted: #9aa5bf; --line: #2c3550; --bg: #0f1424; --card: #171e33; --brand: #7fa7f0; --brand-2: #1f2a47; --ok-bg: #12301f; --bad-bg: #3a1714; --warn-bg: #3a2c0d; --ok: #5cc98a; --bad: #f08a7e; --warn: #f0c060; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.7rem; line-height: 1.25; margin: .2em 0 .6em; }
h2 { font-size: 1.15rem; margin: 0 0 .7em; }
h3 { font-size: 1rem; margin: 1.2em 0 .5em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 20px; padding-bottom: 40px; min-height: 70vh; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 60ch; }
.bad { color: var(--bad); }

/* Header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 500; white-space: nowrap; }
.brand b { color: var(--brand); }
.logo { background: var(--brand); color: #fff; font-weight: 800; border-radius: 8px; padding: 3px 7px; font-size: .9rem; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--brand-2); color: var(--ink); }
.nav a.on { background: var(--brand-2); color: var(--brand); }
.me { position: relative; }
.me summary { cursor: pointer; list-style: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 20px; font-size: .9rem; }
.me summary::-webkit-details-marker { display: none; }
.me-menu { position: absolute; right: 0; top: 110%; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 160px; }
.me-menu a, .me-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.me-menu a:hover, .me-menu button:hover { background: var(--brand-2); }
@media (max-width: 720px) {
	.top-in { gap: 6px 10px; padding-top: 8px; }
	.nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
	.me { margin-left: auto; }
}
.foot { color: var(--muted); font-size: .85rem; padding-bottom: 30px; }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.hl { border-color: var(--accent); }
.card.off { opacity: .6; }
.narrow { max-width: 460px; margin: 30px auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.scroll-x { overflow-x: auto; }
.crumbs { margin: 0; font-size: .9rem; color: var(--muted); }
.crumbs a { text-decoration: none; }

/* Buttons and forms */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 9px; padding: 10px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid currentColor; }
.btn.sm { padding: 6px 12px; font-size: .9rem; }
.btn.wide { width: 100%; }
.btn.join { background: var(--ok); font-size: 1.05rem; padding: 10px 22px; }
.btn[disabled] { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.form label { display: block; margin: 0 0 14px; font-weight: 600; font-size: .92rem; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
input:focus, select:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-form .span2, .grid-form button { grid-column: 1 / -1; justify-self: start; }
.grid-form .span2 { justify-self: stretch; }
@media (max-width: 560px) { .grid-form { grid-template-columns: 1fr; } }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter { width: 100%; max-width: 360px; margin-bottom: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }

/* Flash and tags */
.flash { padding: 10px 14px; border-radius: 10px; background: var(--brand-2); margin: 0 0 14px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); } .flash-error { background: var(--bad-bg); color: var(--bad); } .flash-info { background: var(--warn-bg); color: var(--warn); }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--brand-2); color: var(--brand); white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pills a { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); background: var(--card); }
.pills a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Rows, tiles, stats */
.row-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.row-link:first-of-type { border-top: 0; }
a.row-link:hover { background: var(--brand-2); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tiles.big { margin-bottom: 18px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); text-decoration: none; color: inherit; }
a.tile:hover { border-color: var(--brand); }
.tile span { color: var(--muted); font-size: .9rem; }
.tile.exam .btn { align-self: flex-start; margin-top: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; }
.stat.big b { font-size: 2.2rem; color: var(--brand); }
.stat span { color: var(--muted); font-size: .88rem; }
.score { font-weight: 700; font-size: 1.1rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 600; }
.table tr.off td { opacity: .5; }
.w30 { width: 30%; } .w40 { width: 40%; }
@media (max-width: 600px) { .hide-sm { display: none; } }
.list { padding-left: 1.1em; margin: 0; } .list li { margin: 4px 0; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 8px 0 8px 30px; position: relative; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks li::before { position: absolute; left: 0; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--ok); } .checks li.todo::before { content: "○"; color: var(--warn); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }

/* Mastery bars and chart */
.mbar { display: inline-block; width: 100%; min-width: 70px; height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; vertical-align: middle; }
.mbar > span { display: block; height: 100%; background: var(--brand); }
.mbar-strength > span { background: var(--ok); } .mbar-weakness > span { background: var(--bad); } .mbar-new > span { background: var(--muted); }
.chart { display: flex; gap: 8px; align-items: flex-end; height: 160px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.chart .bar { width: 100%; max-width: 46px; background: var(--brand-2); border-radius: 6px 6px 0 0; display: flex; align-items: flex-end; min-height: 2px; }
.chart .bar .ok { width: 100%; background: var(--ok); border-radius: 6px 6px 0 0; }
.chart .lbl, .chart .num { font-size: .75rem; color: var(--muted); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: middle; }
.key.ok { background: var(--ok); } .key.all { background: var(--brand-2); border: 1px solid var(--line); }
.key.done { background: var(--brand); } .key.flag { background: var(--accent); }

/* Skills list */
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.skill { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: inherit; }
.skill:hover { border-color: var(--brand); }
.skill-name { display: flex; flex-direction: column; }
.skill-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; width: 90px; flex-shrink: 0; }

/* Questions */
.q { padding: 12px 0; border-top: 1px dashed var(--line); }
.q:first-child { border-top: 0; }
.q-stem { margin-bottom: 10px; }
.q-stem.big { font-size: 1.18rem; line-height: 1.6; }
.q-fig { margin: 10px 0; overflow-x: auto; color: var(--ink); }
.q-fig svg { max-width: 100%; height: auto; }
.qs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 800px) { .qs { grid-template-columns: 1fr; } }
.opts { margin: 6px 0 8px; padding-left: 1.6em; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 2px 14px; }
.sol summary, .report summary { cursor: pointer; color: var(--brand); font-size: .9rem; }
.sol[open] { background: var(--brand-2); border-radius: 8px; padding: 8px 12px; }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .9em; line-height: 1.1; margin: 0 2px; }
.fr > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 2px; }
.qhead { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.levels { display: flex; gap: 6px; flex-wrap: wrap; }
.lvl { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--muted); }
.lvl.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.qcard { max-width: 760px; }
.qcard.right { border-top: 5px solid var(--ok); } .qcard.wrong { border-top: 5px solid var(--bad); }
.verdict { font-size: 1.4rem; font-weight: 700; margin: 0 0 10px; }
.right .verdict { color: var(--ok); } .wrong .verdict { color: var(--bad); }
.solution { background: var(--brand-2); border-radius: 10px; padding: 10px 14px; margin-top: 12px; }
.solution h3 { margin-top: 0; }
.answer input { display: block; font-size: 1.3rem; width: 220px; max-width: 100%; margin-top: 6px; }
.choices { display: grid; gap: 8px; margin: 12px 0; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 1.08rem; }
.choice:hover { border-color: var(--brand); }
.choice input { position: absolute; opacity: 0; }
.choice .letter { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-2); }
.choice:has(input:checked) .letter { background: var(--brand); color: #fff; border-color: var(--brand); }
.choice:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); }

/* Lessons */
.lesson { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.lesson:first-of-type { border-top: 0; }
.lesson-when { display: flex; flex-direction: column; font-size: .92rem; }
.lesson-what { display: flex; flex-direction: column; gap: 2px; }
.lesson-cancelled .lesson-what b { text-decoration: line-through; }
@media (max-width: 600px) { .lesson { grid-template-columns: 1fr; gap: 4px; } .lesson-when { flex-direction: row; gap: 8px; } }
.weeks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.weeks a { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: inherit; height: 100%; }
.weeks a:hover { border-color: var(--brand); }
.wk { font-size: .78rem; color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ideas li { margin: 6px 0; }
.world { background: linear-gradient(135deg, var(--card), var(--brand-2)); }
.plan-steps li { margin: 6px 0; } .plan-steps b { display: inline-block; min-width: 170px; }
.challenge { border-color: var(--accent); }
.pager { display: flex; justify-content: space-between; gap: 10px; }

/* Exam screen */
.exam-app { max-width: 820px; margin: 0 auto; }
.exam-bar { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin-bottom: 12px; position: sticky; top: 64px; z-index: 5; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.timer.low { color: var(--bad); }
.exam-map { display: flex; flex-wrap: wrap; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 12px; }
.exam-map[hidden] { display: none; }
.exam-map p { flex-basis: 100%; margin: 6px 0 0; }
.mapq { width: 40px; height: 40px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); font: inherit; cursor: pointer; color: var(--ink); }
.mapq.done { background: var(--brand); color: #fff; border-color: var(--brand); }
.mapq.flag { box-shadow: inset 0 -4px 0 var(--accent); }
.mapq.cur { outline: 3px solid var(--accent); }
.exam-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }
.flagbox { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.review { border-top: 1px solid var(--line); padding: 10px 0; }
.review summary { cursor: pointer; font-weight: 600; }
.review .mark { display: inline-block; width: 22px; }
.review.right .mark { color: var(--ok); } .review.wrong .mark { color: var(--bad); }
.bankq { border-top: 1px solid var(--line); padding-top: 8px; }
.bankq.retired, .bankq.reported { opacity: .55; }
@media print { .top, .foot, .btn, form { display: none !important; } .card { box-shadow: none; break-inside: avoid; } }
@media (max-width: 600px) {
	h1 { font-size: 1.4rem; }
	.card { padding: 14px 14px; }
	.exam-bar { top: 104px; padding: 8px 10px; }
	.exam-bar > b { font-size: .85rem; line-height: 1.3; }
	.timer { font-size: 1.1rem; white-space: nowrap; }
	.choice { padding: 10px 12px; }
	.nav { mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
.modpick { max-width: 100%; min-width: 0; font-size: .85rem; padding: 5px 8px; }
