.app-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-controls a,
.app-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid #668470;
  border-radius: 8px;
  background: #24493b;
  color: #fffef5;
  font: 700 .9rem/1.25 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.app-controls a:hover,
.app-controls button:hover {
  background: #39634f;
}

.app-controls button[aria-pressed="true"] {
  background: #e1eea3;
  color: #173d30;
}

.app-controls :focus-visible {
  outline: 3px solid #e1eea3;
  outline-offset: 2px;
}

.app-header {
  height: auto;
  min-height: 76px;
  flex-wrap: wrap;
}

.app-controls [role="status"] {
  color: #ffe1a0;
  font: 650 .875rem/1.3 system-ui, sans-serif;
}

.app-controls [role="status"]:empty {
  display: none;
}

@media print {
  .app-header, .app-controls { display: none !important; }
}

[data-predict][aria-pressed="true"] {
  outline: 2px solid #ffca78;
  outline-offset: 2px;
}

@media screen {
  html.presentation-viewport {
    overflow: clip;
  }

  .presentation-viewport > body {
    position: fixed;
    inset: 0;
  }

  .presentation main {
    transform: scale(var(--presentation-scale, 1));
    transform-origin: top center;
  }

  .office-lesson.presentation .shell {
    max-width: 1640px;
    padding: 16px clamp(16px, 3vw, 48px);
  }

  .office-lesson.presentation .world {
    height: min(59dvh, 660px);
    min-height: 0;
    aspect-ratio: auto;
  }

  .office-lesson.presentation .station-open > :is(.intro, .world, .mobile-nav, .toolbar) {
    display: none;
  }

  .office-lesson.presentation .panel {
    margin-top: 0;
    padding: clamp(16px, 2vw, 28px);
    animation: none;
  }

  .office-lesson.presentation .feedback:empty {
    display: none;
  }

  .computing-lesson.presentation .app-header {
    padding: 9px 3vw;
  }

  .computing-lesson.presentation main {
    max-width: 1640px;
    padding: 14px clamp(16px, 3vw, 40px);
  }

  .computing-lesson.presentation h1 {
    font-size: clamp(2.25rem, 4.2vw, 4rem);
  }

  .computing-lesson.presentation h1 br {
    display: none;
  }

  .computing-lesson.presentation .hero {
    gap: 10px;
    margin-bottom: 12px;
  }

  .computing-lesson.presentation .hero p {
    margin-bottom: 0;
  }

  .computing-lesson.presentation main > .map {
    height: min(48dvh, 560px);
    min-height: 0;
    aspect-ratio: auto;
  }

  .computing-lesson.presentation .stations {
    gap: 6px;
    margin: 10px 0;
  }

  .computing-lesson.presentation .stations button {
    min-width: min(100%, 110px);
    padding: 5px 10px;
  }

  .computing-lesson.presentation #welcome:not([hidden]) {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
    gap: 12px 24px;
  }

  .computing-lesson.presentation #welcome h2 {
    font-size: clamp(1.45rem, 2.3vw, 2.35rem);
  }

  .computing-lesson.presentation #welcome .big {
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    font-weight: 600;
  }

  .computing-lesson.presentation #welcome .question {
    margin: 0 0 8px;
    padding: 7px 10px;
    font-size: 1rem;
  }

  .computing-lesson.presentation main:not([data-station="welcome"]) > :is(.hero, .map, .stations, footer) {
    display: none;
  }

  .computing-lesson.presentation .panel {
    padding: clamp(14px, 1.7vw, 26px);
    animation: none;
  }

  .computing-lesson.presentation .panelhead {
    margin-bottom: 12px;
  }

  .computing-lesson.presentation .panelhead h2 {
    font-size: clamp(1.75rem, 3vw, 3rem);
  }

  .computing-lesson.presentation .simgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
  }

  .computing-lesson.presentation .simgrid .tile {
    padding: 12px;
  }

  .computing-lesson.presentation .sim-exercises {
    grid-column: auto;
  }

  .computing-lesson.presentation .sim-exercises .tile {
    margin-top: 8px;
  }

  .computing-lesson.presentation .simgrid button {
    font-size: .9rem;
    padding: 6px 9px;
  }

  .computing-lesson.presentation .sim-input .metric {
    font-size: clamp(2rem, 3.3vw, 3.5rem);
  }

  .computing-lesson.presentation .sim-input :is(.range, .meter) {
    margin-block: 8px;
  }

  .computing-lesson.presentation .sim-input .question {
    margin: 8px 0;
    padding: 7px 9px;
    font-size: 1rem;
  }

  .computing-lesson.presentation .sim-input .simstate {
    margin: 8px 0;
    padding: 7px 9px;
  }

  .computing-lesson.presentation .simgrid .feedback {
    min-height: 0;
    margin: 6px 0;
    font-size: .9rem;
  }

  .computing-lesson.presentation .simgrid .feedback:empty {
    display: none;
  }

  .computing-lesson.presentation .simgrid .log {
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .computing-lesson.presentation .flowchart {
    gap: 5px;
  }

  .computing-lesson.presentation .flowchart .node {
    padding: 6px 8px;
  }

  .computing-lesson.presentation .sim-exercises :is(p, .testrow) {
    font-size: .9rem;
  }

  .computing-lesson.presentation .sim-exercises .map {
    height: clamp(100px, 17dvh, 200px);
    min-height: 0;
    aspect-ratio: auto;
    border-radius: 12px;
  }

  .computing-lesson.presentation .sim-exercises .map svg {
    transform: none;
  }

  .computing-lesson.presentation .sim-exercises :is(.hot, .mapcaption) {
    display: none;
  }

  .computing-lesson.presentation footer {
    margin-top: 10px;
  }

  @media (min-width: 800px) {
    .computing-lesson.presentation .transfer-concepts {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .computing-lesson.presentation .transfer-connections {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  @media (max-height: 900px) {
    .office-lesson.presentation .panel-head {
      margin-bottom: 8px;
    }

    .office-lesson.presentation .panel :is(p, .barrow) {
      margin-block: 5px;
    }

    .office-lesson.presentation .card {
      padding: 11px;
    }

    .office-lesson.presentation .panel .choices {
      margin-block: 4px 7px;
    }

    .office-lesson.presentation .panel .choices button {
      padding: 5px 8px;
    }

    .office-lesson.presentation .panel :is(th, td, td input) {
      padding-block: 4px;
    }

    .office-lesson.presentation .panel :is(.formula, .alert) {
      padding-block: 7px;
    }

    .computing-lesson.presentation .transfer .tile {
      padding: 10px;
    }

    .computing-lesson.presentation .transfer .tile p {
      margin-block: 4px;
    }

    .computing-lesson.presentation .transfer .metric {
      font-size: 2.6rem;
    }

    .computing-lesson.presentation .transfer .feedback:empty {
      display: none;
    }

    .ai-lesson.presentation .scene :is(.scene-top, .scene-title) {
      margin-bottom: 12px;
    }

    .ai-lesson.presentation .scene .panel {
      padding: 14px;
    }

    .ai-lesson.presentation .scene .feedback {
      min-height: 0;
      margin-top: 8px;
      padding-block: 8px;
    }

    .ai-lesson.presentation .scene .checkrow {
      padding-block: 6px;
    }
  }

  @media (max-width: 800px) {
    .computing-lesson.presentation #welcome:not([hidden]) {
      grid-template-columns: 1fr;
    }

    .computing-lesson.presentation .simgrid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .computing-lesson.presentation .sim-exercises {
      grid-column: 1 / -1;
    }
  }
}

[data-lesson-step="theory"] .lesson-review,
[data-lesson-step="theory"] > .lesson-theory ~ *,
[data-lesson-step="practice"] > .lesson-theory {
  display: none;
}

.lesson-theory {
  --lesson-accent: #236343;
  --lesson-border: #b8c9ad;
  --lesson-card: #fffdf5;
  --lesson-example: #eaf1db;
  margin-block: 12px;
}

.computing-lesson .lesson-theory {
  --lesson-accent: #d6ed8b;
  --lesson-border: #567768;
  --lesson-card: #1a3a2e;
  --lesson-example: #263e2d;
}

.lesson-theory h3,
.lesson-example h4,
.lesson-example p {
  margin: 0;
}

.lesson-concepts dd,
.lesson-example p {
  line-height: 1.55;
}

.lesson-example p + p,
.challenge-intro p + p {
  margin-top: .6em;
}

.lesson-example p,
.challenge-intro p {
  max-width: 68ch;
}

.lesson-theory :is(dd, p) strong {
  font-weight: 750;
}

.lesson-theory code,
.office-lesson .hint code {
  font-weight: 700;
}

.computing-lesson :is(p, dd) strong {
  color: var(--ink);
}

.office-lesson .hint,
.office-lesson .subtle {
  color: #405c50;
}

.office-lesson .back:hover {
  background: #d8e5ce;
}

.office-lesson #home .checklist input {
  flex: none;
}

.ai-lesson {
  --muted: #4b6054;
}

.ai-lesson .pin small {
  color: var(--muted);
}

.ai-lesson .flow em {
  color: #4d674d;
}

.office-lesson input::placeholder,
.ai-lesson :is(input, textarea)::placeholder {
  color: #526357;
  opacity: 1;
}

.lesson-theory .lesson-kicker {
  margin: 0 0 4px;
  color: var(--lesson-accent);
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.lesson-theory > h3 {
  font-size: clamp(1.45rem, 2.7vw, 2.15rem);
  line-height: 1.15;
}

.lesson-concepts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.lesson-concepts > div {
  background: var(--lesson-card);
  border: 1px solid var(--lesson-border);
  border-radius: 12px;
  padding: clamp(12px, 1.7vw, 20px);
}

.lesson-concepts dt,
.lesson-example h4 {
  margin-bottom: 5px;
  font-weight: 800;
}

.lesson-concepts dd {
  margin: 0;
}

.lesson-example {
  background: var(--lesson-example);
  border-inline-start: 4px solid var(--lesson-accent);
  border-radius: 0 12px 12px 0;
  margin: 14px 0;
  padding: clamp(12px, 1.7vw, 20px);
}

button.lesson-practice,
button.lesson-review {
  border: 1px solid transparent;
  border-radius: 9px;
  background: #236343;
  color: #fff;
  padding: 9px 14px;
  min-height: 42px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

button.lesson-review {
  background: #e5ebd8;
  color: #234934;
}

.computing-lesson button.lesson-practice {
  background: #d6ed8b;
  color: #152d17;
}

.computing-lesson button.lesson-review {
  background: #234438;
  border-color: #668470;
  color: #f7fff1;
}

button.lesson-practice:hover,
button.lesson-review:hover {
  filter: brightness(.92);
}

[data-lesson-step] > :is(.panel-head, .panelhead, .scene-top) {
  flex-wrap: wrap;
}

[data-lesson-step] > :is(.panel-head, .panelhead) > div:first-child {
  flex: 1 1 270px;
}

@media (max-width: 650px) {
  .lesson-concepts {
    grid-template-columns: 1fr;
  }
}

.map-object,
.map-scenery {
  filter: drop-shadow(0 5px 5px #132a2455);
  pointer-events: none;
}

.lesson-object {
  display: grid;
  place-items: center;
  min-width: 0;
  margin: 0;
  padding: clamp(10px, 2vw, 26px);
  border-radius: 14px;
  background: radial-gradient(ellipse at center, #dbe8c7 0%, #eaf0df 52%, #f4f2e7 100%);
}

.office-lesson .lesson-object {
  background: radial-gradient(ellipse at center, #d9e8e4 0%, #eaf0e5 60%, #f4f2e7 100%);
}

.computing-lesson .lesson-object {
  background: radial-gradient(ellipse at center, #385949 0%, #203e32 63%, #18352b 100%);
}

.ai-lesson .lesson-object {
  background: radial-gradient(ellipse at center, #e1d9ec 0%, #eee8f3 56%, #f4f1f2 100%);
}

.lesson-object img {
  display: block;
  width: 100%;
  height: min(28dvh, 290px);
  object-fit: contain;
  filter: drop-shadow(0 8px 6px #173c3033);
}

@media (min-width: 761px) {
  .illustrated-lesson {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 26%);
    gap: 0 16px;
    align-items: start;
  }

  .illustrated-lesson > .lesson-object {
    grid-column: 2;
    grid-row: 1 / 5;
    align-self: stretch;
  }

  .illustrated-lesson > .lesson-practice {
    grid-column: 1;
    justify-self: start;
  }
}

.challenge-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 23%);
  align-items: center;
  gap: 14px;
}

.challenge-intro .lesson-object {
  padding: 8px 14px;
}

.challenge-intro .lesson-object img {
  height: clamp(90px, 15dvh, 158px);
}

@media (max-width: 760px) {
  .illustrated-lesson > .lesson-object {
    margin-top: 10px;
    padding: 10px;
  }

  .illustrated-lesson > .lesson-object img {
    height: clamp(100px, 19dvh, 160px);
  }
}

@media (max-width: 500px) {
  .challenge-intro {
    grid-template-columns: 1fr;
  }
}

.world:not(.focused) .map-object[data-open],
.map:not(.focus) .map-object[data-go],
.map-world .map-object[data-scene] {
  pointer-events: visiblePainted;
  cursor: pointer;
}

.map-object:hover {
  filter: drop-shadow(0 6px 6px #132a2485);
}

.station-heading {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.3vw, 20px);
  min-width: 0;
}

.station-thumbnail {
  --thumbnail-size: clamp(48px, 5vw, 76px);
  flex: 0 0 var(--thumbnail-size);
  width: var(--thumbnail-size);
  height: var(--thumbnail-size);
  padding: 6px;
  object-fit: contain;
  border: 1px solid #c8dac4;
  border-radius: 14px;
  background: #edf2e6;
}

.office-lesson .station-thumbnail {
  border-color: #c7dcd7;
  background: #e5eeeb;
}

.computing-lesson .station-thumbnail {
  border-color: #58775f;
  background: #284b3c;
}

.ai-lesson .station-thumbnail {
  border-color: #dcd0e8;
  background: #f0e8f5;
}

[data-lesson-step="theory"] .station-thumbnail {
  display: none;
}

.office-lesson #home .challenge-intro {
  grid-template-columns: minmax(0, 1fr) minmax(108px, 31%);
}

.office-lesson #home .lesson-object {
  background: #f1e5c9;
}

.ai-lesson .end .lesson-object {
  background: radial-gradient(circle, #f9edcb, #d8e2c4);
}

.ai-lesson .end .panel p {
  color: var(--ink);
}

.ai-lesson .end .panel .mini {
  color: var(--muted);
}

.history-example .challenge-intro {
  grid-template-columns: minmax(0, 1fr) minmax(90px, 14%);
}

.history-example .lesson-object {
  padding: 4px 8px;
}

.history-example .lesson-object img {
  height: clamp(52px, 8dvh, 88px);
}

.ai-lesson .fruit-stage {
  background: radial-gradient(ellipse at center, #315248, #152f29 66%, #102822);
}

@media screen {
  .office-lesson {
    background: #102c26 radial-gradient(ellipse at 50% 0%, #1a4136, #102c26 66%);
  }

  .computing-lesson {
    background: #0b231c radial-gradient(ellipse at 45% 0%, #15382b, #0b231c 70%);
  }

  .ai-lesson {
    background: #f4f2e6 radial-gradient(ellipse at 50% 0%, #faf7ee, #f4f2e6 72%);
  }

  .office-lesson .world,
  .computing-lesson main > .map,
  .ai-lesson .map-wrap {
    box-shadow: 0 16px 42px #10291f30;
  }

  .office-lesson .world {
    border: 1px solid #82aa8c;
  }
}

@media (max-width: 520px) {
  .office-lesson #home .challenge-intro,
  .history-example .challenge-intro {
    grid-template-columns: 1fr;
  }

  .office-lesson #excel table {
    font-size: .82rem;
  }

  .office-lesson #excel :is(th, td) {
    padding: 5px 4px;
  }

  .office-lesson #excel table input {
    width: 62px;
    max-width: 100%;
    padding: 4px;
  }

  .office-lesson #excel .barrow {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}

@media (max-height: 800px) {
  .presentation .station-thumbnail {
    --thumbnail-size: 54px;
    padding: 4px;
  }

  .ai-lesson.presentation .end {
    padding: 16px;
  }

  .ai-lesson.presentation .end h2 {
    margin-block: 6px;
    font-size: clamp(1.7rem, 2.8vw, 2.55rem);
  }

  .ai-lesson.presentation .end .lesson-object img {
    height: clamp(70px, 12dvh, 116px);
  }

  .ai-lesson.presentation .end .data-table :is(th, td) {
    padding-block: 6px;
  }

  .ai-lesson.presentation .end .checklist li {
    margin-block: 4px;
  }

  .ai-lesson.presentation .end .note {
    padding: 10px;
  }
}
