/* iPad landscape: the shell accounts for header, guide and footer together.
   Content remains measurable and scrollable when it truly exceeds the viewport. */
@media (min-width: 900px) and (min-height: 600px) and (orientation: landscape) {
  .app-shell {
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 clamp(24px, 3vw, 44px);
  }
  .site-header {
    height: 76px;
    flex-shrink: 0;
    gap: 24px;
  }
  .site-header nav a,
  .site-header nav button {
    min-height: 46px;
    padding: 9px 16px;
  }
  .brand > span {
    font-size: 25px;
  }
  .site-footer {
    flex-shrink: 0;
    padding: 9px 0 11px;
    font-size: 10px;
  }
  .main {
    flex: 1 0 auto;
    width: 100%;
    min-height: 0;
    padding: 20px 0;
  }
  .main.narrow {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
  }
  .bear-guide {
    min-height: 54px;
    margin-top: 12px;
    padding: 3px 15px 3px 9px;
  }
  .bear-guide > .art {
    width: 44px;
    height: 44px;
  }
  .bear-guide strong {
    font-size: 14px;
  }
  .bear-guide small {
    font-size: 12px;
  }

  .welcome-row {
    margin-bottom: 16px;
  }
  .welcome-row h1 {
    font-size: 31px;
  }
  .welcome-row p {
    margin-top: 5px;
  }
  .welcome-row .eyebrow {
    margin-bottom: 5px;
  }
  .explore-layout {
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 18px;
  }
  .town-map {
    height: clamp(270px, calc(100dvh - 440px), 560px);
    min-height: 0;
  }
  .town-image {
    height: 100%;
    min-height: 0;
  }
  .today-note {
    padding: 23px 20px 15px;
  }
  .today-note .eyebrow {
    margin-top: 11px;
  }
  .today-note h2 {
    font-size: 29px;
    line-height: 1.35;
  }
  .today-note p {
    line-height: 1.7;
  }
  .note-bear {
    width: 70px;
    top: 36px;
  }
  .mini-letters {
    margin: 12px 0;
  }
  .today-note > small {
    margin-top: 8px;
  }
  .section-heading {
    margin: 17px 0 10px;
  }
  .trail-grid {
    gap: 16px;
  }
  .trail {
    min-height: 86px;
    padding: 10px 18px;
    gap: 16px;
  }
  .trail-icon {
    width: 58px;
  }
  .trail strong {
    font-size: 22px;
  }
  .trail > span:nth-child(2) {
    gap: 1px;
  }
  .home-footnote {
    margin-top: 14px;
  }
  .entry-scene {
    min-height: 0;
    height: clamp(440px, calc(100dvh - 170px), 800px);
  }

  .lesson-top {
    margin-bottom: 8px;
  }
  .progress-track {
    margin-bottom: 16px;
  }
  .lesson-stage {
    padding: 22px 32px 20px;
  }
  .lesson-heading {
    padding-bottom: 17px;
  }
  .lesson-heading h1 {
    font-size: 28px;
  }
  .lesson-heading p {
    margin-top: 5px;
  }
  .learning-pair {
    min-height: 260px;
  }
  .character-lesson .character-board {
    min-height: 260px;
  }
  .character-lesson .character-tap {
    min-height: 185px;
  }
  .presentation-caption {
    margin: 15px auto 12px;
    min-height: 70px;
  }
  .presentation-caption h3 {
    font-size: 23px;
  }
  .presentation-caption p {
    margin-top: 6px;
  }
  .presentation-controls {
    padding: 6px 12px;
  }
  .presentation-controls > .art {
    width: 36px;
    height: 36px;
  }
  .lesson-bottom,
  .character-lesson .lesson-bottom {
    margin-top: 16px;
    padding-top: 14px;
  }
  .writing-layout {
    grid-template-columns: minmax(200px, 260px) minmax(0, clamp(320px, calc(100dvh - 380px), 640px));
    gap: 40px;
  }
  .writing-coach .lesson-heading {
    padding: 0 0 24px;
  }
  .page-heading {
    margin: 8px 0 22px;
  }
  .word-grid {
    margin-bottom: 16px;
  }
  .single-card {
    margin: 12px 0;
    padding: 26px 32px;
  }
  .completion {
    margin: 10px auto;
    padding-top: 22px;
  }
  .empty-state {
    padding: 30px 25px;
  }

  /* Keep glyph detail controls beside the drawing instead of below it. */
  .character-intro-dialog[open] {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    column-gap: 24px;
    width: min(800px, calc(100% - 40px));
    max-width: 800px;
    padding: 23px 26px 18px;
  }
  .intro-header,
  .intro-meta,
  .character-intro-dialog .intro-note,
  .intro-source {
    grid-column: 1 / -1;
  }
  .intro-meta {
    margin: 12px 0;
  }
  .intro-drawing {
    grid-column: 1;
    grid-row: 3 / 6;
    width: 264px;
    align-self: center;
  }
  .intro-caption {
    grid-column: 2;
    grid-row: 3;
    margin-top: 10px;
    min-height: 0;
    text-align: left;
    align-self: end;
  }
  .intro-caption .intro-explanation {
    margin-left: 0;
  }
  .intro-dots {
    grid-column: 2;
    grid-row: 4;
    margin: 16px 0;
  }
  .intro-controls {
    grid-column: 2;
    grid-row: 5;
    align-self: start;
  }
  .character-intro-dialog .intro-note {
    margin: 14px 0 9px;
  }

  .record-dialog[open] {
    max-width: 800px;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(260px, 1fr);
    column-gap: 28px;
    width: min(800px, calc(100% - 40px));
    padding: 22px 28px;
  }
  .record-header {
    grid-column: 1 / -1;
  }
  .record-word {
    grid-column: 1;
    grid-row: 2 / 5;
    flex-direction: column;
    gap: 8px;
  }
  .record-word strong {
    font-size: 110px;
  }
  .record-status {
    grid-column: 2;
    grid-row: 2;
    margin: 12px 0;
    min-height: 40px;
  }
  .record-main {
    grid-column: 2;
    grid-row: 3;
  }
  .record-actions {
    grid-column: 2;
    grid-row: 4;
    margin: 12px 0;
  }
  .record-assess,
  .record-result,
  .record-about,
  .record-footer {
    grid-column: 1 / -1;
  }
  .record-result {
    display: grid;
    grid-template-columns: 160px 1fr;
    align-items: center;
    column-gap: 24px;
    margin-top: 14px;
    padding: 12px 20px;
  }
  .record-result > span {
    grid-column: 1;
  }
  .record-result > div {
    grid-column: 1;
    grid-row: 2;
  }
  .record-comparison {
    grid-column: 2;
    grid-row: 1;
  }
  .record-result small {
    grid-column: 2;
    grid-row: 2;
  }
  .record-score {
    font-size: 40px;
  }
  .record-about {
    margin-top: 12px;
    padding-top: 8px;
  }
}

@media (min-width: 900px) and (min-height: 600px) and (max-height: 950px) and (orientation: landscape) {
  .site-header {
    height: 68px;
  }
  .site-footer {
    padding: 6px 0 8px;
    font-size: 9px;
  }
  .main {
    padding: 12px 0;
  }
  .bear-guide {
    margin-top: 8px;
    min-height: 48px;
  }
  .bear-guide > .art {
    width: 38px;
    height: 38px;
  }
  .welcome-row h1 {
    font-size: 28px;
  }
  .welcome-row {
    margin-bottom: 12px;
  }
  .town-map {
    height: clamp(250px, calc(100dvh - 410px), 440px);
  }
  .today-note {
    padding-top: 20px;
    padding-bottom: 12px;
  }
  .today-note h2 {
    font-size: 26px;
  }
  .today-note p {
    font-size: 12px;
  }
  .today-note .eyebrow {
    margin-top: 9px;
  }
  .mini-letters {
    margin: 9px 0;
  }
  .mini-letters span {
    width: 35px;
    height: 37px;
    font-size: 21px;
  }
  .trail {
    min-height: 76px;
    padding: 8px 15px;
  }
  .trail-icon {
    width: 48px;
  }
  .trail strong {
    font-size: 20px;
  }
  .trail small {
    font-size: 10px;
  }
  .section-heading {
    margin-top: 12px;
  }
  .home-footnote {
    margin-top: 10px;
  }
  .lesson-stage {
    padding: 17px 24px 15px;
  }
  .lesson-heading {
    padding-bottom: 12px;
  }
  .lesson-heading h1 {
    font-size: 26px;
  }
  .lesson-heading .eyebrow {
    margin-bottom: 4px;
  }
  .learning-pair,
  .character-lesson .learning-pair {
    min-height: 215px;
  }
  .character-lesson .character-board,
  .character-board,
  .pinyin-board {
    min-height: 215px;
    padding: 10px 16px;
  }
  .character-lesson .character-tap {
    min-height: 155px;
  }
  .big-character {
    font-size: 108px;
  }
  .pinyin-label {
    font-size: 23px;
  }
  .lesson-glyph {
    width: 145px;
  }
  .meaning-scene .large-art {
    width: 132px;
    height: 132px;
  }
  .meaning-scene h3,
  .meaning-scene h1 {
    font-size: 25px;
    margin: 5px 0;
  }
  .meaning-scene .button {
    margin-top: 12px;
  }
  .character-extras {
    margin-top: 10px;
  }
  .character-extras .button {
    margin-top: 0;
  }
  .presentation-caption {
    min-height: 60px;
    margin: 10px auto 8px;
  }
  .presentation-caption h3 {
    font-size: 21px;
  }
  .presentation-caption p {
    font-size: 12px;
    line-height: 1.7;
    margin-top: 4px;
  }
  .presentation-controls {
    padding: 4px 10px;
  }
  .presentation-controls > .art {
    width: 32px;
    height: 32px;
  }
  .lesson-bottom,
  .character-lesson .lesson-bottom {
    margin-top: 12px;
    padding-top: 12px;
    min-height: 0;
  }
  .progress-track {
    margin-bottom: 12px;
  }
  .syllable-parts {
    font-size: 46px;
    line-height: 1.3;
  }
  .syllable-full {
    font-size: 60px;
    line-height: 1.25;
    margin-bottom: 8px;
  }
  .order {
    margin-bottom: 15px;
  }
  .order-character {
    font-size: 65px;
  }
  .picture-option {
    max-width: 150px;
    min-height: 120px;
  }
  .letter-option {
    min-height: 115px;
    font-size: 61px;
  }
  .listen-orb {
    padding: 12px 18px;
    margin-bottom: 18px;
  }
  .listen-orb .icon {
    width: 34px;
    height: 34px;
  }
  .listen-orb .listen-icon {
    width: 34px;
    height: 34px;
  }
  .syllable-option {
    min-height: 132px;
    font-size: 46px;
  }
  .door-option {
    min-height: 145px;
    padding-top: 18px;
  }
  .story-scene {
    min-height: 0;
    padding: 12px 18px;
  }
  .story-art {
    width: 120px;
    height: 120px;
  }
  .story-text {
    font-size: 28px;
    margin-top: 0;
  }
  .story-scene p {
    margin: 8px 0;
  }
  .story-scene > .button {
    min-height: 44px;
  }
  .writing-layout {
    grid-template-columns: minmax(200px, 260px) minmax(0, clamp(320px, calc(100dvh - 330px), 640px));
    gap: 32px;
  }
  .writing-coach .lesson-heading {
    padding-bottom: 18px;
  }
  .writing-status {
    margin-top: 7px;
    font-size: 16px;
  }
  .page-heading {
    margin: 5px 0 14px;
  }
  .page-heading h1 {
    font-size: 28px;
  }
  .review-board {
    min-height: 210px;
    padding: 15px;
  }
  .review-board .big-character {
    font-size: 110px;
  }
  .review-skip {
    margin-top: 10px;
  }
  .completion-art,
  .empty-state .art {
    width: 105px;
    height: 105px;
    margin-bottom: 9px;
  }
  .completion {
    margin-top: 4px;
    margin-bottom: 4px;
    padding: 18px 24px;
  }
  .completion p {
    margin: 9px 0 14px;
  }
  .rest-note {
    padding: 16px 0;
  }
  .empty-state {
    padding: 20px;
  }
  .single-card {
    padding: 20px 25px;
    margin: 8px 0;
  }
}
/* Keep the off-screen live region from adding a one-pixel document tail. */
#announcer {
  position: fixed;
  top: 0;
  left: 0;
}

@media (min-width: 900px) and (min-height: 600px) and (orientation: landscape) {
  .town-map {
    height: clamp(270px, calc(100dvh - 520px), 520px);
  }
}
@media (min-width: 900px) and (min-height: 600px) and (max-height: 950px) and (orientation: landscape) {
  .town-map {
    height: clamp(250px, calc(100dvh - 460px), 400px);
  }
  .today-note {
    padding-bottom: 10px;
  }
  .today-note .eyebrow {
    margin-top: 6px;
    margin-bottom: 5px;
  }
  .today-note h2 {
    font-size: 24px;
  }
  .today-note p {
    line-height: 1.5;
  }
  .mini-letters {
    margin: 7px 0;
  }
  .mini-letters span {
    height: 34px;
  }
}
@media (min-width: 900px) and (min-height: 600px) and (max-height: 720px) and (orientation: landscape) {
  .welcome-row .eyebrow,
  .welcome-row p,
  .home-footnote {
    display: none;
  }
  .welcome-row {
    margin-bottom: 10px;
  }
  .explore-layout + .section-heading {
    display: none;
  }
  .trail-grid {
    margin-top: 12px;
  }
  .trail {
    min-height: 62px;
    padding: 6px 14px;
  }
  .trail-icon {
    width: 40px;
  }
  .trail > span > span {
    display: none;
  }
  .lesson-stage {
    padding: 14px 24px;
  }
  .writing-coach > .art {
    width: 76px;
    margin-bottom: 8px;
  }
  .lesson-heading .eyebrow {
    display: none;
  }
  .lesson-heading {
    padding-bottom: 8px;
  }
  .lesson-top {
    margin-bottom: 6px;
  }
  .progress-track {
    margin-bottom: 8px;
  }
  .lesson-bottom {
    padding-top: 10px;
    margin-top: 10px;
  }
  .character-lesson {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 10px 24px;
  }
  .character-lesson .lesson-heading {
    grid-column: 1 / -1;
    padding-bottom: 4px;
  }
  .character-lesson .learning-pair {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    gap: 20px;
  }
  .character-lesson .presentation-caption {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    text-align: left;
    align-self: center;
  }
  .character-lesson .presentation-controls {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    max-width: none;
  }
  .character-lesson .lesson-bottom {
    grid-column: 1 / -1;
    grid-row: 4;
    margin: 0;
    padding-top: 10px;
  }
  .character-lesson .meaning-scene .large-art {
    width: 100px;
    height: 100px;
  }
  .character-lesson .meaning-scene h3 {
    font-size: 24px;
  }
  .character-lesson .meaning-scene p {
    font-size: 12px;
  }
  .character-lesson .character-extras {
    margin-top: 8px;
  }
}
@media (min-width: 900px) and (min-height: 600px) and (max-height: 720px) and (orientation: landscape) {
  .entry-invitation {
    padding: 18px 36px;
  }
  .entry-bear {
    width: 100px;
    height: 100px;
  }
  .entry-invitation h1 {
    font-size: 29px;
  }
  .entry-invitation p {
    margin-bottom: 15px;
    font-size: 14px;
  }
  .start-listening {
    min-height: 68px;
  }
  .entry-invitation > .text-button {
    margin-top: 10px;
  }
  .character-lesson {
    row-gap: 8px;
  }
  .character-lesson .character-board {
    min-height: 205px;
  }
  .character-lesson .character-tap {
    min-height: 145px;
  }
  .character-lesson .big-character {
    font-size: 98px;
    line-height: 1.15;
  }
  .character-lesson .meaning-scene .large-art {
    width: 92px;
    height: 92px;
  }
}
@media (min-width: 900px) and (min-height: 721px) and (max-height: 950px) and (orientation: landscape) {
  .character-lesson .meaning-scene .large-art {
    width: 108px;
    height: 108px;
  }
  .character-lesson .big-character {
    font-size: 104px;
    line-height: 1.2;
  }
  .character-lesson .lesson-glyph {
    width: 135px;
  }
}
@media (min-width: 900px) and (min-height: 600px) and (max-height: 720px) and (orientation: landscape) {
  .site-header {
    height: 60px;
  }
  .site-footer {
    font-size: 9px;
    line-height: 1.25;
    padding: 2px 0;
  }
  .bear-guide {
    min-height: 44px;
    margin-top: 6px;
    padding-top: 2px;
    padding-bottom: 2px;
  }
  .bear-guide > .art {
    width: 32px;
    height: 32px;
  }
  .bear-guide strong {
    font-size: 13px;
    line-height: 1.3;
  }
  .bear-guide small {
    font-size: 11px;
    line-height: 1.4;
  }
  .syllable-option {
    min-height: 125px;
    font-size: 42px;
    line-height: 1.2;
    padding: 8px 16px 12px;
  }
  .syllable-option .art {
    width: 60px;
    height: 48px;
  }
  .door-option {
    min-height: 125px;
    padding-top: 16px;
  }
  .door-number {
    margin-bottom: 6px;
  }
  .story-art {
    width: 104px;
    height: 104px;
  }
  .review-board {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    column-gap: 24px;
    min-height: 180px;
    padding: 10px 20px;
  }
  .review-board .big-character {
    grid-column: 1;
    grid-row: 1 / 3;
    text-align: center;
  }
  .revealed-answer {
    grid-column: 2;
    grid-row: 1;
    margin: 0 0 8px;
    align-self: end;
  }
  .review-board .button {
    grid-column: 2;
    grid-row: 2;
    min-height: 44px;
    justify-self: start;
    align-self: start;
  }
  .review-board [data-action='reveal'] {
    grid-row: 1 / 3;
    align-self: center;
  }
  .review-actions {
    margin-top: 12px;
  }
  .review-skip {
    margin-top: 8px;
  }
  .small-note {
    margin-top: 10px;
    margin-bottom: 10px;
    line-height: 1.6;
  }
}

@media (min-width: 900px) and (min-height: 600px) and (orientation: landscape) {
  .trail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .trail {
    gap: 12px;
  }
  .trail-icon {
    width: 50px;
  }
  .trail strong {
    font-size: 20px;
  }
  .trail > span > span {
    font-size: 10px;
  }
  .today-note h2 {
    font-size: 26px;
    line-height: 1.35;
    max-width: 150px;
  }
  .word-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
  }
  .word-card {
    min-width: 0;
    padding: 20px 12px;
  }
  .word-card strong {
    font-size: 75px;
  }
  .word-status {
    font-size: 10px;
  }
  .word-bottom {
    font-size: 12px;
  }
  .course-choice {
    min-height: 270px;
    padding: 23px;
    gap: 18px;
  }
  .course-art {
    width: 115px;
    height: 115px;
  }
  .course-copy > strong {
    font-size: 25px;
  }
}
@media (min-width: 900px) and (min-height: 600px) and (max-height: 950px) and (orientation: landscape) {
  .trail-icon {
    width: 38px;
  }
  .trail {
    gap: 10px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .trail strong {
    font-size: 18px;
  }
  .trail > .icon {
    width: 17px;
  }
  .today-note h2 {
    font-size: 24px;
  }
  .course-choice {
    min-height: 235px;
    padding: 20px;
    gap: 16px;
  }
  .course-art {
    width: 100px;
    height: 100px;
  }
  .course-copy > strong {
    font-size: 23px;
  }
  .course-copy {
    gap: 8px;
  }
  .word-card {
    padding: 16px 10px;
  }
  .word-card strong {
    font-size: 68px;
  }
}
