/* One layout, six student palettes. Reading surfaces and feedback stay consistent. */
.luxi-app, .theme-preview {
  --theme-primary: #17635f; --theme-strong: #114b49; --theme-accent: #ef7651;
  --theme-action: #ffd266; --theme-secondary: #8accd6; --theme-page: #fff6e5;
  --theme-soft: #e4f1ee; --theme-wash: #f3f7f4; --theme-ink: #172a31;
  --chrome-ink: #172a31; --chrome-muted: #53676b; --chrome-line: #dddfd6;
  --chrome-panel: #fffcf5; --theme-glow: transparent;
}
[data-theme="cobalt"] {
  --theme-primary: #2856d8; --theme-strong: #1b3c9c; --theme-accent: #f37963;
  --theme-action: #ffcc66; --theme-secondary: #bcdff3; --theme-page: #f8fafd;
  --theme-soft: #e8efff; --theme-wash: #f0f5fc; --theme-ink: #192a49;
  --chrome-ink: #192a49; --chrome-muted: #52637d; --chrome-line: #dce4f0; --chrome-panel: #ffffff;
}
[data-theme="forest"] {
  --theme-primary: #285847; --theme-strong: #1b4034; --theme-accent: #c97754;
  --theme-action: #eec66a; --theme-secondary: #c5d6b4; --theme-page: #f7f4e9;
  --theme-soft: #e7eee0; --theme-wash: #f1f4eb; --theme-ink: #22362d;
  --chrome-ink: #22362d; --chrome-muted: #566759; --chrome-line: #dce0d1; --chrome-panel: #fffdf6;
}
[data-theme="cosmic_blue"] {
  --theme-primary: #174a9e; --theme-strong: #123978; --theme-accent: #ff9b42;
  --theme-action: #66e2ff; --theme-secondary: #657bff; --theme-page: #0c1830;
  --theme-soft: #e3edff; --theme-wash: #f0f5fc; --theme-ink: #172b49;
  --chrome-ink: #eaf5ff; --chrome-muted: #b8cbea; --chrome-line: #2d4e7b;
  --chrome-panel: #10213f; --theme-glow: #66e2ff;
}
[data-theme="ruby"] {
  --theme-primary: #a51d35; --theme-strong: #79152c; --theme-accent: #ffb45b;
  --theme-action: #ffb6aa; --theme-secondary: #ed5267; --theme-page: #240e19;
  --theme-soft: #fce8eb; --theme-wash: #fff4f3; --theme-ink: #37202a;
  --chrome-ink: #fff4f2; --chrome-muted: #e6bbc6; --chrome-line: #743247;
  --chrome-panel: #320f1c; --theme-glow: #ed5267;
}
[data-theme="emerald"] {
  --theme-primary: #08664d; --theme-strong: #054a39; --theme-accent: #ffbe61;
  --theme-action: #8bf1d0; --theme-secondary: #21c58e; --theme-page: #071f1b;
  --theme-soft: #dff5ed; --theme-wash: #eff9f4; --theme-ink: #14372e;
  --chrome-ink: #edfff8; --chrome-muted: #b1d9ca; --chrome-line: #245d4d;
  --chrome-panel: #0b2a24; --theme-glow: #21c58e;
}
.luxi-app {
  --page: var(--theme-wash); --panel: #fffefa; --ink: var(--theme-ink); --muted: #56666b;
  --purple: var(--theme-primary); --purple-dark: var(--theme-strong); --lavender: var(--theme-soft);
  --gold: var(--theme-action); --peach: #fff1d9; --line: #d8e1e2;
  --mint: #dcf5e8; --green: #16734d; --red: #aa2845; --red-soft: #ffedf0;
  --shadow: 0 8px 30px #082b3210;
  --art-primary: var(--theme-primary); --art-accent: var(--theme-accent);
  --art-secondary: var(--theme-secondary); --art-glow: var(--theme-action); --art-ink: var(--theme-ink);
  min-height: 100vh; background: var(--theme-page); color: var(--chrome-ink);
  font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
}
.luxi-app :focus-visible { outline-color: var(--theme-action); box-shadow: 0 0 0 6px var(--theme-primary); }
.luxi-app .panel :focus-visible, .luxi-app .task-panel :focus-visible,
.luxi-app .offering-card:focus-visible, .luxi-app .activity-card :focus-visible {
  outline-color: var(--theme-primary); box-shadow: none;
}
.app-shell { max-width: 1220px; background: var(--theme-page); border-color: var(--chrome-line); box-shadow: 0 12px 48px #091c2910; }
.app-header { background: var(--chrome-panel); border-color: var(--chrome-line); padding: 20px 32px; }
.brand { color: var(--chrome-ink); letter-spacing: -.06em; line-height: 1; font-weight: 900; }
.brand-wordmark { font-size: 38px; }
.brand-wordmark b { color: var(--theme-accent); font-weight: inherit; }
.brand-subtitle { color: var(--chrome-muted); letter-spacing: .025em; line-height: 1.5; margin-top: 6px; }
.student-nav a { color: var(--chrome-ink); font-weight: 700; }
.student-nav a:hover, .student-nav a[aria-current="page"] { color: var(--theme-strong); background: var(--theme-soft); }
.student-nav .luxi-mascot { width: 38px; height: 38px; flex-basis: 38px; }
.student-nav .mascot-badge { display: none; }
.main-content { min-width: 0; padding: 30px 34px 38px; }
.main-content > .page-heading h1 { font-size: clamp(1.75rem,3.6vw,2.8rem); letter-spacing: -.045em; }
.app-footer { border-color: var(--chrome-line); color: var(--chrome-muted); }
.page-context, .main-content > .muted, .main-content > .section > .muted { color: var(--chrome-muted); }
.level-chip { background: var(--chrome-panel); color: var(--chrome-ink); border-color: var(--chrome-line); }
a.level-chip:hover, summary.level-chip:hover { color: var(--theme-strong); }
.level-picker { position: relative; min-width: 0; max-width: 100%; }
.level-picker summary { list-style: none; user-select: none; }
.level-picker summary::-webkit-details-marker { display: none; }
.level-picker summary > span { overflow-wrap: anywhere; }
.level-picker[open] .level-picker-chevron { transform: rotate(180deg); }
.level-picker-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: min(250px, calc(100vw - 48px)); max-height: min(360px, 60dvh); overflow-y: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 12px 28px #071f1b24; }
.level-picker-menu form { margin: 0; display: grid; gap: 3px; }
.level-picker-option { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; font-weight: 600; }
.level-picker-option > span { overflow-wrap: anywhere; }
.level-picker-option:hover, .level-picker-option[aria-current="true"] { background: var(--theme-soft); color: var(--theme-strong); }
.luxi-app .level-picker-option:focus-visible { outline-color: var(--theme-primary); outline-offset: -3px; box-shadow: none; }
.panel, .activity-card, .offering-card, .task-panel, .library-task { color: var(--ink); }
/* Reserve the check's space on every card; completion never changes its geometry. */
.activity-card .card-title > div { min-width: 0; overflow-wrap: anywhere; }
.activity-card-completed { background: var(--theme-soft); border-color: var(--theme-primary); }
.activity-completion-slot { display: block; width: 32px; height: 32px; flex: 0 0 32px; margin-left: auto; }
.activity-completion { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--theme-primary); color: #fff; }
.activity-completion .luxi-icon { width: 22px; height: 22px; }
.round-complete .task-actions, .round-complete .task-action-listening { width: 100%; }
.round-complete .round-replay-slot { min-height: 48px; }
.button, .button.primary, .button--primary, .audio-control { box-shadow: none; }
.button.primary, .button--primary { background: var(--theme-primary); border-color: var(--theme-primary); color: #fff; }
.button.primary:hover:not(:disabled), .button--primary:hover:not(:disabled) { background: var(--theme-strong); }
.button:hover:not(:disabled) { border-color: var(--theme-primary); }
.main-content > .section .section-heading > .action-with-audio > .text-link { color: var(--chrome-ink); }
.flash { color: var(--ink); }
.flash.alert { color: #812f41; }
.flash.notice { color: var(--green); }
.progress-track { background: var(--theme-soft); }
.progress-fill { background: var(--theme-primary); }
.main-content > .progress-meter { color: var(--chrome-ink); }
.panel .progress-numbers, .task-panel .progress-numbers, .activity-card .progress-numbers, .offering-card .progress-numbers { color: var(--ink); }
.task-panel { background: #fffefa; box-shadow: 0 8px 30px #071a2410; }
.task-panel .progress-fill { background: var(--theme-primary); }
.choice:has(input:focus-visible) { outline-color: var(--theme-primary); }
.choice.correct, .choice.correct:has(input:checked), .answer-input.correct { color: #105637; border-color: var(--green); background: var(--mint); }
.choice.incorrect { color: #782238; background: var(--red-soft); border-color: var(--red); }
.choice-mark { border-radius: 50%; }
.choice.correct .choice-mark { color: white; background: var(--green); padding: 3px; }
.choice.incorrect .choice-mark { color: white; background: var(--red); padding: 3px; }
.reading-passage { background: var(--theme-wash); }
.letter-target { width: fit-content; min-width: 1.6em; margin: 0 auto 24px; padding: .13em .28em; background: #fff1d9; border-radius: 50%; }
.profile-settings { max-width: 100%; }
.profile-heading { color: var(--chrome-ink); }
.profile-heading .luxi-mascot { width: 108px; height: 108px; flex-basis: 108px; }
.theme-settings { margin-top: 22px; }
.theme-settings form { display: grid; gap: 20px; }
.theme-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; padding: 0; border: 0; width: 100%; }
.theme-option { display: grid; position: relative; grid-template-columns: 1fr 24px; gap: 10px; padding: 10px; min-width: 0; border: 2px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--ink); cursor: pointer; }
.theme-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-option:has(input:checked) { border-color: var(--theme-primary); box-shadow: 0 0 0 2px var(--theme-primary); }
.theme-option:has(input:focus-visible) { outline: 3px solid var(--theme-primary); outline-offset: 5px; }
.theme-option .theme-name { align-self: center; font-size: 14px; line-height: 1.3; }
.theme-selected { display: grid; align-self: center; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #8b9c9f; }
.theme-selected .luxi-icon { width: 16px; height: 16px; visibility: hidden; }
.theme-option:has(input:checked) .theme-selected { background: var(--theme-primary); border-color: var(--theme-primary); color: white; }
.theme-option:has(input:checked) .theme-selected .luxi-icon { visibility: visible; }
.theme-preview { display: grid; grid-column: 1/-1; grid-template-columns: 1fr 1fr; gap: 7px; position: relative; min-height: 112px; overflow: hidden; padding: 12px; border-radius: 10px; background: var(--theme-page); border: 1px solid var(--chrome-line); }
.theme-preview-hero { display: block; grid-column: 1/-1; position: relative; height: 47px; border-radius: 8px; background: var(--theme-primary); border: 1px solid var(--theme-glow); }
.theme-preview-hero::before { content: ''; position: absolute; width: 25px; height: 28px; top: 9px; right: 12px; border-radius: 3px; background: var(--theme-accent); box-shadow: -7px -2px 0 var(--theme-secondary); transform: rotate(-8deg); }
.theme-preview-action { display: block; position: absolute; left: 8px; bottom: 9px; width: 38%; height: 11px; border-radius: 4px; background: var(--theme-action); }
.theme-preview-card { display: block; height: 26px; background: #fffefa; border-radius: 5px; border: 1px solid #dde5e7; }
/* D's subject-led start, with the same real session and catalogue actions. */
.home-hero { grid-template-columns: minmax(0,1.1fr) minmax(180px,.9fr); gap: 16px; min-height: 286px; padding: 28px 34px; border-radius: 26px 34px 26px 34px; background: linear-gradient(125deg,var(--theme-primary),var(--theme-strong)); border: 1px solid color-mix(in srgb,var(--theme-action) 22%,var(--theme-primary)); color: white; overflow: hidden; }
.home-hero .hero-copy { gap: 15px; min-width: 0; }
.home-hero .hero-copy h2 { font-size: clamp(1.8rem,3vw,2.5rem); line-height: 1.15; }
.home-hero .hero-type { font-size: 15px; line-height: 1.5; opacity: .95; }
.home-hero .progress-meter { width: min(100%,300px); }
.home-hero .progress-track { background: #ffffff35; }
.home-hero .progress-fill { background: var(--theme-action); }
.home-hero .progress-numbers, .home-hero .eyebrow { color: white; }
.home-hero .button.primary { background: var(--theme-action); border-color: var(--theme-action); color: #142433; min-height: 52px; }
.home-hero .button.primary:hover { background: color-mix(in srgb,var(--theme-action) 84%,white); color: #142433; }
.home-hero .audio-control { background: #ffffff16; border-color: #ffffff66; color: white; }
.home-hero .text-link { color: white; }
.home-hero .hero-art { display: grid; place-items: center; min-width: 0; align-self: center; }
.home-hero .subject-art { width: 100%; max-width: 310px; }
.hero-art > .luxi-mascot { width: 175px; height: 175px; flex-basis: 175px; }
.offering-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.subject-heading { align-items: center; margin-bottom: 0; }
.subject-sort { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 100%; }
.subject-sort label { font-size: 14px; color: var(--chrome-ink); }
.subject-sort select { width: auto; max-width: 100%; min-height: 46px; padding: 10px 36px 10px 14px; border: 1px solid var(--chrome-line); border-radius: 14px; background: var(--chrome-panel); color: var(--chrome-ink); }
.subject-section { scroll-margin-top: 20px; }
.offering-card { position: relative; gap: 14px; padding: 22px; background: var(--panel); border-radius: 22px; overflow: hidden; }
.offering-card .card-title { justify-content: space-between; gap: 8px; }
.offering-card .card-title strong { font-size: 21px; overflow-wrap: anywhere; }
.offering-card .subject-art { width: 100%; height: 138px; }
.offering-card .progress-meter { margin-top: auto; }
.offering-card .empty-progress { margin-top: auto; }
.offering-card:hover { border-color: var(--theme-primary); box-shadow: 0 7px 24px #132c381a; }
[data-theme-kind="cosmic"] .home-hero { border-color: var(--theme-glow); box-shadow: 0 0 0 1px color-mix(in srgb,var(--theme-glow) 24%,transparent),0 0 22px color-mix(in srgb,var(--theme-glow) 12%,transparent), inset 0 0 25px #00102b24; }
[data-theme-kind="cosmic"] .main-content > .section .text-link,
[data-theme-kind="cosmic"] .main-content > .text-link { color: var(--chrome-ink); }
[data-theme-kind="cosmic"] .page-heading .card-title { color: var(--chrome-ink); }
[data-theme-kind="cosmic"] .app-header .audio-control { background: var(--chrome-panel); color: var(--chrome-ink); border-color: var(--chrome-line); }
[data-theme-kind="cosmic"] .student-nav a[aria-current="page"] { background: var(--theme-primary); color: white; }
/* The helper is a real local asset. Its meaning comes from the nearby text and badges. */
.luxi-mascot { width: 76px; height: 76px; flex: 0 0 76px; vertical-align: middle; }
.mascot-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.mascot-badge { width: 27px; height: 27px; right: -1px; bottom: 0; border: 2px solid var(--panel); background: var(--theme-action); color: #142433; }
.mood-ready .mascot-badge { display: none; }
.mood-good .mascot-badge, .mood-done .mascot-badge { background: var(--mint); color: var(--green); }
.mood-wrong .mascot-badge { background: var(--peach); color: #78490b; }
.task-feedback .luxi-mascot { width: 66px; height: 66px; flex-basis: 66px; }
@media (min-width: 1000px) {
  [data-student-interface="true"] .app-shell { display: grid; grid-template-columns: 148px minmax(0,1fr); min-height: calc(100vh - 56px); }
  [data-student-interface="true"] .app-header { grid-column: 1; grid-row: 1/3; flex-direction: column; justify-content: start; align-items: stretch; padding: 26px 15px; gap: 36px; border-right: 1px solid var(--chrome-line); border-bottom: 0; }
  [data-student-interface="true"] .brand { justify-content: center; }
  [data-student-interface="true"] .brand-subtitle { display: none; }
  [data-student-interface="true"] .student-nav { flex-direction: column; gap: 20px; }
  [data-student-interface="true"] .student-nav a { width: 104px; min-height: 82px; justify-content: center; }
  [data-student-interface="true"] .main-content { grid-column: 2; grid-row: 1; }
  [data-student-interface="true"] .app-footer { grid-column: 2; grid-row: 2; }
}
@media (max-width: 900px) { .app-shell { min-height: 100vh; } }
@media (max-width: 750px) {
  .theme-picker { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .offering-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 650px) {
  .main-content { padding: 24px 20px 30px; }
  .app-header { padding: 16px 20px; gap: 18px; }
  .student-nav { flex: 1; justify-content: flex-end; gap: 7px; }
  .student-nav a { min-width: 68px; }
  .brand-wordmark { font-size: 30px; }
  .brand-subtitle { display: none; }
  .home-hero { grid-template-columns: minmax(0,1fr) minmax(110px,.65fr); min-height: 240px; padding: 25px 22px; }
  .hero-art > .luxi-mascot { width: 115px; height: 115px; flex-basis: 115px; }
  .home-hero .hero-copy h2 { font-size: 1.8rem; }
  .home-hero .hero-type { font-size: 14px; }
  .offering-card .subject-art { height: 115px; }
  .offering-card { padding: 18px; }
  .theme-option { padding: 9px; gap: 9px; }
}
@media (max-width: 430px) {
  .subject-sort { width: 100%; justify-content: space-between; }
  .main-content { padding: 22px 14px; }
  .app-header { padding: 15px; justify-content: center; }
  .student-nav { width: 100%; justify-content: space-between; }
  .student-nav a { min-width: 85px; }
  .home-hero { grid-template-columns: minmax(0,1fr) 95px; padding: 22px 17px; gap: 5px; }
  .home-hero .hero-copy h2 { font-size: 1.65rem; }
  .home-hero .action-with-audio { gap: 6px; }
  .home-hero .hero-art { align-self: start; margin-top: 24px; }
  .home-hero .subject-art { width: 125px; max-width: none; }
  .hero-art > .luxi-mascot { width: 90px; height: 90px; flex-basis: 90px; }
  .offering-grid { grid-template-columns: 1fr; }
  .offering-card { display: grid; grid-template-columns: minmax(0,1fr) 100px; align-items: center; }
  .offering-card .card-title { grid-column: 1; grid-row: 1; }
  .offering-card .subject-art { grid-column: 2; grid-row: 1/3; width: 110px; height: 100px; }
  .offering-card .progress-meter, .offering-card .empty-progress { grid-column: 1; }
  .theme-preview { padding: 9px; gap: 5px; min-height: 99px; }
  .theme-option .theme-name { font-size: 13px; }
  .theme-picker { gap: 12px; }
}
@media (forced-colors: active) {
  .home-hero, .theme-preview, .theme-preview-hero, .theme-preview-card { border: 1px solid CanvasText; }
  .theme-option:has(input:checked) { outline: 3px solid Highlight; }
  .theme-selected .luxi-icon { forced-color-adjust: auto; }
  .choice.correct, .choice.incorrect { outline: 2px solid CanvasText; }
}

/* Keep the editor's subject color as a small subject identifier. */
.subject-picture--art { display: block; position: relative; width: 100%; height: 138px; background: transparent; border-radius: 0; }
.subject-picture--art::after { content: ''; position: absolute; bottom: 3px; left: calc(50% - 18px); width: 36px; height: 3px; border-radius: 3px; background: var(--subject-color,var(--theme-primary)); }
.subject-picture--art .subject-art { max-width: none; }
@media (max-width: 650px) { .subject-picture--art { height: 115px; } }
@media (max-width: 430px) { .offering-card .subject-picture--art { grid-column: 2; grid-row: 1/3; width: 110px; height: 100px; } }

.theme-choice { display: grid; align-content: start; gap: 8px; min-width: 0; }
.theme-listening { display: flex; justify-content: center; }

.home-hero .hero-copy .button_to { min-width: 0; max-width: 100%; }
.home-hero .hero-copy .button { max-width: 100%; }
.home-hero .action-with-audio { flex-wrap: wrap; }

.luxi-app .skip-link:focus { color: var(--ink); background: #fff; }
[data-theme-kind="cosmic"] .offering-card:focus-visible { outline-color: var(--theme-action); }

/* Immediate press feedback for student actions and card navigation. */
[data-student-interface="true"] .button.primary:is(:active, .is-pressed):not(:disabled),
[data-student-interface="true"] .button--primary:is(:active, .is-pressed):not(:disabled),
[data-student-interface="true"] .activity-card .button:is(:active, .is-pressed):not(:disabled) {
  filter: brightness(.88);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, currentColor 22%, transparent);
  transition: none;
}
[data-student-interface="true"] .offering-card:is(:active, .is-pressed),
[data-student-interface="true"] .library-task:is(:active, .is-pressed) {
  background: color-mix(in srgb, var(--theme-primary) 12%, var(--panel));
  border-color: var(--theme-primary);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--theme-primary) 35%, transparent);
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  [data-student-interface="true"] .button,
  [data-student-interface="true"] .offering-card,
  [data-student-interface="true"] .library-task { transition: none; }
}
@media (forced-colors: active) {
  [data-student-interface="true"] .button:is(:active, .is-pressed):not(:disabled),
  [data-student-interface="true"] .offering-card:is(:active, .is-pressed),
  [data-student-interface="true"] .library-task:is(:active, .is-pressed) {
    filter: none;
    outline: 3px solid Highlight;
    outline-offset: -3px;
  }
}
