@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: #173e36;
  background: #b6d4ce;
  font-synthesis: none;
  --ink: #173e36;
  --gold: #e5a844;
  --paper: #fffcf3;
  --line: #d8dfd0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  border: 1px solid #c5cebd;
  border-radius: 10px;
  background: #fffdf5;
  padding: 12px 17px;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
button:hover {
  background: #f1eedf;
  border-color: #527967;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #ad6500;
  outline-offset: 4px;
}
button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffef6;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  min-height: 49px;
}
button.primary:hover {
  background: #2b5b4d;
}
button.quiet {
  border-color: transparent;
  background: transparent;
  padding: 10px;
  font-size: 14px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
}
a {
  color: inherit;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
}
.muted {
  color: #50685c;
}
.hint {
  font-size: 13px;
  line-height: 1.5;
  color: #526b5f;
}
#world-canvas,
#map-fallback,
.world-shade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
#world-canvas {
  display: block;
  outline: none;
}
#map-fallback {
  background: #bbcca6;
  z-index: 0;
  transition: opacity 0.2s;
}
#map-fallback > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  opacity: 0.85;
}
body.world-ready #map-fallback {
  opacity: 0;
  pointer-events: none;
}
.world-shade {
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    180deg,
    #e5f1eac9,
    transparent 24%,
    transparent 64%,
    #17382b52
  );
}
#game {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  pointer-events: none;
}
#game button,
#game a,
#game input {
  pointer-events: auto;
}
body:not([data-mode="travel"]) #world-canvas {
  pointer-events: none;
}
.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 30px;
  gap: 18px;
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 29px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: #f5c468;
  font-family: Georgia, serif;
}
.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.top-actions button {
  background: #fffcf3e8;
  border: 1px solid #fff9;
}
.progress {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fffcf3ed;
  padding: 8px 16px;
  border-radius: 30px;
  box-shadow: 0 4px 18px #123a2710;
}
.spark {
  font-size: 23px;
  color: #7d6645;
}
.spark.lit {
  color: #a66800;
}
.progress small {
  font-weight: 700;
  margin-left: 8px;
  font-size: 12px;
}
.save-status {
  position: absolute;
  right: 30px;
  top: 82px;
  font-size: 12px;
  color: #204536;
  background: #fffcf3db;
  border-radius: 5px;
  padding: 5px 9px;
}
.story-panel {
  pointer-events: auto;
  background: var(--paper);
  border: 1px solid #e8e1c8;
  border-radius: 20px;
  box-shadow: 0 14px 60px #123b2929;
  padding: 30px;
  max-width: 560px;
}
.welcome-panel {
  position: absolute;
  left: 40px;
  bottom: 42px;
  width: min(540px, calc(100vw - 80px));
}
.welcome-panel h1 {
  font-size: clamp(38px, 4.5vw, 61px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 15px 0 18px;
}
.lede {
  font-size: 20px;
  line-height: 1.5;
}
.tagline {
  font-size: 14px;
  line-height: 1.5;
  margin-top: 20px;
  color: #58715c;
}
.party-strip {
  display: flex;
  gap: 8px;
  margin: 22px 0;
}
.party {
  flex: 1;
  text-align: center;
  min-width: 0;
  padding: 10px 2px;
  border-block: 1px solid #dedfcd;
}
.party span {
  display: block;
  font-size: 25px;
}
.party small {
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 23px;
}
.actions .primary {
  flex-grow: 1;
}
.world-caption {
  position: absolute;
  right: 40px;
  bottom: 42px;
  max-width: 260px;
  background: #fffcf3e8;
  padding: 17px 20px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  pointer-events: auto;
}
.travel-panel {
  position: absolute;
  bottom: 32px;
  left: 32px;
  width: min(490px, calc(100vw - 64px));
  padding: 24px;
}
.travel-panel h1 {
  font-size: 35px;
  line-height: 1.12;
  margin: 12px 0;
}
.travel-panel .lede {
  font-size: 18px;
}
.party-badge {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 15px;
}
.party-badge > span {
  font-size: 27px;
}
.party-badge small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.travel-help {
  position: absolute;
  right: 30px;
  bottom: 30px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 300px;
  background: #fffcf3e8;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  pointer-events: auto;
}
.travel-help kbd {
  font-family: inherit;
  font-weight: 700;
}
.arrival-label {
  display: inline-block;
  padding: 6px 10px;
  background: #e8efd8;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 10px 0 0;
}
.encounter-panel {
  position: relative;
  margin: 12px 30px 28px auto;
  width: min(600px, calc(100vw - 60px));
  max-width: none;
  padding: 27px 30px;
}
.encounter-panel h1 {
  font-size: clamp(29px, 2.8vw, 40px);
  line-height: 1.14;
  letter-spacing: -0.02em;
  margin: 15px 0 18px;
}
.encounter-panel .story {
  font-size: 23px;
  line-height: 1.48;
}
.chapter-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #5f705b;
  text-transform: uppercase;
}
.encounter-party {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 17px;
  margin-bottom: 18px;
}
.turn-dot {
  display: flex;
  gap: 5px;
}
.turn-dot i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d5ddce;
}
.turn-dot i.current {
  background: #a46d13;
}
.callout {
  padding: 17px 20px;
  background: #f0eedf;
  border-left: 3px solid #c88b2c;
  border-radius: 0 10px 10px 0;
  font-size: 18px;
  line-height: 1.5;
  margin: 20px 0;
}
.choices {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
.choice {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 13px;
  padding: 15px 18px;
  font-size: 21px;
}
.choice em {
  font-size: 13px;
  font-style: normal;
  border: 1px solid #aebda7;
  border-radius: 50%;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.choice.selected {
  border: 2px solid #365d43;
  background: #e6efda;
  padding: 14px 17px;
}
.equation {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  margin: 12px 0;
}
.objects {
  font-size: 25px;
  line-height: 1.5;
  letter-spacing: 2px;
  margin: 10px 0;
}
.continue-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 24px;
}
.continue-row .primary {
  flex: 1;
}
.pause-note {
  position: absolute;
  left: 30px;
  bottom: 28px;
  background: #fffcf3e8;
  border-radius: 10px;
  padding: 12px 17px;
  font-size: 14px;
  max-width: 270px;
  line-height: 1.5;
}
.die {
  margin: 20px auto;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: white;
  font-size: 77px;
  line-height: 1;
  box-shadow: 5px 5px 0 #d2dbc5;
}
.target {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 22px 0;
}
.target strong {
  font:
    80px/1 "Fraunces",
    Georgia,
    serif;
  color: #986510;
}
.target p {
  font-size: 21px;
  line-height: 1.4;
}
.reward-panel {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: min(790px, calc(100vw - 60px));
  max-width: none;
  background: #fff8dc;
  padding: 23px 28px;
}
.reward-panel h1 {
  font-size: 33px;
  line-height: 1.15;
  margin: 10px 0;
}
.reward-panel .story {
  font-size: 19px;
  line-height: 1.45;
}
.reward-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.reward-header > span {
  font-size: 35px;
}
.world-change {
  font-weight: 700;
  font-size: 15px;
  color: #476442;
  margin-top: 12px;
}
.reward-panel .continue-row {
  margin-top: 17px;
  padding-top: 15px;
}
.ending-panel {
  margin: 20px auto 30px;
  width: min(650px, calc(100vw - 40px));
  max-width: none;
  text-align: center;
}
.ending-panel h1 {
  font-size: 49px;
  line-height: 1.08;
  margin: 15px 0;
}
.ending-icon {
  font-size: 55px;
}
.recap {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  text-align: left;
}
.recap-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #edf1e1;
  border-radius: 9px;
  font-size: 15px;
}
.recap-row > span {
  font-size: 24px;
}
.recap-row small {
  display: block;
  font-size: 12px;
  margin-top: 3px;
  color: #536d58;
}
.notice {
  position: relative;
  margin: 0 auto 10px;
  width: max-content;
  max-width: 90vw;
  background: #fff4d2;
  padding: 9px 15px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: auto;
}
.map-token {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f9f4df;
  border: 3px solid #315b42;
  color: #173d31;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  transform: translate(-50%, -50%);
}
.map-token.current {
  background: #ffcd66;
  border-color: #71561e;
}
.map-token.done {
  background: #d5e9be;
}
.map-image {
  position: relative;
}
.map-image img {
  width: 100%;
  display: block;
  border-radius: 12px;
}
.map-stops {
  display: grid;
  gap: 8px;
  padding: 15px 0 0;
  list-style: none;
}
.map-stops li {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 15px;
}
.map-stops b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8eddc;
}
.map-stops small {
  margin-left: auto;
  color: #5b725d;
}
.status-pill {
  display: inline-block;
  border-radius: 20px;
  background: #e9efdd;
  padding: 5px 10px;
  font-size: 12px;
  margin-top: 10px;
}
dialog {
  width: min(640px, calc(100vw - 28px));
  max-height: 90svh;
  overflow: auto;
  padding: 28px;
  border: 1px solid #d6ddc8;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 90px #11352b66;
}
dialog::backdrop {
  background: #102d2abb;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 16px;
}
.dialog-head h2 {
  font-size: 31px;
}
dialog p {
  font-size: 17px;
  line-height: 1.5;
  margin: 12px 0;
}
.desk-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}
.field {
  display: block;
  font-weight: 700;
  margin: 14px 0;
  font-size: 16px;
}
.field input,
.field textarea {
  display: block;
  margin-top: 7px;
  width: 100%;
  background: white;
  border: 1px solid #afbea6;
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
}
.danger {
  color: #923e29;
}
.print-only {
  display: none;
}
@media (min-width: 1001px) and (max-height: 800px) {
  .topbar {
    padding: 16px 25px;
  }
  .save-status {
    top: 69px;
  }
  .encounter-panel {
    padding: 20px 26px;
    margin-top: 6px;
    margin-bottom: 18px;
  }
  .encounter-party {
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
  .encounter-panel h1 {
    font-size: 30px;
    margin: 10px 0 12px;
  }
  .encounter-panel .story {
    font-size: 21px;
  }
  .objects {
    font-size: 22px;
    margin: 6px 0;
  }
  .equation {
    font-size: 33px;
    margin: 8px 0;
  }
  .choices {
    gap: 7px;
    margin-top: 14px;
  }
  .choice {
    padding: 11px 16px;
    font-size: 20px;
  }
  .choice.selected {
    padding: 10px 15px;
  }
  .continue-row {
    margin-top: 17px;
    padding-top: 14px;
  }
  .callout {
    padding: 14px 17px;
    margin: 15px 0;
    font-size: 17px;
  }
  .welcome-panel {
    padding: 26px;
    bottom: 25px;
  }
  .welcome-panel h1 {
    font-size: 48px;
  }
  .welcome-panel .lede {
    font-size: 18px;
  }
  .party-strip {
    margin: 16px 0;
  }
  .ending-panel h1 {
    font-size: 39px;
  }
  .ending-icon {
    font-size: 37px;
  }
  .recap {
    gap: 5px;
    margin-top: 15px;
  }
  .recap-row {
    padding: 8px 12px;
  }
  .reward-panel {
    bottom: 22px;
  }
  .reward-panel h1 {
    font-size: 30px;
  }
}
@media (max-width: 1000px) {
  .progress small {
    display: none;
  }
  .spark {
    font-size: 19px;
  }
  .progress {
    gap: 5px;
    padding: 7px 12px;
  }
  .topbar {
    padding: 18px;
  }
  .encounter-panel {
    width: min(570px, calc(100vw - 36px));
    margin-right: 18px;
  }
  .pause-note {
    display: none;
  }
  .world-caption {
    right: 25px;
    max-width: 230px;
  }
  .welcome-panel {
    left: 25px;
    width: min(500px, calc(100vw - 50px));
  }
  .travel-help {
    max-width: 220px;
    right: 20px;
  }
  .travel-panel {
    width: min(450px, calc(100vw - 40px));
    left: 20px;
  }
  .save-status {
    right: 20px;
    top: 76px;
  }
  .encounter-panel h1 {
    font-size: 31px;
  }
}
@media (max-width: 700px) {
  .topbar {
    padding: 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .brand {
    font-size: 25px;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
  }
  .progress {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
    padding: 4px;
    max-width: 180px;
    margin: auto;
  }
  .progress small {
    display: block;
  }
  .top-actions {
    margin-left: auto;
  }
  .top-actions button {
    padding: 9px;
    font-size: 12px;
  }
  .save-status {
    display: none;
  }
  .welcome-panel,
  .travel-panel {
    position: relative;
    left: auto;
    bottom: auto;
    width: calc(100% - 24px);
    margin: 32svh auto 18px;
    padding: 23px;
  }
  .welcome-panel h1 {
    font-size: 43px;
  }
  .world-caption,
  .travel-help {
    display: none;
  }
  .welcome-panel .lede {
    font-size: 18px;
  }
  .party-strip {
    gap: 3px;
  }
  .party small {
    font-size: 10px;
  }
  .encounter-panel {
    width: calc(100% - 24px);
    margin: 18px auto;
    padding: 21px;
  }
  .encounter-panel h1 {
    font-size: 28px;
  }
  .encounter-panel .story {
    font-size: 21px;
  }
  .choice {
    font-size: 19px;
    padding: 13px 14px;
  }
  .choice.selected {
    padding: 12px 13px;
  }
  .continue-row {
    gap: 9px;
  }
  .continue-row .hint {
    flex-basis: 100%;
  }
  .reward-panel {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    margin: 32svh auto 18px;
    width: calc(100% - 24px);
    padding: 23px;
  }
  .reward-panel h1 {
    font-size: 29px;
  }
  .ending-panel {
    margin-top: 20px;
    width: calc(100% - 24px);
    padding: 22px;
  }
  .ending-panel h1 {
    font-size: 40px;
  }
  .desk-actions {
    grid-template-columns: 1fr;
  }
  .notice {
    margin-top: 10px;
  }
  .objects {
    font-size: 21px;
  }
  .world-shade {
    background: linear-gradient(180deg, #e5f1eacc, transparent 35%, #17382b33);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
@media print {
  @page {
    size: A4;
    margin: 15mm;
  }
  body {
    background: white;
    color: black;
  }
  #world-canvas,
  #map-fallback,
  .world-shade,
  .topbar,
  .story-panel,
  .world-caption,
  .travel-help,
  .pause-note,
  .notice,
  .save-status,
  dialog {
    display: none !important;
  }
  #game {
    min-height: 0;
  }
  .print-only {
    display: block;
    color: black;
    font:
      15px/1.45 Georgia,
      serif;
  }
  .print-only h1 {
    font-size: 27px;
    margin: 12px 0;
  }
  .print-only h2 {
    font-size: 19px;
    margin: 16px 0 6px;
  }
  .print-only p {
    margin-bottom: 10px;
  }
  .write-line {
    height: 26px;
    border-bottom: 1px solid #777;
  }
}
