:root {
  color-scheme: dark;
  --bg: #0b192d;
  --ink: #f4f7fb;
  --muted: #a8b8ca;
  --line: rgba(216, 232, 255, .13);
  --card: #132a48;
  --card-soft: #10233e;
  --blue: #69b3ff;
  --teal: #73e0c4;
  --green: #55d69d;
  --coral: #ff8e9b;
  --yellow: #ffd27a;
  --shadow: 0 18px 45px rgba(1, 10, 25, .32);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { background: radial-gradient(circle at 88% -8%, rgba(41, 132, 222, .31), transparent 25rem), radial-gradient(circle at 0 37%, rgba(22, 189, 169, .14), transparent 26rem), var(--bg); }
button { border: 0; color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.app-shell { width: min(100%, 580px); min-height: 100dvh; margin: auto; padding: calc(15px + env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0; background: transparent; text-align: left; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 12px; background: linear-gradient(145deg, #73e0c4, #3b8de1); color: #062441; font-size: 12px; font-weight: 900; letter-spacing: .3px; box-shadow: 0 7px 18px rgba(70, 178, 218, .25); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; letter-spacing: -.2px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.icon-button, .close-modal { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255, 255, 255, .06); color: #cfe9ff; font-family: Georgia, serif; font-size: 18px; font-style: italic; }

.hero { position: relative; overflow: hidden; padding: 24px; border-radius: 27px; background: linear-gradient(135deg, #174a74, #12345a 57%, #0c213d); box-shadow: var(--shadow); }
.hero::after { position: absolute; right: -62px; bottom: -104px; width: 250px; height: 250px; border: 1px solid rgba(179, 236, 255, .22); border-radius: 50%; content: ""; box-shadow: -36px -23px 0 -1px rgba(179, 236, 255, .09), -72px -47px 0 -2px rgba(179, 236, 255, .07); }
.eyebrow { margin: 0 0 7px; color: #b8eaff; font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { max-width: 300px; font-size: 29px; line-height: 1.06; letter-spacing: -1.15px; }
h2 { font-size: 21px; line-height: 1.1; letter-spacing: -.7px; }
h3 { font-size: 14px; line-height: 1.2; letter-spacing: -.2px; }
.hero-copy { position: relative; z-index: 1; max-width: 325px; margin-top: 11px; color: #c5daec; font-size: 13px; line-height: 1.48; }
.hero-actions { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 20px; }
.hero-stat { color: #d7efff; font-size: 11px; font-weight: 750; }

.section-title { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin: 26px 1px 12px; }
.section-title p { color: var(--muted); font-size: 11px; text-align: right; }
.topic-grid { display: grid; gap: 10px; }
.topic-card { width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 20px; background: rgba(19, 42, 72, .93); text-align: left; transition: transform .16s ease, border-color .16s ease; }
.topic-card:active { transform: scale(.985); }
.topic-card:hover { border-color: rgba(126, 202, 255, .4); }
.topic-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.topic-index { display: grid; place-items: center; flex: none; width: 31px; height: 31px; margin-right: 10px; border-radius: 10px; background: rgba(115, 224, 196, .13); color: var(--teal); font-size: 12px; font-weight: 900; }
.topic-heading { display: flex; align-items: center; }
.topic-heading h3 { max-width: 265px; }
.topic-arrow { color: #a8dfff; font-size: 22px; line-height: .8; }
.topic-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.topic-meta strong { color: var(--teal); font-weight: 800; }
.mini-progress { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 9px; background: rgba(255, 255, 255, .09); }
.mini-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #75e0c5, #6ab0ff); }

.button-primary, .button-secondary, .button-danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 12px 15px; border-radius: 14px; font-size: 13px; font-weight: 850; }
.button-primary { background: linear-gradient(135deg, #76e1c5, #68aeff); color: #07213d; box-shadow: 0 10px 24px rgba(70, 174, 224, .22); }
.button-secondary { border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: #d8eafa; }
.button-danger { border: 1px solid rgba(255, 142, 155, .24); background: rgba(255, 142, 155, .08); color: #ffbac3; }
.button-primary[disabled], .button-secondary[disabled] { cursor: not-allowed; opacity: .45; }
.wide { width: 100%; }

.notice { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px; border: 1px solid rgba(113, 184, 237, .14); border-radius: 16px; background: rgba(78, 147, 207, .08); color: #c3d9eb; font-size: 11px; line-height: 1.45; }
.notice b { color: #dbf1ff; }
.notice-mark { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 7px; background: rgba(115, 224, 196, .16); color: var(--teal); font-size: 12px; font-weight: 900; }

.test-head { display: flex; justify-content: space-between; gap: 10px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 13px; padding: 0; background: transparent; color: #bde5ff; font-size: 12px; font-weight: 750; }
.counter { display: grid; place-items: center; min-width: 48px; height: 28px; border-radius: 10px; background: rgba(115, 224, 196, .13); color: var(--teal); font-size: 11px; font-weight: 850; }
.test-title { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.progress-row { display: flex; align-items: center; gap: 8px; margin: 17px 0 15px; }
.progress-track { flex: 1; height: 7px; overflow: hidden; border-radius: 10px; background: rgba(255, 255, 255, .1); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--blue)); transition: width .2s ease; }
.progress-row small { color: var(--muted); font-size: 10px; font-weight: 750; }
.question-card { padding: 19px; border: 1px solid var(--line); border-radius: 23px; background: var(--card); box-shadow: var(--shadow); }
.question-card .eyebrow { color: #91d4ff; }
.question-text { font-size: 18px; font-weight: 760; line-height: 1.25; letter-spacing: -.45px; }
.question-hint { margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.choice-list { display: grid; gap: 9px; margin-top: 18px; }
.choice { display: flex; align-items: flex-start; gap: 11px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, .035); color: #e8f1f9; text-align: left; transition: border-color .16s, background .16s, transform .16s; }
.choice:not([disabled]):active { transform: scale(.988); }
.choice.is-selected { border-color: rgba(120, 216, 226, .8); background: rgba(104, 191, 220, .12); }
.choice.is-correct { border-color: rgba(99, 226, 169, .78); background: rgba(85, 214, 157, .13); }
.choice.is-wrong { border-color: rgba(255, 142, 155, .82); background: rgba(255, 105, 127, .12); }
.choice-mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border: 1px solid rgba(207, 233, 255, .42); border-radius: 50%; color: transparent; font-size: 13px; font-weight: 900; }
.choice.multiple .choice-mark { border-radius: 7px; }
.choice.is-selected .choice-mark { border-color: var(--teal); background: var(--teal); color: #073049; }
.choice.is-correct .choice-mark { border-color: var(--green); background: var(--green); color: #073524; }
.choice.is-wrong .choice-mark { border-color: var(--coral); background: var(--coral); color: #531c25; }
.choice-text { padding-top: 1px; font-size: 13px; font-weight: 630; line-height: 1.35; }
.test-actions { display: grid; gap: 9px; margin-top: 16px; }
.feedback { margin-top: 16px; padding: 13px; border-radius: 16px; font-size: 12px; line-height: 1.45; }
.feedback.good { background: rgba(85, 214, 157, .11); color: #b7f2d5; }
.feedback.bad { background: rgba(255, 142, 155, .11); color: #ffd0d7; }
.feedback b { display: block; margin-bottom: 3px; color: #fff; font-size: 13px; }

.screen-card { padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); text-align: center; }
.screen-icon { display: grid; place-items: center; width: 55px; height: 55px; margin: 0 auto 14px; border-radius: 19px; background: rgba(115, 224, 196, .14); color: var(--teal); font-size: 26px; }
.screen-card p { margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.result-numbers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 18px 0; }
.result-numbers div { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.result-numbers strong, .result-numbers small { display: block; }
.result-numbers strong { color: var(--teal); font-size: 22px; }
.result-numbers small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.stack-actions { display: grid; gap: 9px; margin-top: 17px; }

.error-summary, .stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric { padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.metric strong, .metric small { display: block; }
.metric strong { font-size: 25px; letter-spacing: -1px; }
.metric small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.metric.good strong { color: var(--teal); }.metric.warn strong { color: var(--yellow); }.metric.bad strong { color: var(--coral); }
.error-list { display: grid; gap: 10px; margin-top: 14px; }
.error-topic { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.error-topic h3 { max-width: 230px; }.error-topic p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.small-button { flex: none; padding: 9px 10px; border-radius: 11px; background: rgba(115, 224, 196, .13); color: var(--teal); font-size: 11px; font-weight: 850; }
.settings { margin-top: 25px; padding-top: 17px; border-top: 1px solid var(--line); }
.settings p { margin: 5px 0 11px; color: var(--muted); font-size: 11px; line-height: 1.4; }

.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 50%; display: flex; justify-content: space-around; width: min(100%, 580px); padding: 9px 11px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(8, 22, 42, .92); backdrop-filter: blur(18px); transform: translateX(-50%); }
.nav-item { min-width: 66px; padding: 4px 7px; background: transparent; color: #8da2b9; }
.nav-item span, .nav-item small { display: block; }.nav-item span { font-size: 19px; line-height: 19px; }.nav-item small { margin-top: 2px; font-size: 9px; font-weight: 750; }
.nav-item.is-active { color: #d8efff; }.nav-item.is-active span { color: var(--teal); }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: flex; align-items: end; background: rgba(0, 9, 20, .7); opacity: 0; visibility: hidden; transition: .2s; }
.modal-backdrop.is-open { opacity: 1; visibility: visible; }
.modal { width: min(100%, 580px); padding: 17px 18px calc(24px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; background: #183555; transform: translateY(28px); transition: transform .2s; }
.modal-backdrop.is-open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }.modal-head h2 { font-size: 18px; }
.modal p { color: #d0e0ed; font-size: 12px; line-height: 1.5; }.modal p + p { margin-top: 9px; }
.modal b { color: #fff; }
.toast { position: fixed; z-index: 80; bottom: 86px; left: 50%; max-width: calc(100% - 32px); padding: 10px 13px; border-radius: 12px; background: #eef8ff; color: #112a42; font-size: 12px; font-weight: 800; opacity: 0; transform: translate(-50%, 16px); transition: .18s; pointer-events: none; text-align: center; }
.toast.is-showing { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 581px) { .app-shell { border-inline: 1px solid var(--line); box-shadow: 0 0 75px rgba(0, 0, 0, .21); }.bottom-nav { border-inline: 1px solid var(--line); } }
@media (max-width: 360px) { .app-shell { padding-inline: 12px; }.hero { padding: 20px; }h1 { font-size: 26px; }.question-text { font-size: 17px; }.choice { padding: 10px; } }
