/* R16 shared layout: one intrinsic template for every language and direction. */
*,
*::before,
*::after { box-sizing: border-box; }
html,
body,
body > header,
body > main,
body > footer,
#lesson,
.bar,
.player-shell,
.player-shell > *,
.player-shell .stage,
.player-shell .journey {
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}
html,
body { overflow-x: clip; }
body { margin-inline: 0; }
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  padding-inline: 20px;
  overflow: visible;
}
.bar > *,
.bar-actions,
.bar-actions > * { min-inline-size: 0; max-inline-size: 100%; }
.bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
main#lesson { padding-inline: clamp(.75rem,2.5vw,1.5rem); }
footer { padding-inline: 20px; overflow-wrap: anywhere; }
:where([dir="ltr"], [dir="rtl"]) :where(*, *::before, *::after) { min-inline-size: 0; }
[dir="rtl"] .bar,
html[dir="rtl"] .bar { direction: rtl; }
.player-shell {
  display: grid;
  grid-template-columns: clamp(240px,22vw,300px) minmax(0,1fr);
  grid-template-rows: auto;
  align-items: start;
  height: auto !important;
  min-height: 0;
  max-height: none !important;
  overflow: visible !important;
}
.player-shell .stage,
.player-shell .journey {
  height: auto !important;
  min-height: 0;
  max-height: none !important;
  overflow: visible !important;
}
.player-shell .journey ol { max-height: none !important; overflow: visible !important; }
.player-shell .slide-nav { position: static !important; }
.player-shell .deep-lesson {
  display: grid !important;
  grid-template-columns: minmax(0,1fr);
  grid-template-rows: auto;
  grid-auto-rows: auto;
  align-content: start;
  align-items: start;
  gap: 20px;
  height: auto !important;
  min-height: 0;
  max-height: none !important;
  overflow: visible !important;
}
.player-shell .deep-lesson > :where(.step-label,h1,.lesson-narration,.lesson-content-grid,.term-grid,.lesson-sources) {
  grid-column: 1 / -1 !important;
  grid-row: auto !important;
  min-width: 0;
}
.player-shell .lesson-content-grid {
  display: grid;
  grid-template-columns: minmax(0,1.35fr) minmax(300px,1fr);
  grid-auto-rows: auto;
  align-items: start;
  gap: 20px;
  width: 100%;
  height: auto !important;
  min-width: 0;
  min-height: 0;
  max-height: none !important;
  overflow: visible !important;
}
.lesson-content-primary,
.lesson-content-secondary { display: flex; flex-direction: column; align-items: stretch; gap: 20px; min-width: 0; height: auto !important; min-height: 0; max-height: none !important; overflow: visible !important; }
.player-shell .lesson-core-grid { display: block; width: 100%; height: auto !important; min-height: 0; max-height: none !important; overflow: visible !important; margin: 0; }
.player-shell .lesson-core-grid .learning-media { width: 100%; max-width: 100%; margin: 0; }
.player-shell .lesson-introduction { display: flex; flex-direction: column; align-items: stretch; gap: 20px; width: 100%; height: auto !important; min-width: 0; min-height: 0; max-height: none !important; overflow: visible !important; padding: 0; }
.player-shell .takeaway,
.player-shell .detail-card,
.player-shell .example-card,
.player-shell .lesson-content-grid > * {
  align-self: start;
  width: 100%;
  height: auto !important;
  min-width: 0;
  min-height: 0;
  max-height: none !important;
  overflow: visible !important;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.player-shell .takeaway { padding: 1rem; }
.player-shell .detail-card,
.player-shell .example-card { padding: clamp(1rem,2vw,1.4rem); margin: 0; }
.player-shell .term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,16rem),1fr));
  grid-auto-rows: auto;
  align-items: stretch;
  gap: 20px;
  width: 100%;
  height: auto !important;
  min-width: 0;
  min-height: 0;
  max-height: none !important;
  overflow: visible !important;
  grid-row: auto !important;
}
.player-shell .term-grid > section { height: auto !important; min-width: 0; min-height: 0; max-height: none !important; overflow: visible !important; line-height: 1.7; }
.player-shell .lesson-sources { grid-row: auto !important; overflow-wrap: anywhere; }
.slide-panel.history { display: block !important; width: 100%; height: auto !important; min-height: 0; max-height: none !important; overflow: visible !important; }
.history-infographic { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); align-items: start; gap: 0; width: 100%; height: auto !important; min-width: 0; max-height: none !important; overflow: visible; }
.history-period-panel,.history-context { min-width: 0; height: auto !important; max-height: none !important; overflow-wrap: anywhere; }
.map-slide { display: block !important; width: 100%; height: auto !important; min-height: 0; max-height: none !important; overflow: visible !important; }
.map-layout { display: grid !important; grid-template-columns: minmax(0,1.2fr) minmax(300px,.8fr); align-items: start; gap: 20px; width: 100%; min-width: 0; height: auto !important; max-height: none !important; overflow: visible !important; }
.map-wrap,.map-detail { align-self: start; width: 100%; min-width: 0; height: auto !important; max-height: none !important; overflow: visible !important; }
.map-wrap { padding: clamp(1rem,2.5vw,2rem); }
.map-wrap svg { display: block; width: 100%; max-width: 100%; height: auto; }
.province-table,.province-cards { width: 100%; max-width: 100%; min-width: 0; }
.province-cards { display: grid !important; grid-template-columns: repeat(auto-fit,minmax(min(100%,250px),1fr)) !important; align-items: stretch; gap: 12px; }
.province-card { min-width: 0; height: auto !important; max-height: none !important; overflow: visible !important; }
.province-card button { width: 100%; height: auto !important; min-width: 0; min-height: 3.5rem; max-height: none !important; white-space: normal; overflow-wrap: anywhere; }
bdi[dir="ltr"] { direction: ltr; unicode-bidi: isolate; }
@media (max-width: 1100px) {
  .player-shell { grid-template-columns: minmax(0,1fr); }
  .player-shell .journey { display: block; }
}
@media (max-width: 959px) {
  .player-shell .lesson-content-grid,
  .map-layout { grid-template-columns: minmax(0,1fr) !important; }
  .history-infographic { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 720px) {
  .player-shell .journey ol {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    gap: .25rem;
    overflow: visible;
    padding-inline-start: 1.25rem;
  }
  .player-shell .journey li {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
