:root {
    color-scheme: light;
    font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
    color: #142746;
    background: #f2f5fa;
    --blue: #194583;
    --deep: #17366f;
    --line: #d7e0ee;
    --muted: #516179;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
[hidden] { display: none !important; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid #a15b00; outline-offset: 3px; }
.shell { width: min(1360px, 100% - 64px); margin-inline: auto; }
.top { background: var(--deep); color: white; }
.top-inner, .brand, nav, .board-heading, .actions, .footer { display: flex; align-items: center; }
.top-inner { min-height: 84px; justify-content: space-between; gap: 16px; }
.brand { gap: 12px; text-decoration: none; color: white; font-size: 1.3rem; font-weight: 750; line-height: 1.1; }
.brand strong { color: #f0d88c; }
.brand small { display: block; color: #dce8fa; font-size: .78rem; margin-top: 5px; font-weight: 500; }
.brand-logo { display: block; width: 78px; height: auto; padding: 4px; border-radius: 6px; background: #f2f2f2; }
.certificate-logo { width: 100px; margin: 0 auto 15px; }
nav { gap: 6px; flex-wrap: wrap; }
nav a { color: #f1f6ff; text-decoration: none; border-radius: 8px; padding: 9px 12px; font-size: .9rem; }
nav a:hover, nav a[aria-current] { background: #2b518c; }
.intro { padding-block: 46px 30px; }
.eyebrow { color: #234b87; font-weight: 800; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 10px; }
h1, h2 { font-family: Georgia, serif; margin: 0; font-weight: 700; }
h1 { font-size: clamp(2.8rem, 6vw, 5.1rem); letter-spacing: -.055em; line-height: .99; }
h2 { font-size: 1.65rem; line-height: 1.1; }
h3 { margin: 20px 0 4px; font-size: 1rem; }
p { line-height: 1.55; }
.intro > p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 1.12rem; }
.workspace { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(350px, 1.6fr) minmax(245px, 1fr); gap: 18px; align-items: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: clamp(16px, 2vw, 25px); box-shadow: 0 6px 26px #17366f0d; }
.outline > p { margin: 10px 0 5px; color: var(--muted); font-size: .9rem; }
progress { width: 100%; height: 9px; accent-color: var(--blue); }
.outline ol { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 8px; }
.outline li { counter-increment: lesson; }
.outline button { position: relative; width: 100%; text-align: left; padding: 10px 9px 10px 42px; border-radius: 10px; border: 1px solid var(--line); background: white; color: inherit; font-weight: 700; }
.outline button::before { content: counter(lesson); position: absolute; left: 9px; top: 11px; width: 24px; height: 24px; display: grid; place-items: center; background: #eaf0fb; border-radius: 50%; font-size: .8rem; }
.outline button.done::before { content: "✓"; background: #cae9d6; }
.outline button[aria-current="step"] { background: #e8effb; border-color: #8ca7ce; }
.outline small { display: block; color: var(--muted); font-size: .8rem; font-weight: 500; margin-top: 3px; }
.course-award { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 18px; background: #e8effb; }
.course-award p { margin: 6px 0 0; color: var(--muted); }
.diploma-button { display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; }
.diploma-button span { font-size: 1.5rem; line-height: 1; color: #f0d88c; }
.diploma-button:disabled { background: #d7e0ee; color: #405575; border-color: #aabbd5; opacity: 1; }
.diploma-button:disabled span { color: inherit; }
.board-heading { justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.board-heading span { color: var(--muted); font-size: .875rem; }
.board { display: grid; grid-template: repeat(8, minmax(0, 1fr)) / repeat(8, minmax(0, 1fr)); border: 5px solid #17366f; border-radius: 9px; overflow: hidden; aspect-ratio: 1; background: #17366f; }
.square { position: relative; padding: 0; border: 0; display: grid; place-items: center; min-inline-size: 0; }
.square.light { background: #e8edf7; }
.square.light:disabled { opacity: 1; }
button.square.light:enabled:hover { background: #d3dff2; }
.square.dark { background: #345c98; color: #fff; }
.square.dark:hover { background: #3a609e; }
.square.dark.landing, .square[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #f3cf70; }
.square:focus-visible { z-index: 2; outline-color: #fff; outline-offset: -4px; }
.square.light:focus-visible { outline-color: var(--deep); }
.number { position: absolute; top: 3px; left: 5px; font-size: clamp(.62rem, 1vw, .78rem); }
.piece { width: 72%; aspect-ratio: 1; border-radius: 50%; display: none; place-items: center; box-shadow: 0 3px 3px #0007; font-size: clamp(.9rem, 2vw, 1.5rem); }
[data-piece^="w"] .piece { display: grid; background: #fffaf0; color: #374561; border: 3px double #9ba8bc; }
[data-piece^="b"] .piece { display: grid; background: #131c30; color: #f0d88c; border: 3px double #a0aec4; }
.board-actions { margin-top: 14px; }
.actions { gap: 8px; flex-wrap: wrap; }
.primary, .secondary { display: inline-block; text-decoration: none; font-weight: 700; font-size: .9rem; padding: 9px 13px; border-radius: 8px; border: 1px solid var(--line); }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.secondary { background: #fff; color: var(--blue); }
.primary:hover { background: var(--deep); }
.secondary:hover { background: #edf2fb; }
.lesson-panel p:not(.eyebrow) { margin-block: 8px 13px; }
.feedback { border-radius: 9px; padding: 11px; background: #edf2fb; color: #1c3d70; min-height: 48px; }
.feedback[data-tone="error"] { background: #fbeddf; color: #713514; }
.feedback[data-tone="success"] { background: #e0f2e6; color: #17533b; }
.footer { justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); padding-block: 24px; font-size: .875rem; }
.editor-layout { grid-template-columns: minmax(0, 560px) minmax(0, 1fr); max-width: 1100px; }
label { display: grid; gap: 5px; margin-bottom: 13px; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid #9aafcc; border-radius: 7px; color: inherit; background: white; padding: 8px; }
textarea { min-height: 54px; resize: vertical; }
.award { text-align: center; max-width: 530px; }
.award form { max-width: 300px; margin-inline: auto; }
.award-icon { font-size: 2rem; display: grid; place-items: center; width: 65px; height: 65px; border-radius: 50%; color: #704a10; background: #f5e2b6; margin: 0 auto 15px; }
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.certificate-page { padding: 22px; }
.print-actions { max-width: 960px; margin: 0 auto 16px; justify-content: space-between; }
.certificate { max-width: 960px; min-height: 520px; margin: auto; padding: 36px 24px; text-align: center; border: 10px double #17366f; background: #fbfcff; overflow-wrap: anywhere; }
.certificate h1 { margin-bottom: 24px; }
.certificate h2 { font-size: clamp(2rem, 5vw, 4rem); color: var(--blue); }
@page { size: A4 landscape; margin: 15mm; }
@media print {
    .print-actions { display: none; }
    .certificate-page { background: white; padding: 0; }
    .certificate { print-color-adjust: exact; }
}
@media (max-width: 1050px) {
    .workspace:not(.editor-layout) { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); }
    .outline { grid-column: 1 / -1; }
    .outline ol { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: 12px; }
}
@media (max-width: 660px) {
    .shell { width: calc(100% - 28px); }
    .top-inner { flex-wrap: wrap; padding-block: 12px; gap: 8px; }
    nav a { padding: 7px 8px; }
    .intro { padding-block: 28px 20px; }
    .workspace:not(.editor-layout), .editor-layout, .services { grid-template-columns: minmax(0, 1fr); }
    .outline button { font-size: .82rem; padding-inline: 8px; padding-top: 32px; height: 100%; }
    .outline button::before { top: 5px; }
    .outline small { font-size: .72rem; }
}

.is-exercise-preview > label,
.is-exercise-preview > #editor-guidance,
.is-exercise-preview > #editor-path,
.is-exercise-preview #record,
.is-exercise-preview button[type="submit"] { display: none; }

.quiz-index { gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #e8effb; }
.quiz-index a { color: var(--blue); background: #fff; border: 1px solid var(--line); font-weight: 650; }
.quiz-index a:hover { background: #dce8fa; }
.quiz-section { margin-block: 30px; }
.quiz-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 18px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-section-heading span { color: var(--muted); font-size: .875rem; }
.quiz-chapters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 284px), 1fr)); gap: 10px; align-items: start; }
.quiz-chapter { padding: 0; border-radius: 12px; scroll-margin-top: 12px; }
.quiz-chapter summary { display: grid; grid-template-columns: 34px minmax(0, 1fr) 12px; gap: 10px; align-items: center; min-height: 84px; padding: 12px; cursor: pointer; list-style: none; border-radius: inherit; }
.quiz-chapter summary::-webkit-details-marker { display: none; }
.quiz-chapter summary:hover, .quiz-chapter[open] summary { background: #f2f6fc; }
.quiz-chapter[open] summary { border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.quiz-chapter-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #e8effb; color: var(--blue); font-size: .875rem; font-weight: 800; }
.quiz-chapter-title { font-weight: 700; font-size: .95rem; line-height: 1.25; }
.quiz-chapter-title small { display: block; color: var(--muted); font-size: .8rem; font-weight: 500; margin-top: 4px; }
.quiz-chevron { width: 8px; height: 8px; border: solid var(--blue); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.quiz-chapter[open] .quiz-chevron { transform: rotate(225deg); }
.quiz-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 12px; margin: 0; }
.quiz-links a { display: grid; place-items: center; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #f2f6fc; font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.quiz-links a:hover { background: #dce8fa; }
.quiz-answer summary { font-weight: 700; cursor: pointer; }
