:root {
  color-scheme: light;
  --bg: #f6f5ef;
  --paper: #fffef9;
  --ink: #17342b;
  --muted: #53655c;
  --primary: #165746;
  --primary-dark: #103e34;
  --line: #dcded3;
  --gold: #eab963;
  --mint: #e3efe4;
  --rust: #963d2b;
  --radius: 21px;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #428e78; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { line-height: 1.3; font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: 1.35rem; line-height: 1.45; }
h3 { font-size: 1.08rem; line-height: 1.4; overflow-wrap: anywhere; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .88rem; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner, .shell { max-width: 1170px; padding-inline: clamp(18px, 4vw, 48px); margin: auto; }
.topbar-inner { min-height: 73px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand, .account-controls { display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 750; line-height: 1.35; }
.brand-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: #f7e6b9;
  background: var(--primary); flex: 0 0 auto; font: 700 25px/1 Tahoma, Arial, sans-serif; padding-bottom: 4px; }
.identity { display: flex; flex-direction: column; text-align: start; line-height: 1.4; font-weight: 700; }
.identity bdi { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small { font-size: .74rem; font-weight: 500; color: var(--muted); }
.shell { padding-block: 24px 56px; }
.loading, .empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.paper { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 10px 19px; border: 1px solid transparent;
  border-radius: 12px; font-weight: 700; font-size: .94rem; min-height: 46px; text-align: center; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--primary-dark); }
.button.outline { background: var(--paper); border-color: #bdcfc3; color: var(--primary-dark); }
.button.outline:hover:not(:disabled) { background: var(--mint); }
.button.small { min-height: 35px; padding: 5px 13px; font-size: .87rem; }
.button.wide { width: 100%; }
.welcome { display: grid; grid-template-columns: 1.12fr 1fr; gap: 24px; margin-block: clamp(22px, 6vh, 70px); align-items: stretch; }
.welcome-art, .library-hero { position: relative; isolation: isolate; overflow: hidden; background: var(--primary-dark);
  color: #fffdf2; border-radius: 28px; }
.welcome-art { min-height: 410px; display: grid; align-items: end; padding: clamp(26px, 5vw, 58px); }
.welcome-copy { position: relative; z-index: 1; }
.welcome-copy h1 { max-width: 10ch; }
.welcome-copy p:last-child, .library-hero p:last-child { color: #d7e6d9; margin-block-start: 12px; }
.eyebrow { color: #ecca87; font-size: .95rem; font-weight: 700; margin-block-end: 6px; }
.hero-symbol { position: absolute; z-index: -1; inset-inline-end: 5%; inset-block-start: -52%;
  transform: rotate(-14deg); font: 700 clamp(250px, 35vw, 450px)/1.15 Tahoma, Arial, sans-serif; color: #2b6958; user-select: none; }
.welcome-art .hero-symbol { inset-block-start: -24%; inset-inline-end: -7%; }
.welcome-art::after, .library-hero::after { content: ''; position: absolute; z-index: -1; width: 265px; height: 265px;
  inset-inline-end: 14%; inset-block-end: -162px; border: 1px solid #71a39166; border-radius: 50%;
  box-shadow: 0 0 0 25px #71a39122, 0 0 0 50px #71a39115; }
.auth-form, .form-panel { padding: clamp(20px, 3.4vw, 34px); }
.auth-form > .muted { margin-block: 3px 18px; }
.auth-form > button { margin-block-start: 8px; }
form label:not(.answer-option, .correct-radio, .publish-control) { display: grid; gap: 5px; margin-block: 0 13px; font-weight: 650; }
.credential-field { margin-bottom: 13px; }
.credential-field label[for] { margin-bottom: 5px; }
.password-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.password-control .button { min-width: 65px; padding-inline: 9px; }
input:not([type='radio'], [type='checkbox']), textarea, select { width: 100%; min-width: 0; color: var(--ink); background: #fff;
  border: 1px solid #cfd7cf; border-radius: 10px; min-height: 45px; padding: 9px 12px; }
textarea { resize: vertical; }
input[type='radio'], input[type='checkbox'] { accent-color: var(--primary); inline-size: 18px; block-size: 18px; margin: 0; }
.form-error, .success { border-radius: 10px; padding: 10px 14px; margin-block: 13px; font-size: .92rem; overflow-wrap: anywhere; }
.form-error { background: #f9e9e1; color: #8e3525; }
.success { background: var(--mint); color: var(--primary-dark); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.tab { border: 1px solid transparent; color: var(--muted); background: transparent; border-radius: 11px;
  font-weight: 650; min-height: 42px; padding: 7px 15px; }
.tab:hover, .tab[aria-current] { background: #e9eee4; color: var(--primary-dark); }
.tab[aria-current] { border-color: #d1decf; }
.library-hero { min-height: 208px; padding: 29px clamp(23px, 5vw, 51px); display: grid; align-items: center; margin-bottom: 23px; }
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr)); gap: 17px; }
.grade-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-block: 0 18px; }
.grade-bar label { font-weight: 700; }
.grade-bar select { width: auto; min-width: min(205px, 100%); }
.quiz-card { overflow: hidden; display: flex; flex-direction: column; }
.quiz-cover { position: relative; isolation: isolate; min-height: 107px; padding: 14px; overflow: hidden; }
.cover-0 { background: #dce9dc; color: #346651; }
.cover-1 { background: #f3dfb7; color: #87552e; }
.cover-2 { background: #ecd9d4; color: #9d513e; }
.cover-letter { position: absolute; z-index: -1; inset-inline-end: 22px; inset-block-start: -52px;
  transform: rotate(-13deg); font: 700 132px/1.2 Tahoma, Arial, sans-serif; opacity: .72; user-select: none; }
.quiz-card-body { padding: 19px 20px 21px; display: flex; flex: 1; flex-direction: column; align-items: start; gap: 7px; }
.quiz-card-body h2, .quiz-card-body p { overflow-wrap: anywhere; }
.quiz-card-body .muted { margin-block-end: auto; }
.quiz-meta { font-size: .87rem; color: var(--muted); font-weight: 650; }
.quiz-card-body .quiz-meta { margin-block-start: 6px; }
.quiz-card-body button { margin-block-start: 7px; }
.state, .score-chip { display: inline-flex; align-items: center; justify-content: center; border-radius: 100px;
  font-size: .79rem; padding: 4px 11px; font-weight: 720; background: #ebefe6; color: #2f5144; white-space: nowrap; }
.state.draft { background: #f9edd4; color: #714b1a; }
.state.published { background: #e2f0e4; color: #1b6545; }
.section-title { margin: 8px 0 18px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-block: 5px 19px; }
.section-head h1 { font-size: clamp(1.65rem, 4vw, 2.45rem); overflow-wrap: anywhere; }
.section-head .muted { margin-top: 5px; }
.list { overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 17px 20px; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row > div:first-child { flex: 1; }
.list-row .muted { font-size: .87rem; margin-top: 4px; }
.back { padding: 2px 0; background: transparent; border: 0; font-weight: 650; font-size: .92rem; color: var(--primary); }
.back::before { content: '→'; margin-inline-end: 6px; }
.back:hover { text-decoration: underline; }
.editor-grid, .play-grid { display: grid; grid-template-columns: minmax(280px, .76fr) minmax(0, 1.24fr); align-items: start; gap: 17px; }
.editor-grid.single { grid-template-columns: minmax(0, 600px); }
.form-panel h2 { margin-bottom: 16px; }
.form-panel > .button { margin-block-start: 10px; }
.publish-control, .correct-radio { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.questions-panel { padding: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 11px; }
.question-list { max-height: 560px; overflow-y: auto; }
.question-link { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center;
  gap: 9px; text-align: start; color: var(--ink); padding: 10px 6px; background: transparent; border: 0; border-top: 1px solid var(--line); }
.question-link:hover { background: #f2f6ed; }
.question-link:focus-visible { outline-offset: -3px; }
.row-number { display: inline-grid; place-items: center; width: 32px; height: 29px; border-radius: 8px; color: var(--primary-dark);
  background: #eaf0e7; font-size: .86rem; font-weight: 700; }
.question-link .points { color: var(--muted); font-size: .82rem; }
.question-form { max-width: 740px; }
.option-editor { border: 0; padding: 0; margin: 4px 0 12px; min-width: 0; }
.option-editor legend { font-weight: 700; }
.option-editor-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; margin-block: 9px; }
.remove-option { inline-size: 35px; block-size: 35px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--rust); background: transparent; font-size: 1.2rem; }
.points-field { max-width: 120px; }
.account-list .list-row { padding-inline: 3px; }
.play-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.play-top .back { min-height: 44px; }
.play-title { color: var(--muted); font-weight: 650; overflow-wrap: anywhere; }
.play-grid { grid-template-columns: minmax(0, 1fr) minmax(200px, 245px); }
.play-card { padding: clamp(18px, 3vw, 33px); }
.play-card .quiz-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.play-card fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.play-card legend { font-size: clamp(1.5rem, 3.6vw, 2.2rem); font-weight: 700; padding: 0; margin-bottom: 10px;
  line-height: 1.65; overflow-wrap: anywhere; }
.play-card legend:focus { outline: none; }
.answer-instruction { color: var(--muted); margin-block-end: 12px; font-weight: 600; }
.answer-options { display: grid; gap: 9px; }
.answer-option { display: flex; align-items: center; gap: 11px; padding: 10px 13px; min-height: 68px; cursor: pointer;
  border: 2px solid #e5ddf0; border-radius: 17px; background: #fff; overflow-wrap: anywhere;
  font: 400 clamp(1.18rem, 2.5vw, 1.55rem)/1.6 Tahoma, Arial, sans-serif; }
.answer-option:has(input:enabled):hover,
.answer-option:has(input:enabled:checked) { border-color: #8571bb; background: #f5f0fc; }
.answer-option:has(input:disabled) { cursor: default; }
.answer-option.right { border-color: #83b596; background: #e6f4ea; color: #1b5336; }
.answer-option.wrong { border-color: #dabb80; background: #fff7e6; color: #69471e; }
.answer-option input { flex: 0 0 auto; inline-size: 21px; block-size: 21px; }
.choice-letter { flex: 0 0 auto; inline-size: 32px; block-size: 32px; display: inline-grid; place-items: center;
  border-radius: 7px; background: #eee7f9; color: #453572; font-weight: 700; font-size: .87rem; }
.answer-option.right .choice-letter { background: #c8e8d2; color: #1b5336; }
.answer-option.wrong .choice-letter { background: #fae9c5; color: #69471e; }
.answer-mark { margin-inline-start: auto; font: 700 .9rem/1.5 'Segoe UI', Tahoma, Arial, sans-serif; }
.play-actions { margin-top: 18px; display: flex; justify-content: end; }
.play-actions .button { min-width: 190px; }
.progress-card { padding: 19px; background: #f0e9fa; border-color: #e4d8f3; }
.score, .result-score { font-size: 2.35rem; font-weight: 800; white-space: nowrap; }
.score small, .result-score small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.progress-card .muted { font-size: .83rem; }
progress { width: 100%; height: 12px; border: 0; accent-color: var(--primary); border-radius: 8px; background: #dfd3f1; overflow: hidden; }
progress::-webkit-progress-bar { background: #dfd3f1; }
progress::-webkit-progress-value { background: var(--primary); }
progress::-moz-progress-bar { background: var(--primary); }
.feedback { display: flex; align-items: center; gap: 9px; min-height: 47px; margin-block-start: 12px;
  padding: 9px 12px; border-radius: 10px; font-weight: 680; }
.feedback span { font-size: 1.2rem; }
.feedback.positive { background: #e0f0e3; color: #17482f; }
.feedback.negative { background: #fff1d8; color: #6b471b; }
.result-hero { text-align: center; padding: 23px 18px 27px; margin-bottom: 17px; border-radius: 24px;
  background: #e8ddfa; border: 1px solid #ddd0f3; }
.result-hero .eyebrow { color: var(--primary); overflow-wrap: anywhere; }
.result-star { display: inline-grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; margin-bottom: 9px;
  rotate: -8deg; background: #f5d583; color: #654622; box-shadow: 0 4px 0 #d0ad68; font-size: 1.65rem; }
.result-score { font-size: clamp(2.5rem, 8vw, 5rem); line-height: 1.25; margin-block: 9px; }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.review { padding: 19px; }
.review h2 { margin-bottom: 10px; }
.review details { padding: 9px 0; border-top: 1px solid var(--line); }
.review summary { cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 38px; }
.review summary::-webkit-details-marker { display: none; }
.review summary span:nth-child(2) { overflow-wrap: anywhere; }
.review summary span:nth-child(2)::before { content: '＋'; margin-inline-end: 5px; font-size: .9rem; }
.review details[open] summary span:nth-child(2)::before { content: '−'; }
.review-details { color: var(--muted); padding: 7px 43px 0 10px; overflow-wrap: anywhere; }
.positive-text { color: #276041; }
.negative-text { color: #893c28; }

/* Learner library and quiz player */
body[data-audience='learner'] {
  --bg: #f6f3fc;
  --paper: #fff;
  --ink: #272344;
  --muted: #5b5474;
  --primary: #5443ad;
  --primary-dark: #46368f;
  --line: #e2daf0;
  --mint: #f0ebfa;
  --radius: 24px;
}
body[data-audience='learner'] :focus-visible { outline-color: #7161c0; }
body[data-audience='learner'] .brand-icon { background: var(--primary); color: #fff0b8; }
body[data-audience='learner'] .outline { border-color: #d3c8ea; }
body[data-audience='learner'] .tab { min-height: 48px; font-size: 1rem; padding-inline: 18px; }
body[data-audience='learner'] .tab:hover,
body[data-audience='learner'] .tab[aria-current] { background: #eae2fa; border-color: #e1d6f3; }
body[data-audience='learner'] .library-hero {
  min-height: 242px; background: #e8ddfa; color: #352666; border: 1px solid #ddd0f3;
}
body[data-audience='learner'] .library-hero::after { display: none; }
.learner-hero-copy { position: relative; z-index: 1; max-width: 63%; }
.learner-hero-copy h1 { font-size: clamp(2rem, 5vw, 3.45rem); }
body[data-audience='learner'] .learner-hero-copy p { color: #504173; font-size: 1.14rem; }
.letter-art { position: absolute; inset-block: 0; inset-inline-end: 0; width: 42%; min-width: 145px;
  background: radial-gradient(circle, #ae95d838 2px, transparent 3px) 0 5px / 23px 23px; }
.letter-tile { display: grid; place-items: center; position: absolute; width: clamp(58px, 10vw, 106px); aspect-ratio: 1;
  border-radius: 24%; font: 700 clamp(33px, 6vw, 63px)/1 Tahoma, Arial, sans-serif; padding-block-end: .1em;
  color: #fff7dc; background: #6753ba; box-shadow: 0 8px 0 #44318943; user-select: none; }
.letter-tile:nth-child(1) { inset-block-start: 24%; inset-inline-end: 43%; rotate: -11deg; z-index: 1; }
.letter-tile:nth-child(2) { inset-block-start: 13%; inset-inline-end: 17%; rotate: 12deg; background: #f6d886; color: #594120; }
.letter-tile:nth-child(3) { inset-block-start: 52%; inset-inline-end: 20%; rotate: 9deg; background: #b9e3d4; color: #244a40; }
body[data-audience='learner'] .quiz-card { box-shadow: 0 3px 0 #ded6ec66; }
body[data-audience='learner'] .quiz-card:only-child { max-inline-size: 480px; }
body[data-audience='learner'] .quiz-cover {
  min-height: 116px; background-image: radial-gradient(circle at center, currentColor 1px, transparent 1.5px);
  background-size: 92px 92px;
}
body[data-audience='learner'] .cover-0 { background-color: #ddd1f6; color: #6850a2; }
body[data-audience='learner'] .cover-1 { background-color: #fae6b0; color: #835717; }
body[data-audience='learner'] .cover-2 { background-color: #cfece2; color: #326759; }
body[data-audience='learner'] .cover-letter { inset-block-start: -24px; inset-inline-end: 30px; font-size: 111px; }
body[data-audience='learner'] .quiz-card-body .button { width: 100%; }
body[data-audience='learner'] .button.primary { min-height: 53px; border-radius: 14px; font-size: 1.02rem; }
body[data-audience='learner'] .button.primary:disabled { background: #e9e1f2; color: #625478; opacity: 1; }
body[data-audience='learner'] .quiz-meta { font-size: .96rem; }
body[data-audience='learner'] .score-chip, body[data-audience='learner'] .row-number { background: #eee7f9; color: #453572; }
@media (max-width: 740px) {
  .welcome, .editor-grid, .play-grid { grid-template-columns: 1fr; }
  .welcome { margin-block-start: 4px; gap: 13px; }
  .welcome-art { min-height: 215px; }
  .welcome-copy h1 { max-width: none; }
  .welcome-art .hero-symbol { inset-block-start: -62%; }
  .play-card { grid-row: 2; }
  .progress-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; padding-block: 10px; }
  .progress-card .score { font-size: 1.4rem; }
  .topbar-inner { min-height: 65px; }
}
@media (max-width: 454px) {
  .identity { display: none; }
  .brand { font-size: .88rem; }
  .shell { padding-block-start: 15px; }
  .tab { padding-inline: 8px; font-size: .83rem; }
  .library-hero { min-height: 174px; }
  .library-hero .hero-symbol { inset-block-start: -70%; opacity: .8; }
  .section-head { flex-wrap: wrap; }
  .list-row { padding-inline: 10px; gap: 7px; }
  .list-row .button { padding-inline: 10px; }
  .answer-option { flex-wrap: wrap; }
  .answer-mark { margin-inline-start: 0; }
  body[data-audience='learner'] .library-hero { min-height: 176px; padding-inline: 17px; }
  body[data-audience='learner'] .learner-hero-copy p { font-size: 1rem; }
  .letter-tile:nth-child(1) { inset-inline-end: 44%; }
  .letter-tile:nth-child(2) { inset-inline-end: 10%; }
  .letter-tile:nth-child(3) { inset-inline-end: 14%; }
  .play-actions .button { width: 100%; }
}
