.story-banner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: #f4edcf;
  border-radius: 20px;
}
.story-banner > span {
  font-size: 60px;
}
.story-banner h3 {
  margin: 0 0 6px;
}
.story-banner p {
  margin: 0 0 6px;
  line-height: 1.6;
}
.story-dialogue {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
}
.story-dialogue > span {
  font-size: 64px;
}
.story-dialogue p {
  font-size: 20px;
  line-height: 1.6;
  margin: 0;
}
.unlock-list {
  display: grid;
  gap: 8px;
}
.unlock-row {
  display: flex;
  gap: 15px;
  padding: 12px;
  border-bottom: 1px solid #dfdfcf;
  color: #888;
}
.unlock-row.open {
  color: #356e62;
}
.unlock-row > b {
  min-width: 45px;
}
.unlock-row small {
  display: block;
  line-height: 1.6;
  margin-top: 3px;
}
.math-lesson-top {
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.06em;
  font-size: 12px;
  font-weight: 800;
  color: #4b8173;
}
.math-progress {
  width: 100%;
  height: 5px;
  accent-color: #61a496;
  margin: 10px 0 16px;
}
.math-phase {
  color: #ad8048;
  font-size: 13px;
  margin-bottom: 7px;
}
.math-lesson h2 {
  font-size: 25px;
  line-height: 1.3;
  margin: 8px 0;
}
.math-prompt-tools {
  display: flex;
  gap: 8px;
}
.math-model {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 60px;
  padding: 14px;
}
.math-mini {
  width: 40px;
  height: 46px;
  display: inline-block;
  animation: math-pop 0.18s ease-out;
}
.math-mini svg {
  width: 100%;
  height: 100%;
}
.model-group {
  display: flex;
  flex-wrap: wrap;
  max-width: 240px;
  padding: 6px;
  border: 2px solid #d6c69e;
  border-radius: 14px;
  background: #f7eccc;
}
.math-basket {
  font-size: 34px;
}
.math-cue {
  text-align: center;
  margin: 0;
  font-weight: 700;
  color: #568578;
}
.ten-bundle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  background: #f1cc8d;
  border: 2px solid #b79257;
  border-radius: 6px;
  font-size: 22px;
}
.ten-bundle b {
  font-size: 14px;
}
.math-workbench {
  position: relative;
  background: #eaf3e2;
  border: 1px solid #cbd9b7;
  border-radius: 20px;
  padding: 16px;
  min-height: 145px;
}
.math-supply {
  display: flex;
  align-items: center;
  gap: 18px;
}
.prop-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  min-width: 70px;
  min-height: 92px;
  background: #fffdf1;
  border: 2px solid #82b0a2;
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
}
.prop-button svg {
  width: 45px;
  height: 54px;
}
.prop-button:active {
  transform: scale(0.94);
}
.math-tray {
  display: flex;
  flex: 1;
  min-height: 120px;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 2px;
  background: #fffaf0;
  border: 3px dashed #d2b988;
  border-radius: 50% / 18%;
  padding: 16px;
}
.math-workbench output {
  display: block;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  color: #32695a;
  padding-top: 6px;
}
.fraction-board {
  display: flex;
  justify-content: center;
  gap: 4px;
  min-height: 100px;
}
.fraction-piece {
  flex: 1;
  max-width: 80px;
  background: #f6f3e8;
  border: 2px solid #b0bf98;
  border-radius: 8px;
  cursor: pointer;
}
.fraction-piece svg {
  width: 100%;
  opacity: 0.17;
}
.fraction-piece[aria-pressed="true"] {
  background: #ffe2a0;
  border-color: #c78e41;
}
.fraction-piece[aria-pressed="true"] svg {
  opacity: 1;
}
.water-measure {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  max-width: 460px;
  margin: auto;
}
.water-measure button {
  min-height: 40px;
  background: #fbffff;
  border: 1px solid #96c4cd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  color: #255e70;
}
.water-measure button.filled {
  background: #72c9dc;
  box-shadow: inset 0 3px 0 #c5f5fa;
}
.math-target {
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  margin: 8px auto 14px;
  width: max-content;
  min-width: 42px;
  color: #548a81;
}
.math-target hr {
  margin: 1px 0;
  border: 1px solid #548a81;
}
.math-target small {
  font-size: 16px;
}
.math-feedback {
  min-height: 28px;
  color: #4b7f68;
  line-height: 1.55;
  margin: 14px 0 0;
}
.ed-question {
  display: grid;
  grid-template-columns: 25px 1fr 80px 80px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
  padding: 10px;
  background: #edf3ea;
  border-radius: 10px;
}
.ed-question label {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ed-question input,
.ed-question select {
  width: 100%;
  padding: 9px;
  border: 1px solid #bbc8be;
  border-radius: 7px;
}
.math-editor-list {
  max-height: 42vh;
  overflow: auto;
}
.math-editor-list .card-row b {
  font-size: 11px;
}
.math-lesson .form-actions {
  margin-top: 16px;
}
@keyframes math-pop {
  from {
    transform: translateY(-12px);
    opacity: 0.2;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .math-mini {
    animation: none;
  }
}
@media (max-width: 600px) {
  .story-dialogue {
    gap: 14px;
  }
  .story-dialogue > span {
    font-size: 42px;
  }
  .story-dialogue p {
    font-size: 17px;
  }
  .story-banner {
    padding: 15px;
  }
  .story-banner > span {
    font-size: 42px;
  }
  .math-lesson h2 {
    font-size: 20px;
  }
  .math-model {
    padding: 6px;
    gap: 3px;
  }
  .math-mini {
    width: 30px;
    height: 36px;
  }
  .math-workbench {
    padding: 10px;
  }
  .math-supply {
    gap: 8px;
  }
  .prop-button {
    min-width: 52px;
    font-size: 14px;
    padding: 5px;
  }
  .math-tray {
    padding: 8px;
    min-height: 90px;
  }
  .ed-question {
    grid-template-columns: 18px 1fr 50px 50px;
    gap: 5px;
  }
  .water-measure button {
    min-height: 35px;
  }
  .math-phase {
    font-size: 12px;
  }
}
.island-atlas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.island-destination {
  overflow: hidden;
  border: 1px solid #e0ddc9;
  border-radius: 18px;
  background: #fffdf4;
}
.island-destination > div:last-child {
  padding: 16px;
}
.island-destination h3 {
  margin: 0 0 7px;
  font-size: 20px;
}
.island-destination p {
  line-height: 1.5;
  font-size: 14px;
  min-height: 64px;
  margin: 0 0 9px;
}
.island-destination small {
  display: block;
  color: #798775;
  margin-bottom: 10px;
}
.island-destination button {
  width: 100%;
}
.island-vignette {
  height: 140px;
  background: linear-gradient(#dceef3, #edf6e6);
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.island-vignette i {
  position: absolute;
  top: 40px;
  width: 140px;
  height: 65px;
  border-radius: 50%;
  background: var(--island-green);
  transform: rotate(-8deg);
  box-shadow:
    0 12px 0 #b9baa1,
    0 24px 0 -5px #9ba28b,
    0 42px 0 -17px #8d9788;
  z-index: -1;
}
.island-vignette span {
  font-size: 46px;
  line-height: 1;
  font-weight: 800;
  color: var(--island-accent);
  text-shadow: 2px 3px #fffae4;
  transform: translateY(-8px);
}
.island-vignette b {
  position: absolute;
  bottom: 7px;
  font-size: 11px;
  color: #426962;
  letter-spacing: 0.04em;
}
.island-npc-label {
  position: absolute;
  transform: translate(-50%, -100%);
  border: 0;
  background: #fff9dfdd;
  border-radius: 12px;
  padding: 4px 9px;
  color: #376a64;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 2px 7px #293c3433;
}
.island-directory .card-row small {
  max-width: 560px;
  white-space: normal;
  line-height: 1.5;
}
.island-directory .card-row {
  align-items: start;
}
@media (max-width: 540px) {
  .island-atlas-grid {
    grid-template-columns: 1fr;
  }
  .island-vignette {
    height: 115px;
  }
  .island-destination p {
    min-height: 0;
  }
  .island-atlas-grid {
    gap: 12px;
  }
}
/* R8: chart, not a list of destination cards. */
.archipelago {
  color: #325b62;
  margin: -12px;
}
.archipelago header {
  text-align: center;
  padding: 8px 32px 0;
}
.archipelago header small,
.atlas-ticket small {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 800;
  color: #778d86;
}
.archipelago h2 {
  font-size: 30px;
  margin: 6px 0;
  font-family: Georgia, serif;
}
.archipelago header p {
  margin: 5px;
  font-size: 13px;
}
.archipelago-chart {
  position: relative;
  height: min(56vh, 460px);
  min-height: 340px;
  isolation: isolate;
  background: radial-gradient(
    ellipse,
    #eff9f4 0%,
    #dbedf0 63%,
    transparent 72%
  );
}
.atlas-routes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: visible;
}
.atlas-routes path {
  stroke: #94b8b6;
  stroke-width: 0.28;
  stroke-dasharray: 1 1;
  fill: none;
}
.atlas-routes path.selected {
  stroke: #d5a445;
  stroke-width: 0.65;
  animation: atlas-route 6s linear infinite;
}
.atlas-isle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: 170px;
  padding: 0;
  border: 0;
  background: none;
  color: #325b62;
  text-align: center;
  border-radius: 20px;
  cursor: pointer;
  transition: filter 0.2s;
}
.atlas-isle svg {
  width: 100%;
  height: 100px;
  display: block;
  filter: drop-shadow(0 6px 4px #739b9920);
  transition: transform 0.25s;
}
.atlas-isle:hover svg,
.atlas-isle[aria-pressed="true"] svg {
  transform: translateY(-5px);
  filter: drop-shadow(0 6px 6px #d7a34060);
}
.atlas-isle:focus-visible {
  outline: 3px solid #d5a445;
  outline-offset: 2px;
}
.atlas-isle strong {
  display: block;
  font-size: 14px;
}
.atlas-isle small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
}
.hub-isle {
  width: 195px;
}
.hub-isle strong {
  color: #9d7138;
}
.atlas-isle[aria-pressed="true"] strong {
  background: #fff3c5;
  border-radius: 20px;
  padding: 3px;
}
.atlas-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #bcd2cd;
  padding: 16px 10px 0;
}
.atlas-ticket h3 {
  margin: 5px 0;
  font-size: 20px;
}
.atlas-ticket p {
  max-width: 560px;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}
.atlas-ticket button {
  flex-shrink: 0;
  min-width: 150px;
}
.atlas-compass {
  position: absolute;
  right: 1%;
  top: 5%;
  font-size: 35px;
  color: #a1b8af;
  text-align: center;
}
.atlas-compass small {
  display: block;
  font-size: 8px;
  letter-spacing: 3px;
}
.atlas-cloud {
  position: absolute;
  pointer-events: none;
  z-index: -1;
  width: 95px;
  height: 21px;
  background: #ffffffaa;
  border-radius: 50%;
  filter: blur(6px);
  animation: atlas-cloud 9s ease-in-out infinite alternate;
}
.cloud-a {
  left: 28%;
  top: 30%;
}
.cloud-b {
  left: 62%;
  top: 66%;
  animation-delay: -4s;
}
@keyframes atlas-cloud {
  to {
    transform: translateX(20px);
  }
}
@keyframes atlas-route {
  to {
    stroke-dashoffset: -20;
  }
}
@media (max-width: 600px) {
  .archipelago {
    margin: -4px;
  }
  .archipelago h2 {
    font-size: 23px;
  }
  .archipelago-chart {
    height: 430px;
  }
  .atlas-isle {
    width: 88px;
  }
  .atlas-isle svg {
    height: 73px;
  }
  .atlas-isle strong {
    font-size: 12px;
  }
  .atlas-isle small {
    font-size: 9px;
    max-width: 100px;
    margin: 3px auto;
  }
  .hub-isle {
    width: 96px;
  }
  .atlas-ticket {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .atlas-ticket h3 {
    font-size: 17px;
  }
  .atlas-compass {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-cloud,
  .atlas-routes path.selected {
    animation: none;
  }
  .atlas-isle svg {
    transition: none;
  }
}

.atlas-isle > * {
  pointer-events: none;
}
/* Preserve absolute map anchoring when the global button press effect runs. */
.atlas-isle:active {
  transform: translate(-50%, -50%);
}
.cloud-journey {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  background: radial-gradient(ellipse, #fffff7ee, #cce8edf5);
  color: #386763;
  transition: opacity 0.45s;
  pointer-events: all;
}
.cloud-journey span {
  font-size: 66px;
  animation: atlas-cloud 1s ease-in-out infinite alternate;
}
.cloud-journey strong {
  font-size: 21px;
  font-family: Georgia, serif;
}
.cloud-journey.arrived {
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .cloud-journey span {
    animation: none;
  }
  .cloud-journey {
    transition: none;
  }
}
