@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap");
:root {
  font-family: "DM Sans", system-ui, sans-serif;
  color: #183e39;
  background: #faf8f1;
  font-synthesis: none;
  --ink: #183e39;
  --paper: #faf8f1;
  --gold: #f3bf53;
  --line: #d5dace;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  padding: 12px 18px;
  font-weight: 700;
}
button:hover {
  background: #f1f0e5;
  border-color: #648174;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #b36a09;
  outline-offset: 4px;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
}
button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
button.primary:hover {
  background: #28584e;
}
.eyebrow {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.muted {
  color: #50675b;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 36px;
  border-bottom: 1px solid var(--line);
  gap: 15px;
}
.brand {
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand b {
  background: var(--ink);
  color: var(--gold);
  border-radius: 50%;
  font-family: serif;
  width: 38px;
  height: 38px;
  text-align: center;
  line-height: 38px;
}
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.quiet {
  background: transparent;
  border-color: transparent;
  padding: 10px 12px;
  font-size: 14px;
}
.saved {
  font-size: 13px;
  color: #536451;
}
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 42%) 1fr;
  min-height: calc(100vh - 82px);
}
.map-side {
  position: relative;
  min-height: 650px;
  background: #d9dfbe;
  overflow: hidden;
  border-right: 1px solid #b8c4af;
}
.map-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 31% 72%;
  filter: saturate(0.8);
  opacity: 0.85;
}
.map-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(248, 245, 228, 0.96),
    rgba(248, 245, 228, 0.08) 30%,
    rgba(15, 43, 33, 0.05) 55%,
    rgba(15, 43, 33, 0.88)
  );
}
.map-heading {
  position: relative;
  padding: 35px 36px;
}
.map-heading h2 {
  font-size: 34px;
  max-width: 350px;
  line-height: 1.13;
  margin-top: 12px;
}
.map-heading .eyebrow {
  color: #48614b;
}
.route-list {
  position: absolute;
  bottom: 34px;
  left: 36px;
  right: 30px;
  display: grid;
  gap: 10px;
}
.route-stop {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff9dd;
  font-size: 16px;
}
.route-stop .node {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #fff9dd77;
  font-weight: 700;
  background: #244335;
}
.route-stop.current {
  font-weight: 700;
}
.route-stop.current .node {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}
.route-stop.future {
  color: #e0e6da;
}
.route-stop small {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.scene-badge {
  position: absolute;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  background: #fff9e6;
  border: 5px solid #f3bf53;
  box-shadow: 0 10px 40px #183e3933;
  border-radius: 50%;
  height: 114px;
  width: 114px;
  display: grid;
  place-items: center;
  font-size: 58px;
}
.content {
  padding: 32px clamp(26px, 4vw, 70px) 24px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chapter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 25px;
}
.chapter-meta .eyebrow {
  font-size: 12px;
}
.sparks {
  letter-spacing: 6px;
  font-size: 20px;
  color: #976005;
}
.intro h1 {
  font-size: clamp(40px, 4.3vw, 66px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 670px;
  margin: 22px 0;
}
.intro .lede {
  font-size: 21px;
  line-height: 1.55;
  max-width: 580px;
}
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 25px 0;
}
.chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 30px;
  font-size: 14px;
}
.party-row {
  display: flex;
  gap: 10px;
  margin: 26px 0 30px;
}
.party-tile {
  flex: 1;
  min-width: 0;
  padding: 16px 4px;
  text-align: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.party-tile span {
  display: block;
  font-size: 30px;
  margin-bottom: 8px;
}
.party-tile small {
  font-weight: 700;
  display: block;
  overflow-wrap: anywhere;
}
.intro-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.hint {
  font-size: 13px;
  color: #526455;
}
.footer-note {
  margin-top: auto;
  padding-top: 30px;
  font-size: 13px;
  color: #526455;
  line-height: 1.6;
}
.active-party {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #e8eedf;
  border-radius: 10px;
  font-size: 16px;
}
.active-party span {
  font-size: 28px;
}
.active-party small {
  display: block;
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.steps {
  display: flex;
  gap: 5px;
  margin: 22px 0 26px;
}
.steps span {
  height: 5px;
  border-radius: 5px;
  flex: 1;
  background: #dce0d5;
}
.steps .done {
  background: #8ca391;
}
.steps .active {
  background: #b97812;
}
.encounter h1 {
  font-size: clamp(30px, 3.3vw, 49px);
  line-height: 1.12;
  margin: 12px 0 20px;
  letter-spacing: -0.025em;
}
.story {
  font-size: clamp(21px, 2vw, 27px);
  line-height: 1.5;
}
.encounter {
  flex: 1;
}
.stage-label {
  font-size: 13px;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  color: #5e6957;
}
.callout {
  margin: 22px 0;
  padding: 20px 24px;
  background: #eeeede;
  border-left: 4px solid #b67a16;
  border-radius: 0 10px 10px 0;
  font-size: 19px;
  line-height: 1.5;
}
.choices {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.choice {
  font-size: 21px;
  text-align: left;
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 18px 20px;
}
.choice em {
  font-style: normal;
  border: 1px solid #afbeb0;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.choice.selected {
  background: #e2edd8;
  border: 2px solid #315b42;
  padding: 17px 19px;
}
.equation {
  font-size: clamp(34px, 3.5vw, 54px);
  font-weight: 700;
  margin-top: 18px;
}
.objects {
  font-size: 26px;
  line-height: 1.7;
  margin: 14px 0;
  letter-spacing: 2px;
}
.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.bottom-actions .hint {
  max-width: 210px;
}
.target-number {
  display: flex;
  align-items: center;
  gap: 25px;
  margin: 25px 0;
}
.big-number {
  font-size: 100px;
  font-family: "Fraunces", Georgia, serif;
  line-height: 1;
  color: #9a6207;
}
.die {
  width: 140px;
  height: 140px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 88px;
  margin: 24px auto;
  box-shadow: 6px 6px 0 #cbd3c3;
}
.spark-award {
  font-size: 54px;
  margin: 15px 0;
}
.recap {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.recap-row {
  display: flex;
  gap: 15px;
  align-items: center;
  background: #edf0e3;
  border-radius: 9px;
  padding: 15px;
}
.recap-row > span {
  font-size: 27px;
}
.recap-row small {
  display: block;
  margin-top: 4px;
  color: #4a6255;
}
.celebration {
  font-size: 70px;
  margin: 20px 0;
}
.map-modal-image {
  position: relative;
  margin: 20px 0;
}
.map-modal-image img {
  width: 100%;
  display: block;
  border-radius: 12px;
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 3px solid white;
  background: #173f37;
  color: white;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.map-pin.current {
  background: #f3bf53;
  color: #183e39;
}
dialog {
  border: 1px solid #b5c2b1;
  border-radius: 18px;
  padding: 30px;
  width: min(680px, calc(100% - 30px));
  max-height: 90vh;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 25px 100px #001c2266;
}
dialog::backdrop {
  background: #102e2bcc;
}
dialog h2 {
  font-size: 32px;
  margin-bottom: 18px;
}
dialog p {
  font-size: 17px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 15px;
}
.field {
  display: block;
  margin: 14px 0;
  font-weight: 700;
}
.field input,
.field textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid #acbaa7;
  padding: 12px;
  border-radius: 7px;
  background: white;
  color: var(--ink);
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.danger {
  color: #8b2f1b;
}
.print-only {
  display: none;
}
.storage-warning {
  padding: 10px;
  background: #fff0ce;
  color: #573907;
  font-size: 14px;
}
@media (min-width: 1500px) {
  .content {
    padding-top: 45px;
  }
  .story {
    font-size: 28px;
  }
  .encounter h1 {
    font-size: 50px;
  }
  .choice {
    font-size: 25px;
  }
}
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 34% 1fr;
  }
  .map-heading {
    padding: 28px 22px;
  }
  .map-heading h2 {
    font-size: 28px;
  }
  .route-list {
    left: 20px;
    right: 16px;
  }
  .route-stop {
    font-size: 14px;
  }
  .route-stop small {
    display: none;
  }
  .content {
    padding: 26px;
  }
  .topbar {
    padding: 16px 24px;
  }
  .saved {
    display: none;
  }
  .bottom-actions {
    flex-wrap: wrap;
  }
  .bottom-actions .hint {
    max-width: none;
  }
}
@media (max-width: 700px) {
  .layout {
    display: block;
  }
  .map-side {
    min-height: 180px;
    height: 180px;
    border-right: 0;
  }
  .map-heading {
    padding: 20px;
  }
  .map-heading h2 {
    font-size: 26px;
    max-width: 240px;
  }
  .map-wash {
    background: linear-gradient(90deg, #f8f5e4ed, #f8f5e440);
  }
  .route-list {
    display: none;
  }
  .scene-badge {
    left: auto;
    right: 20px;
    top: 45px;
    transform: none;
    width: 84px;
    height: 84px;
    font-size: 40px;
  }
  .topbar {
    padding: 12px 16px;
  }
  .brand {
    font-size: 23px;
  }
  .brand b {
    width: 30px;
    height: 30px;
    line-height: 30px;
  }
  .top-actions {
    gap: 0;
  }
  .quiet {
    padding: 8px;
    font-size: 13px;
  }
  .content {
    padding: 24px 20px;
  }
  .intro h1 {
    font-size: 43px;
  }
  .intro .lede {
    font-size: 19px;
  }
  .party-row {
    gap: 5px;
  }
  .party-tile small {
    font-size: 11px;
  }
  .chapter-meta {
    margin-bottom: 18px;
  }
  .story {
    font-size: 22px;
  }
  .choice {
    font-size: 20px;
  }
  .bottom-actions .primary {
    width: 100%;
  }
  .footer-note {
    padding-top: 24px;
  }
}
/* Keep the challenge and primary action together on classroom projectors. */
@media (min-width: 1001px) and (max-height: 850px) {
  .map-side {
    min-height: calc(100vh - 82px);
  }
  .content {
    padding-top: 22px;
    padding-bottom: 18px;
  }
  .chapter-meta {
    margin-bottom: 14px;
  }
  .active-party {
    padding: 8px 14px;
  }
  .steps {
    margin: 14px 0 16px;
  }
  .encounter h1 {
    font-size: 32px;
    margin: 8px 0 12px;
  }
  .story {
    font-size: 23px;
  }
  .objects {
    font-size: 22px;
    margin: 6px 0;
  }
  .equation {
    font-size: 34px;
    margin-top: 8px;
  }
  .choices {
    gap: 8px;
    margin-top: 14px;
  }
  .choice {
    font-size: 20px;
    padding: 12px 16px;
  }
  .choice.selected {
    padding: 11px 15px;
  }
  .bottom-actions {
    margin-top: 18px;
    padding-top: 16px;
  }
  .intro h1 {
    font-size: 48px;
    margin: 16px 0;
  }
  .intro .lede {
    font-size: 20px;
  }
  .party-row {
    margin: 20px 0;
  }
  .chips {
    margin: 18px 0;
  }
  .footer-note {
    padding-top: 18px;
  }
}
@media print {
  @page {
    size: A4;
    margin: 16mm;
  }
  body {
    background: white;
    color: black;
  }
  .topbar,
  .layout,
  dialog,
  .storage-warning {
    display: none !important;
  }
  .print-only {
    display: block;
    color: black;
    font:
      16px/1.5 Georgia,
      serif;
  }
  .print-only h1 {
    font-size: 30px;
    margin-bottom: 16px;
  }
  .print-only h2 {
    font-size: 22px;
    margin: 20px 0 8px;
  }
  .print-only p {
    margin-bottom: 12px;
  }
  .print-only .write-line {
    border-bottom: 1px solid #777;
    height: 34px;
  }
}
