:root {
  color-scheme: light;
  --ink: #10213d;
  --ink-soft: #2f4261;
  --muted: #6f7c90;
  --line: #dce2ea;
  --surface: rgba(255, 255, 255, .9);
  --soft: #eef2f6;
  --page: #f5f7fa;
  --accent: #54c5aa;
  --accent-dark: #15977b;
  --success: #148767;
  --danger: #c64b58;
  --warning: #e0a22c;
  --shadow: 0 24px 70px rgba(23, 42, 70, .11);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { overflow-x: clip; background: var(--page); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: clip;
  background:
    radial-gradient(circle at 80% 0, rgba(84, 197, 170, .09), transparent 30rem),
    linear-gradient(180deg, #f8fafc, var(--page));
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(84, 197, 170, .35);
  outline-offset: 3px;
}

[hidden] { display: none !important; }
.app-background { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.app-background span { position: absolute; border: 1px solid rgba(16, 33, 61, .035); transform: rotate(45deg); }
.app-background span:nth-child(1) { width: 380px; height: 380px; top: 8%; right: -220px; }
.app-background span:nth-child(2) { width: 190px; height: 190px; top: 35%; left: -110px; }
.app-background span:nth-child(3) { width: 520px; height: 520px; bottom: -390px; left: 35%; }
.app-shell { width: min(1180px, 100%); margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
.screen { min-height: calc(100vh - 48px); }

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 18px;
  background: #f7f9fb;
  color: var(--muted);
  text-align: center;
  transition: opacity .35s ease, visibility .35s ease;
}
.loading-screen.ready { opacity: 0; visibility: hidden; }
.loading-screen p { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.loading-mark { display: grid; grid-template-columns: repeat(2, 24px); gap: 6px; margin: auto; transform: rotate(45deg); }
.loading-mark i { width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 6px; animation: pulse 1.2s infinite alternate; }
.loading-mark i:nth-child(2) { animation-delay: .15s; }
.loading-mark i:nth-child(3) { animation-delay: .3s; }
.loading-mark i:nth-child(4) { border-color: var(--accent); background: var(--accent); animation-delay: .45s; }

.topbar, .test-topbar, .results-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: .9; }
.brand strong { font-size: 14px; font-weight: 850; letter-spacing: .12em; }
.brand small { margin-top: 6px; color: var(--accent-dark); font-size: 8px; font-weight: 850; letter-spacing: .28em; }
.brand-grid { display: grid; grid-template-columns: repeat(2, 10px); gap: 3px; width: 32px; height: 32px; padding: 4px; border: 1px solid rgba(16,33,61,.18); border-radius: 9px; transform: rotate(45deg); }
.brand-grid i { border: 1.5px solid var(--ink); border-radius: 2px; }
.brand-grid i:last-child { border-color: var(--accent-dark); background: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.connection-badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.7); color: var(--muted); font-size: 10px; font-weight: 750; }
.connection-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-dark); box-shadow: 0 0 0 4px rgba(84,197,170,.12); }
.connection-badge.offline { color: var(--accent-dark); }
.connection-badge.offline i { background: var(--warning); box-shadow: 0 0 0 4px rgba(224,162,44,.12); }
.icon-button, .quiet-button {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.72);
  cursor: pointer;
}
.icon-button { font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.quiet-button { padding: 0 13px; color: var(--muted); font-size: 12px; font-weight: 750; }

.hero { position: relative; display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: 50px; min-height: 500px; padding: 70px 30px 65px; }
.eyebrow { margin: 0 0 12px; color: var(--accent-dark); font-size: 10px; font-weight: 850; letter-spacing: .19em; }
h1, h2, h3, p { text-wrap: pretty; }
h1 { margin: 0; font-size: clamp(48px, 6.7vw, 82px); line-height: .96; letter-spacing: -.058em; }
h1 span { color: var(--accent-dark); }
h2 { margin: 0; font-size: clamp(29px, 4vw, 42px); line-height: 1.02; letter-spacing: -.045em; }
.hero-copy > p:not(.eyebrow) { max-width: 620px; margin: 27px 0 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.65; }
.hero-actions { display: flex; align-items: center; gap: 18px; margin-top: 34px; }
.primary-button, .secondary-button, .text-button, .submit-answer, .primary-small, .danger-button {
  border: 0;
  cursor: pointer;
}
.primary-button {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 250px;
  padding: 16px 20px;
  border-radius: 15px;
  background: var(--ink);
  color: #fff;
  font-weight: 780;
  text-align: left;
  box-shadow: 0 13px 28px rgba(16,33,61,.18);
}
.primary-button span { margin-top: 5px; color: #aeb9ca; font-size: 10px; font-weight: 550; }
.primary-button:hover { background: #1a3155; transform: translateY(-1px); }
.primary-button.compact { display: inline-flex; align-items: center; min-width: 0; padding: 14px 20px; text-align: center; }
.text-button { padding: 10px 2px; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.text-button:hover { color: var(--accent-dark); }
.hero-visual { position: relative; display: grid; place-items: center; min-height: 360px; }
.hero-visual::before { content: ""; position: absolute; width: 330px; height: 330px; border: 1px solid rgba(16,33,61,.06); border-radius: 50%; box-shadow: 0 0 0 55px rgba(16,33,61,.018); }
.mini-matrix { position: relative; display: grid; grid-template-columns: repeat(3, 78px); gap: 8px; padding: 18px; border: 1px solid rgba(16,33,61,.12); border-radius: 24px; background: rgba(255,255,255,.76); box-shadow: var(--shadow); backdrop-filter: blur(15px); transform: rotate(-2deg); }
.mini-matrix i { display: grid; place-items: center; width: 78px; height: 78px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.mini-matrix i::after { content: ""; display: block; width: 29px; height: 29px; border: 4px solid var(--ink); }
.mini-matrix .circle::after { border-radius: 50%; }
.mini-matrix .triangle::after { width: 0; height: 0; border: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 34px solid var(--ink); }
.mini-matrix .square::after { border-radius: 4px; }
.mini-matrix .question { border: 2px dashed rgba(21,151,123,.4); background: rgba(84,197,170,.08); color: var(--accent-dark); font-style: normal; font-size: 34px; font-weight: 350; }
.mini-matrix .question::after { display: none; }
.level-pill { position: absolute; right: -5px; bottom: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 106px; height: 106px; border: 8px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 14px 34px rgba(21,151,123,.23); }
.level-pill span { font-size: 36px; font-weight: 820; letter-spacing: -.06em; }
.level-pill small { margin-top: 2px; font-size: 8px; font-weight: 800; letter-spacing: .08em; }

.progress-strip { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.75); box-shadow: 0 12px 38px rgba(29,48,76,.05); }
.progress-strip article { padding: 21px 24px; border-right: 1px solid var(--line); }
.progress-strip article:last-child { border-right: 0; }
.progress-strip span, .result-metrics span { display: block; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.progress-strip strong { display: block; margin-top: 11px; font-size: 27px; letter-spacing: -.04em; }
.progress-strip small { display: block; margin-top: 3px; color: #9aa4b3; font-size: 10px; }

.mode-section, .history-section, .review-section { padding-top: 92px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 3px 24px; }
.section-heading .eyebrow { margin-bottom: 8px; }
.section-heading > span { padding-bottom: 5px; color: var(--muted); font-size: 11px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 290px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.8);
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.mode-card:hover { transform: translateY(-3px); border-color: rgba(21,151,123,.35); box-shadow: var(--shadow); }
.mode-card.featured { background: var(--ink); color: #fff; border-color: var(--ink); }
.mode-number { justify-self: end; color: #aab4c2; font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.mode-card.featured .mode-number { color: #6e809c; }
.mode-card > div { align-self: end; }
.mode-kicker { color: var(--accent-dark); font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.featured .mode-kicker { color: var(--accent); }
.mode-card h3 { margin: 10px 0 12px; font-size: 25px; letter-spacing: -.035em; }
.mode-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.featured p { color: #aeb9ca; }
.mode-card > i { margin-top: 22px; font-style: normal; font-size: 22px; }

.facts-section { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 92px; }
.fact-card { min-height: 430px; padding: 36px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.78); }
.fact-card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.fact-card.dark .eyebrow { color: var(--accent); }
.fact-card h2 { max-width: 440px; }
.fact-card ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 54px 0 0; padding: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; list-style: none; background: rgba(255,255,255,.08); }
.fact-card ul li { display: flex; flex-direction: column; gap: 7px; padding: 22px; background: var(--ink); }
.fact-card ul li strong { font-size: 16px; }
.fact-card ul li span { color: #8e9db2; font-size: 11px; }
.fact-card ol { display: grid; gap: 24px; margin: 47px 0 0; padding: 0; list-style: none; }
.fact-card ol li { display: flex; align-items: center; gap: 17px; }
.fact-card ol li > span { display: grid; flex: 0 0 auto; place-items: center; width: 39px; height: 39px; border: 1px solid rgba(21,151,123,.25); border-radius: 12px; background: rgba(84,197,170,.1); color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.fact-card ol strong, .fact-card ol small { display: block; }
.fact-card ol strong { font-size: 15px; }
.fact-card ol small { margin-top: 5px; color: var(--muted); line-height: 1.4; }

.install-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 23px; margin-top: 92px; padding: 28px 31px; border: 1px solid rgba(21,151,123,.2); border-radius: var(--radius); background: linear-gradient(135deg, rgba(84,197,170,.13), rgba(255,255,255,.72)); }
.install-icon { display: grid; place-items: center; width: 57px; height: 57px; border-radius: 17px; background: var(--accent); font-size: 25px; font-weight: 750; }
.install-card .eyebrow { margin-bottom: 6px; }
.install-card h2 { font-size: 27px; }
.install-card p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.secondary-button { padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.75); font-size: 12px; font-weight: 750; }
.secondary-button.full { width: 100%; }
.history-list { display: grid; gap: 8px; }
.history-item { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 25px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.78); }
.history-item strong, .history-item span, .history-item small { display: block; }
.history-item strong { font-size: 14px; }
.history-item small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.history-item > span { color: var(--muted); font-size: 12px; }
.history-score { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(84,197,170,.12); color: var(--accent-dark); font-size: 19px; font-weight: 820; }
footer { display: flex; justify-content: space-between; gap: 30px; padding: 52px 4px 8px; color: #8b96a7; font-size: 9px; line-height: 1.5; }
footer p { margin: 0; }

.test-screen { width: min(1050px, 100%); margin: 0 auto; }
.test-topbar { position: sticky; top: 0; z-index: 10; padding: 7px 0 16px; background: linear-gradient(var(--page) 75%, transparent); }
.test-progress { text-align: center; }
.test-progress span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.test-progress strong { display: block; margin-top: 4px; font-size: 13px; }
.timer { position: relative; min-width: 90px; overflow: hidden; padding: 10px 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center; }
.timer span { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 780; }
.timer i { position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: var(--accent); transform-origin: left; }
.timer.warning { border-color: rgba(198,75,88,.3); color: var(--danger); }
.timer.warning i { background: var(--danger); }
.test-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); gap: 16px; align-items: start; padding-top: 22px; }
.question-panel, .answer-panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.88); box-shadow: 0 15px 50px rgba(23,42,70,.055); }
.question-panel { padding: 27px; }
.answer-panel { padding: 23px; }
.question-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.question-heading h1 { margin-top: 8px; font-size: clamp(28px, 3.3vw, 39px); }
.difficulty-label, .category-label { display: inline-flex; padding: 6px 9px; border-radius: 999px; background: rgba(84,197,170,.11); color: var(--accent-dark); font-size: 9px; font-weight: 800; }
.category-label { margin-top: 2px; background: var(--soft); color: var(--muted); }
.matrix-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; width: min(100%, 520px); margin: 30px auto 0; padding: 8px; border: 1px solid #cfd7e2; border-radius: 17px; background: #e9edf3; }
.matrix-cell { aspect-ratio: 1; overflow: hidden; border: 1px solid #dce2ea; border-radius: 11px; background: #fff; }
.matrix-cell.missing { display: grid; place-items: center; border: 2px dashed rgba(21,151,123,.34); background: rgba(84,197,170,.07); color: var(--accent-dark); }
.matrix-cell.missing span { font-size: clamp(28px, 5vw, 48px); font-weight: 300; }
.figure { display: block; width: 100%; height: 100%; }
.question-help { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }
.answer-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.answer-heading span { font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.answer-heading small { color: var(--muted); font-size: 9px; }
.answer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.answer-choice { position: relative; aspect-ratio: 1.35; overflow: hidden; padding: 5px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.answer-choice:hover { transform: translateY(-1px); border-color: #b8c3d1; }
.answer-choice.selected { border-color: var(--accent-dark); background: rgba(84,197,170,.08); box-shadow: inset 0 0 0 1px var(--accent-dark); }
.answer-choice.correct { border-color: var(--success); background: rgba(20,135,103,.08); box-shadow: inset 0 0 0 1px var(--success); }
.answer-choice.wrong { border-color: var(--danger); background: rgba(198,75,88,.06); }
.answer-choice:disabled { cursor: default; transform: none; }
.choice-letter { position: absolute; top: 7px; left: 8px; z-index: 2; display: grid; place-items: center; width: 21px; height: 21px; border-radius: 7px; background: var(--soft); color: var(--muted); font-size: 9px; font-weight: 850; }
.selected .choice-letter { background: var(--accent); color: var(--ink); }
.correct .choice-letter { background: var(--success); color: #fff; }
.wrong .choice-letter { background: var(--danger); color: #fff; }
.submit-answer { width: 100%; margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 780; }
.submit-answer:disabled { background: #d8dee7; color: #8b97a8; cursor: not-allowed; }
.feedback-panel { margin-top: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.feedback-result { display: flex; align-items: center; gap: 11px; }
.feedback-result > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--success); color: #fff; font-weight: 900; }
.feedback-panel.incorrect .feedback-result > span { background: var(--danger); }
.feedback-result strong, .feedback-result small { display: block; }
.feedback-result strong { font-size: 14px; }
.feedback-result small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.feedback-panel details { margin-top: 13px; padding-top: 12px; border-top: 1px solid #d6dde6; }
.feedback-panel summary { color: var(--ink-soft); font-size: 11px; font-weight: 800; cursor: pointer; }
.feedback-panel details p { margin: 11px 0 7px; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.feedback-panel details span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.primary-small { width: 100%; margin-top: 13px; padding: 12px; border-radius: 11px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 750; }

.results-screen { width: min(1060px, 100%); margin: 0 auto; }
.results-topbar { color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .18em; }
.results-hero { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 45px; min-height: 390px; padding: 55px 35px; }
.score-orbit { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 190px; height: 190px; border: 1px solid rgba(21,151,123,.25); border-radius: 50%; background: rgba(84,197,170,.09); box-shadow: 0 0 0 32px rgba(84,197,170,.035); }
.score-orbit strong { font-size: 73px; line-height: .9; letter-spacing: -.08em; }
.score-orbit span { margin-top: 8px; color: var(--muted); font-size: 11px; font-weight: 750; }
.results-hero h1 { max-width: 680px; font-size: clamp(43px, 6vw, 70px); }
.results-hero > div:last-child > p:last-child { margin: 20px 0 0; color: var(--muted); font-size: 14px; }
.result-metrics { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.8); }
.result-metrics article { padding: 24px; border-right: 1px solid var(--line); }
.result-metrics article:last-child { border-right: 0; }
.result-metrics strong { display: block; margin-top: 10px; font-size: 28px; letter-spacing: -.04em; }
.difficulty-path-card { display: grid; grid-template-columns: minmax(220px, .4fr) 1fr; gap: 30px; margin-top: 14px; padding: 27px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.8); }
.difficulty-path-card h2 { font-size: 24px; }
.difficulty-path { display: flex; align-items: flex-end; gap: 4px; height: 105px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.difficulty-path i { flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; background: var(--accent); opacity: .65; }
.difficulty-path i.correct { opacity: 1; background: var(--success); }
.difficulty-path i.incorrect { background: var(--danger); opacity: .7; }
.review-list { display: grid; gap: 9px; }
.review-item { border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.82); }
.review-item summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px 18px; list-style: none; cursor: pointer; }
.review-item summary::-webkit-details-marker { display: none; }
.review-status { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: rgba(20,135,103,.11); color: var(--success); font-size: 12px; font-weight: 900; }
.review-item.incorrect .review-status { background: rgba(198,75,88,.1); color: var(--danger); }
.review-item summary strong, .review-item summary small { display: block; }
.review-item summary strong { font-size: 13px; }
.review-item summary small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.review-item summary > span:last-child { color: var(--muted); font-size: 11px; }
.review-content { padding: 0 18px 18px 63px; border-top: 1px solid var(--line); }
.review-figures { display: grid; grid-template-columns: repeat(2, minmax(100px, 155px)); gap: 10px; margin-top: 16px; }
.review-figure { padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.review-figure span { color: var(--muted); font-size: 8px; font-weight: 800; }
.review-figure .figure { aspect-ratio: 1.25; }
.review-content p { margin: 16px 0 8px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.review-content > span { color: var(--muted); font-size: 10px; line-height: 1.55; }
.results-actions { display: flex; justify-content: center; gap: 10px; padding: 42px 0 15px; }

dialog {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100vh - 30px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(11,28,51,.28);
}
dialog::backdrop { background: rgba(10,23,43,.42); backdrop-filter: blur(5px); }
dialog form { position: relative; padding: 31px; }
.dialog-close { position: absolute; top: 17px; right: 17px; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); color: var(--muted); font-size: 22px; cursor: pointer; }
dialog h2 { padding-right: 36px; }
.dialog-copy, .settings-dialog form > p:not(.eyebrow) { margin: 15px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.setup-fields { display: grid; gap: 15px; margin: 25px 0 16px; }
.setup-fields label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.setup-fields select { width: 100%; min-height: 47px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: var(--ink); font-size: 16px; }
.checkbox-field { grid-template-columns: auto 1fr !important; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.checkbox-field input { width: 21px; height: 21px; accent-color: var(--accent-dark); }
.checkbox-field strong, .checkbox-field small { display: block; }
.checkbox-field small { margin-top: 4px; color: var(--muted); font-weight: 500; }
.dialog-note { margin-bottom: 18px; padding: 12px; border-radius: 12px; background: rgba(84,197,170,.1); color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.settings-dialog .danger-button { width: 100%; margin: 23px 0 10px; padding: 13px; border-radius: 12px; background: rgba(198,75,88,.09); color: var(--danger); font-size: 12px; font-weight: 780; }
.install-steps { display: grid; gap: 15px; margin: 25px 0; padding: 0; list-style: none; }
.install-steps li { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 13px; }
.install-steps li > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: rgba(84,197,170,.12); color: var(--accent-dark); font-size: 11px; font-weight: 850; }
.install-steps p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }

@keyframes pulse { to { opacity: .35; transform: scale(.92); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr .7fr; gap: 20px; padding-left: 10px; padding-right: 10px; }
  .mini-matrix { grid-template-columns: repeat(3, 61px); }
  .mini-matrix i { width: 61px; height: 61px; }
  .level-pill { right: -17px; }
  .test-layout { grid-template-columns: 1fr; }
  .answer-grid { grid-template-columns: repeat(3, 1fr); }
  .answer-choice { aspect-ratio: 1.15; }
}

@media (max-width: 700px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .hero { display: block; min-height: 550px; padding: 75px 3px 40px; }
  .hero-copy { position: relative; z-index: 2; }
  h1 { font-size: 51px; }
  .hero-copy > p:not(.eyebrow) { max-width: 440px; padding-right: 24px; font-size: 15px; }
  .hero-actions { align-items: stretch; flex-direction: column; gap: 7px; }
  .primary-button { width: 100%; min-width: 0; }
  .text-button { text-align: left; }
  .hero-visual { position: absolute; top: 90px; right: -84px; z-index: 0; min-height: 260px; opacity: .13; transform: scale(.9); }
  .level-pill { display: none; }
  .progress-strip { grid-template-columns: repeat(2, 1fr); }
  .progress-strip article:nth-child(2) { border-right: 0; }
  .progress-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .mode-section, .facts-section, .history-section, .review-section { padding-top: 62px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .section-heading > span { padding: 0; }
  .mode-grid, .facts-section { grid-template-columns: 1fr; }
  .mode-card { min-height: 230px; }
  .fact-card { min-height: 0; padding: 27px; }
  .fact-card ul { margin-top: 37px; }
  .install-card { grid-template-columns: auto 1fr; padding: 22px; }
  .install-card .secondary-button { grid-column: 1 / -1; width: 100%; }
  footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  body.test-active {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  body.test-active.explanation-open {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }
  body.test-active .app-shell {
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding:
      max(5px, env(safe-area-inset-top))
      8px
      max(5px, env(safe-area-inset-bottom));
    overflow: hidden;
  }
  body.test-active.explanation-open .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  body.test-active .test-screen {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
  }
  body.test-active .test-topbar {
    position: static;
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 0 5px;
    background: transparent;
  }
  body.test-active .test-layout {
    display: grid;
    flex: 1 1 auto;
    grid-template-rows: auto auto;
    align-content: start;
    align-items: stretch;
    gap: 6px;
    min-height: 0;
    padding-top: 0;
  }
  body.test-active .question-panel,
  body.test-active .answer-panel {
    min-width: 0;
    padding: 8px;
    border-radius: 15px;
  }
  body.test-active .question-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  body.test-active .question-heading {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    gap: 7px;
  }
  body.test-active .question-heading > div {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }
  body.test-active .question-heading h1 {
    overflow: hidden;
    margin: 0;
    font-size: 18px;
    line-height: 1;
    letter-spacing: -.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.test-active .difficulty-label,
  body.test-active .category-label {
    flex: 0 0 auto;
    margin: 0;
    padding: 5px 7px;
    font-size: 7px;
  }
  body.test-active .matrix-grid {
    width: max(178px, min(70vw, calc(100vh - 390px), 294px));
    width: max(178px, min(70vw, calc(100dvh - 390px), 294px));
    max-width: 100%;
    min-height: 0;
    margin: 6px auto 0;
    gap: 4px;
    padding: 5px;
    border-radius: 13px;
  }
  body.test-active.feedback-active:not(.explanation-open) .matrix-grid {
    width: max(150px, min(58vw, calc(100vh - 445px), 240px));
    width: max(150px, min(58vw, calc(100dvh - 445px), 240px));
  }
  body.test-active .matrix-cell { border-radius: 7px; }
  body.test-active .question-help { display: none; }
  body.test-active .answer-panel { flex: 0 0 auto; }
  body.test-active .answer-heading {
    align-items: center;
    margin-bottom: 5px;
  }
  body.test-active .answer-heading span { font-size: 8px; }
  body.test-active .answer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  body.test-active .answer-choice {
    aspect-ratio: 1.5;
    min-height: 0;
    border-radius: 9px;
  }
  body.test-active .submit-answer {
    min-height: 40px;
    margin-top: 6px;
    padding: 9px;
  }
  body.test-active .feedback-panel {
    margin-top: 6px;
    padding: 9px;
    border-radius: 10px;
  }
  body.test-active .feedback-result > span {
    width: 29px;
    height: 29px;
  }
  body.test-active .feedback-result strong { font-size: 12px; }
  body.test-active .feedback-result small { font-size: 9px; }
  body.test-active .feedback-panel details {
    margin-top: 7px;
    padding-top: 7px;
  }
  body.test-active .primary-small {
    min-height: 37px;
    margin-top: 7px;
    padding: 8px;
  }
  .answer-heading small { display: none; }
  .results-hero { grid-template-columns: 1fr; gap: 30px; min-height: 0; padding: 55px 8px 45px; text-align: center; }
  .score-orbit { width: 145px; height: 145px; margin: auto; box-shadow: 0 0 0 20px rgba(84,197,170,.035); }
  .score-orbit strong { font-size: 57px; }
  .results-hero h1 { font-size: 45px; }
  .result-metrics { grid-template-columns: repeat(2, 1fr); }
  .result-metrics article:nth-child(2) { border-right: 0; }
  .result-metrics article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .difficulty-path-card { grid-template-columns: 1fr; }
  .review-content { padding-left: 18px; }
  .results-actions { flex-direction: column; }
}

@media (max-width: 430px) {
  input, select, textarea { font-size: 16px !important; }
  .connection-badge span { display: none; }
  .connection-badge { width: 34px; height: 34px; justify-content: center; padding: 0; }
  .topbar-actions { gap: 6px; }
  .hero { min-height: 570px; }
  h1 { font-size: 47px; }
  .progress-strip article { padding: 17px; }
  .progress-strip strong { font-size: 24px; }
  .fact-card ul { grid-template-columns: 1fr; }
  .test-topbar { padding-top: 2px; }
  .quiet-button { min-width: 0; padding: 0 9px; }
  .timer { min-width: 72px; padding-left: 7px; padding-right: 7px; }
  .test-layout { padding-top: 8px; }
  .matrix-cell { border-radius: 8px; }
  .answer-grid { grid-template-columns: repeat(3, 1fr); }
  .choice-letter { top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 5px; font-size: 8px; }
  .history-item { grid-template-columns: 1fr auto; gap: 12px; }
  .history-item > span { display: none; }
  dialog form { padding: 27px 21px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
