/* Keep the English text, sheet art, answer feedback and playback tracking in their native layouts. */
@media screen and (max-width: 820px) {
  .library-reader .lesson-actions,
  .library-reader .reader-title > div > p,
  .library-reader .course-page-switch,
  .library-reader .library-audio-dock,
  .library-reader .exercise-kicker,
  .library-reader .exercise-header,
  .speaking-entry,
  .speaking-dialog,
  .oral-sense-introduction .oral-intro-lead h1,
  .original-book-library,
  .reader-header:has(#back-to-library),
  #chapter-content .book-access-message,
  .learning-report,
  .rp-page,
  .reading-levels-heading,
  .reading-test-heading,
  #starter-scene-lesson .meal-heading {
    font-family: var(--bright-round, system-ui);
  }

  /* Blue marks the reader and its listening tools. */
  .library-reader .lesson-hero {
    padding: 16px;
    border: 0;
    border-radius: 20px;
    background: var(--bright-blue, #65cff3);
    color: var(--bright-ink, #263f50);
  }

  .library-reader .reader-title > button {
    align-self: flex-start;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--bright-ink, #263f50);
  }

  .library-reader .reader-title > div { min-width: 0; }
  .library-reader .reader-title h1 { color: inherit; overflow-wrap: anywhere; }
  .library-reader .reader-title p { color: #26485b; font-weight: 650; }
  .library-reader .lesson-actions button {
    min-height: 44px;
    border: 1px solid rgb(38 63 80 / 24%);
    border-radius: 12px;
    background: #fff;
    color: var(--bright-ink, #263f50);
    box-shadow: none;
  }

  .library-reader .course-page-switch button {
    min-height: 44px;
    border-radius: 12px;
  }
  .library-reader .course-page-switch button.is-active,
  .library-reader .player-speed-control .speed-chip.active,
  .library-reader [data-lesson-audio-choice][aria-pressed="true"] {
    border-color: var(--bright-ink, #263f50);
    background: var(--bright-ink, #263f50);
    color: #fff;
  }

  .library-reader .library-audio-dock {
    border-top: 3px solid var(--bright-blue, #65cff3);
    background: #fff;
  }
  .library-reader .library-audio-dock .player-play {
    background: var(--bright-blue, #65cff3);
    color: var(--bright-ink, #263f50);
  }

  .library-reader .exercise-panel .exercise-header {
    padding: 12px 15px;
    border-radius: 15px;
    background: var(--bright-yellow, #ffcf4e);
    color: var(--bright-ink, #263f50);
  }
  .library-reader .exercise-header h2,
  .library-reader .exercise-header .exercise-subtitle { color: inherit; }
  .library-reader .cloze-check-button,
  .library-reader .locked-access-actions button:first-child,
  .library-reader .locked-band .primary-action {
    background: var(--bright-ink, #263f50);
    color: #fff;
    border-radius: 12px;
  }
  .library-reader .locked-band {
    background: #fff2c4;
    border: 1px solid #dbbd60;
    border-radius: 20px;
  }

  /* Guided practice keeps the recorder status and results distinct. */
  .speaking-entry {
    background: #e6f8ed;
    border-color: #bedac9;
  }
  .speaking-entry button,
  .speaking-dialog .speaking-header,
  .speaking-dialog .speaking-steps [aria-current="step"] {
    color: var(--bright-ink, #263f50);
    background: var(--bright-green, #78dfa3);
  }
  .speaking-dialog .speaking-header { border-color: #68c990; }
  .speaking-header .speaking-eyebrow { color: #25503c; }
  .speaking-dialog .speaking-header .speaking-close {
    border-radius: 12px;
    color: var(--bright-ink, #263f50);
    box-shadow: none;
    background: #fff;
  }
  .speaking-dialog button.is-primary:not(.is-recording),
  .speaking-dialog .speaking-replay .is-primary {
    background: var(--bright-ink, #263f50);
    color: #fff;
  }

  .english-starter-player .english-starter-mode[aria-pressed="true"] {
    border-color: var(--bright-ink, #263f50);
    color: var(--bright-ink, #263f50);
    background: var(--bright-blue, #65cff3);
    box-shadow: none;
  }
  .english-starter-player .english-starter-song-mode[aria-pressed="true"] {
    background: var(--bright-pink, #ff8cc5);
  }
  .english-starter-player .english-starter-play,
  .english-starter-player .english-starter-song-mode[aria-pressed="true"] .english-starter-mode-badge {
    background: var(--bright-ink, #263f50);
    color: white;
  }
  .english-starter-player .english-starter-song { background: white; }

  .starter-scenes-entry,
  #starter-scene-lesson {
    --meal-ink: var(--bright-ink, #263f50);
    --meal-accent: #264653;
  }
  .starter-scenes-entry {
    border: 1px solid #ecc3dc;
    background: #ffe7f3;
  }
  #starter-scene-lesson .meal-heading {
    padding: 11px 13px;
    border-radius: 16px;
    color: var(--meal-ink);
    background: var(--bright-pink, #ff8cc5);
  }
  #starter-scene-lesson .meal-heading h1 { color: inherit; }
  #starter-scene-lesson .meal-back { background: #fff; }
  #starter-scene-lesson .meal-steps button[aria-pressed="true"] {
    color: #fff;
    border-color: var(--meal-ink);
    background: var(--meal-ink);
    box-shadow: none;
  }

  /* The series cover is still the first identifier inside each book card. */
  .original-book-library .original-book-library-intro {
    padding: 18px;
    border: 0;
    border-radius: 20px;
    color: var(--bright-ink, #263f50);
    background: var(--bright-yellow, #ffcf4e);
  }
  .original-book-library .original-book-library-intro > div > p:last-child { color: #484129; }
  .original-book-library .original-book-card {
    background: #fff;
    border-color: var(--bright-rule, #dce4e7);
    border-radius: 16px;
  }
  .original-book-library a.original-book-action {
    background: var(--bright-ink, #263f50);
    border-color: var(--bright-ink, #263f50);
    color: #fff;
    border-radius: 12px;
  }
  .original-book-library .original-book-series > header > span {
    padding: 4px 9px;
    border-radius: 999px;
    background: #fff1b9;
    color: #5d4914;
  }

  /* Original books open in their own HTML reader. */
  .reader-header:has(#back-to-library) {
    background: #ffedb4;
    color: var(--bright-ink, #263f50);
    border-color: #edcc73;
  }
  .reader-header .library-link .brand-mark,
  #book-audio-panel .book-audio-primary,
  #chapter-content .book-access-message .primary-button,
  #book-dialog .primary-button {
    background: var(--bright-ink, #263f50);
    color: #fff;
  }
  #chapter-content .book-access-message {
    padding: 18px 14px;
    border-radius: 16px;
    background: #fff3c9;
    color: var(--bright-ink, #263f50);
  }
  #book-audio-panel { border-top: 3px solid var(--bright-yellow, #ffcf4e); }
  #book-audio-panel input[type="range"] { accent-color: #42647a; }

  .oral-sense-introduction,
  .oral-sense {
    --oral-ink: var(--bright-ink, #263f50);
    --oral-intro-ink: var(--bright-ink, #263f50);
    --oral-iris: #35684e;
  }
  .oral-sense-introduction .oral-intro-sleeve,
  .oral-sense .oral-sense-prompt {
    border: 0;
    border-radius: 20px;
    box-shadow: none;
    background: var(--bright-green, #78dfa3);
    color: var(--bright-ink, #263f50);
  }
  .oral-sense-introduction .oral-intro-lead :is(h1 span, p),
  .oral-sense .oral-sense-prompt :is(h1, h1 [lang="en"], .oral-sense-play) { color: inherit; }
  .oral-sense-introduction .oral-intro-lead .oral-intro-cta,
  .oral-sense .oral-sense-prompt .oral-sense-play-icon {
    color: #fff;
    background: var(--bright-ink, #263f50);
  }
  .oral-sense-introduction .oral-intro-cta:focus-visible,
  .oral-sense .oral-sense-prompt .oral-sense-play:focus-visible { outline-color: var(--bright-ink, #263f50); }

  .learning-report .learning-report-heading,
  .rp-page .rp-page-heading,
  .reading-levels-page .reading-levels-heading,
  .reading-test-page .reading-test-heading,
  .reading-result-page .reading-result-hero {
    padding: 15px;
    border: 0;
    border-radius: 18px;
    background: var(--bright-blue, #65cff3);
    color: var(--bright-ink, #263f50);
  }
  .learning-report .learning-report-heading :is(h1, p, .learning-eyebrow),
  .rp-page .rp-page-heading :is(h1, p),
  .reading-levels-page .reading-levels-heading :is(h1, p),
  .reading-test-page .reading-test-heading :is(h1, p),
  .reading-result-page .reading-result-hero :is(h1, p, small) { color: inherit; }
  .reading-test-page .assessment-track-grid button:first-child { background: #ffe2f0; }
  .reading-test-page .assessment-track-grid button:nth-child(2) { background: #e4f8ee; }
  .band.learning-empty:has(> h1),
  [data-reading-plan-page] > section.rp-page:has(> h1) {
    margin: 16px auto;
    padding: 20px 16px;
    border: 0;
    border-radius: 18px;
    background: #dff5ff;
    color: var(--bright-ink, #263f50);
  }
  .band.learning-empty > button:first-of-type,
  [data-reading-plan-page] > section.rp-page > button {
    min-height: 44px;
    border-radius: 12px;
    border-color: var(--bright-ink, #263f50);
    background: var(--bright-ink, #263f50);
    color: white;
  }
  .reading-test-page .assessment-action-row button:not(:disabled),
  .learning-report .learning-period button.is-current,
  .rp-page .rp-primary {
    background: var(--bright-ink, #263f50);
    color: white;
  }
  .reading-roadmap-dialog .reading-roadmap-header {
    background: var(--bright-yellow, #ffcf4e);
    color: var(--bright-ink, #263f50);
  }
}

/* Carry the home bookmark and its frosted face onto lessons with a song. */
[data-dock-song], [data-dock-sentence], .english-starter-floating-caption { display: none; }
@media screen {
  .study-shell[data-starter-lesson] {
    --song-ink: #263f50;
    --song-teal: #225f68;
    --song-edge: rgba(107, 152, 163, .36);
    --song-glass: #eef7f8;
    --song-control: #fbfdfd;
    --song-dock: #f8fcfd;
  }
  .study-shell[data-starter-lesson] .lesson-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(16px, 3vw, 26px);
    border: 1px solid var(--song-edge);
    border-radius: 17px;
    background: #e6f3f5;
    box-shadow: inset 0 1px 1px #fff, 0 3px 10px rgba(43, 87, 99, .07);
    color: var(--song-ink);
  }
  .study-shell[data-starter-lesson] .lesson-hero::before {
    content: "";
    position: absolute;
    z-index: -2;
    top: -20px;
    right: clamp(26px, 11%, 100px);
    width: 52px;
    height: 100px;
    transform: rotate(-18deg);
    background: conic-gradient(from 125deg at 50% 83%, transparent 0 110deg, #65cff3 110deg);
    filter: blur(3px);
    pointer-events: none;
  }
  .study-shell[data-starter-lesson] .lesson-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--song-glass);
    pointer-events: none;
  }
  .study-shell[data-starter-lesson] .reader-title { margin-bottom: 0; }
  .study-shell[data-starter-lesson] .reader-title h1 {
    margin: 5px 0 0;
    font-family: Charter, "Iowan Old Style", Georgia, serif;
    letter-spacing: -.016em;
    color: var(--song-ink);
  }
  .study-shell[data-starter-lesson] :is(.reader-title > button, .lesson-actions button) {
    min-height: 44px;
    border: 1px solid var(--song-edge);
    background: var(--song-control);
    color: var(--song-ink);
    box-shadow: inset 0 1px #fff;
  }
  .study-shell[data-starter-lesson] .course-page-switch {
    display: inline-flex;
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 8px;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--song-edge);
    border-radius: 15px;
    background: var(--song-glass);
  }
  .study-shell[data-starter-lesson] .course-page-switch button {
    padding: 6px 16px;
    border-radius: 11px;
    color: var(--song-ink);
  }
  .study-shell[data-starter-lesson] .course-page-switch button.is-active {
    background: var(--song-teal);
    color: #fff;
    box-shadow: none;
  }
  .english-starter-player .english-starter-song {
    border-color: var(--song-edge, #bdd8dc);
    border-radius: 16px;
    background: var(--song-glass, #eef7f8);
    box-shadow: inset 0 1px #fff;
  }
  .english-starter-player :is(.english-starter-seek, .english-starter-translation-toggle input) {
    accent-color: var(--song-teal, #225f68);
  }
  .english-starter-player :is(.english-starter-restart, .english-starter-retry) {
    border: 1px solid var(--song-edge, #bdd8dc);
    background: var(--song-control, #fbfdfd);
    color: var(--song-teal, #225f68);
  }
  .english-starter-player .english-starter-mode[aria-pressed="true"] {
    background: #d9eef0;
    border-color: #82b3b9;
    color: #234c55;
    box-shadow: inset 0 -2px #38877f;
  }
  .english-starter-player .english-starter-song-mode[aria-pressed="true"] .english-starter-mode-badge,
  .english-starter-player .english-starter-play {
    background: var(--song-teal, #225f68);
    color: #fff;
  }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .study-shell[data-starter-lesson] {
      --song-glass: rgba(232, 246, 248, .55);
      --song-control: rgba(255, 255, 255, .76);
      --song-dock: rgba(248, 253, 254, .84);
    }
    .study-shell[data-starter-lesson] .lesson-hero::after,
    .english-starter-player .english-starter-song {
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
    }
  }
}
@media screen and (max-width: 820px) {
  .library-reader [data-starter-listening-dock].library-audio-dock .player-main {
    grid-template-columns: 44px minmax(0, 1fr) auto 44px 44px;
    gap: 6px;
  }
  .library-reader [data-starter-listening-dock].library-audio-dock.is-collapsed .player-main {
    grid-template-columns: 44px minmax(0, 1fr) auto 44px;
  }
  [data-starter-listening-dock] [data-dock-song] {
    display: inline-block;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--song-edge);
    border-radius: 12px;
    background: var(--song-control);
    color: var(--song-teal);
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
  }
  [data-starter-listening-dock] [data-dock-sentence]:not([hidden]) {
    display: block;
    grid-column: 1 / -1;
    margin: 0;
    padding: 8px 4px 2px;
    border-top: 1px solid var(--song-edge);
    color: var(--song-ink);
    font: 600 19px/1.35 Charter, Georgia, serif;
    overflow-wrap: anywhere;
  }
  .english-starter-floating-caption:not([hidden]) {
    position: fixed;
    z-index: 25;
    inset: auto 12px calc(8px + env(safe-area-inset-bottom)) 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid #b8d6db;
    border-radius: 14px;
    background: rgba(244, 252, 252, .95);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #263f50;
    text-align: left;
    box-shadow: 0 2px 12px rgba(43, 87, 99, .12);
    cursor: pointer;
  }
  .english-starter-floating-caption strong {
    font: 600 19px/1.35 Charter, Georgia, serif;
    overflow-wrap: anywhere;
    max-height: 32vh;
    overflow: hidden;
  }
  .english-starter-floating-caption mark {
    background: #c1e6de;
    color: #154f48;
    border-radius: 3px;
  }
  .english-starter-floating-caption span {
    flex-shrink: 0;
    color: #225f68;
    font: 600 12px/1.4 var(--font-ui, sans-serif);
  }
  .study-shell[data-starter-lesson] .library-audio-dock {
    border: 1px solid var(--song-edge);
    border-bottom: 0;
    background: var(--song-dock);
    box-shadow: 0 -3px 16px rgba(43, 87, 99, .08);
    -webkit-backdrop-filter: blur(15px) saturate(120%);
    backdrop-filter: blur(15px) saturate(120%);
  }
  .study-shell[data-starter-lesson] .library-audio-dock .player-play {
    background: #d1edef;
    color: var(--song-teal);
  }
}
@media screen and (prefers-reduced-transparency: reduce) {
  .study-shell[data-starter-lesson] {
    --song-glass: #eef7f8;
    --song-control: #fff;
    --song-dock: #f8fcfd;
  }
  .study-shell[data-starter-lesson] .lesson-hero::after,
  .study-shell[data-starter-lesson] .library-audio-dock,
  .english-starter-floating-caption:not([hidden]),
  .english-starter-player .english-starter-song {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .english-starter-floating-caption:not([hidden]) { background: #f8fcfd; }
}
