:root {
  color-scheme: dark;
  --bg: #0c1721;
  --panel: #142531;
  --line: #30414a;
  --ink: #ecede1;
  --muted: #b1c0c0;
  --gold: #e8c47a;
  --teal: #92d4bf;
}
.art-button {
  width: 100%;
  margin: 5px 0;
  font-size: 12px;
  background: #182f3a;
}
.art-button.mastered {
  border-color: #93b89e;
  color: #b7e2bf;
}
body[data-chapter="2"] {
  --gold: #b5c8ff;
  --teal: #b9d5ed;
}
body[data-chapter="3"] {
  --gold: #f0c17d;
  --teal: #adcbb9;
}
#destinations button {
  min-width: 75px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0, #233b47 0, transparent 65%), var(--bg);
  color: var(--ink);
  font:
    15px/1.55 system-ui,
    sans-serif;
}
button,
a {
  touch-action: manipulation;
}
button {
  font: inherit;
  color: var(--ink);
  border: 1px solid #49616a;
  border-radius: 7px;
  padding: 10px 14px;
  min-height: 44px;
  background: #213844;
  cursor: pointer;
  text-align: left;
}
button:hover {
  background: #304b56;
  border-color: var(--gold);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
#world:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
a {
  color: var(--teal);
}
.masthead {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 4vw;
}
.brand {
  text-decoration: none;
  color: var(--ink);
  letter-spacing: 2px;
  font-weight: 800;
  font-size: 12px;
}
.brand span,
.build {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 2px;
}
.masthead button {
  background: transparent;
  border: 0;
}
main {
  max-width: 1500px;
  margin: auto;
  padding: 32px 36px;
}
.chapter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 10px;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.15;
  margin-bottom: 10px;
}
.chapter-heading p:last-child {
  color: var(--muted);
  margin: 0;
}
.chapter-chip {
  border-left: 1px solid #657267;
  padding: 8px 0 8px 22px;
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 2px;
}
.chapter-chip b {
  display: block;
  font-family: Georgia, serif;
  letter-spacing: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 400;
}
.game-grid {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(400px, 2.7fr) minmax(
      210px,
      1fr
    );
  gap: 16px;
  align-items: stretch;
}
.panel {
  background: linear-gradient(140deg, #1a2e39, var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px #0002;
}
.panel-title,
summary {
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 700;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.panel-title h2 {
  font: inherit;
  margin: 0;
}
.panel-title > span {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
}
summary {
  cursor: pointer;
}
.panel-body {
  padding: 20px;
}
.panel h2 {
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 400;
  line-height: 1.3;
}
.panel-title h2 {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid #8e8060;
  background: #403f36;
  color: var(--gold);
  font-size: 30px;
  border-radius: 12px;
  margin-bottom: 14px;
}
.stats h2 {
  margin-bottom: 4px;
}
.stats p {
  font-size: 12px;
}
.rank {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 10px;
  gap: 5px;
}
.rank b {
  color: var(--gold);
}
progress {
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  accent-color: var(--gold);
}
progress::-webkit-progress-bar {
  background: #30434b;
}
progress::-webkit-progress-value {
  background: var(--gold);
}
dl {
  font-size: 12px;
  margin: 20px 0;
}
dl div {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
}
.stats button {
  width: 100%;
  margin-top: 8px;
  font-size: 12px;
}
.stats #save-status {
  margin: 12px 0 0;
  font-size: 10px;
}
.live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  margin-right: 5px;
}
#world {
  aspect-ratio: 24/16;
  background: #14202d;
  position: relative;
}
#world canvas {
  display: block;
  max-width: 100%;
  image-rendering: pixelated;
}
.world-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 10px;
  background: #10212a;
}
#destinations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}
#destinations button {
  padding: 5px 10px;
  font-size: 11px;
  flex: 1;
}
.skill {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.skill > span {
  font-size: 26px;
  color: var(--gold);
}
.skill b {
  display: block;
  font-size: 12px;
}
.skill small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.locked {
  opacity: 0.65;
}
.inventory-label {
  margin-top: 25px;
}
.inventory {
  list-style: none;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}
.inventory li {
  padding: 6px 0;
  display: flex;
  justify-content: space-between;
}
.inventory span {
  color: #778d93;
}
blockquote {
  border-left: 2px solid #756b4e;
  margin: 23px 0 0;
  padding-left: 13px;
  font:
    italic 15px/1.5 Georgia,
    serif;
  color: #d2d0ba;
}
cite {
  display: block;
  font:
    10px system-ui,
    sans-serif;
  color: var(--muted);
  margin-top: 7px;
}
.quests p {
  font-size: 12px;
}
.mini-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 4px;
  padding: 8px;
  background: #0d1c27;
  border: 1px solid #38505a;
  border-radius: 5px;
  margin: 18px 0 7px;
  height: 77px;
}
.mini-map span {
  background: #324956;
  color: #c5d6d3;
  font-size: 9px;
  text-align: center;
  border-radius: 2px;
}
.mini-map i {
  position: absolute;
  width: 7px;
  height: 7px;
  background: var(--gold);
  border: 1px solid white;
  border-radius: 50%;
  left: 50%;
  top: 50%;
}
.dialogue {
  min-height: 320px;
}
.dialogue .panel-body {
  padding: 22px 25px;
}
.dialogue p {
  line-height: 1.8;
}
.dialogue #choices {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
#choices button {
  font-size: 13px;
  display: block;
  width: 100%;
}
#choices button::before {
  content: attr(data-key);
  display: inline-block;
  color: var(--gold);
  font-size: 10px;
  width: 22px;
}
.actions button {
  display: block;
  width: 100%;
  margin-bottom: 10px;
}
.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #1d2b2d;
  font-weight: 700;
}
.primary:hover {
  background: #f7d994;
  color: #18252b;
}
.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0;
  font-size: 10px;
  color: var(--muted);
}
dialog {
  border: 1px solid #7a795f;
  border-radius: 16px;
  background: #172b36;
  color: var(--ink);
  max-width: 620px;
  width: calc(100% - 32px);
  max-height: 90dvh;
  padding: 0;
  box-shadow: 0 25px 100px #0008;
}
dialog::backdrop {
  background: #050d17dd;
  backdrop-filter: blur(6px);
}
.modal-inner {
  padding: 36px;
}
.modal-inner h2 {
  font:
    36px/1.2 Georgia,
    serif;
}
.modal-inner p {
  color: #d2dbd8;
}
#overlay-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.note {
  border-left: 3px solid var(--teal);
  background: #183b3d;
  padding: 14px;
}
.note b {
  color: var(--teal);
}
.evidence {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.evidence div {
  border: 1px solid #5a6d6c;
  background: #11242e;
  padding: 12px;
  font-size: 12px;
}
.evidence b {
  display: block;
  color: var(--gold);
  margin-bottom: 8px;
}
.error {
  padding: 20px;
  color: #ffd6ac;
}
@media (min-width: 1000px) {
  .game-grid {
    grid-template-rows: 480px auto;
  }
  .stats,
  .skills {
    height: 480px;
  }
  .stats .panel-body,
  .skills .panel-body {
    height: calc(100% - 48px);
    overflow-y: auto;
  }
  .stats .panel-body {
    padding: 14px;
  }
  .stats .avatar {
    float: left;
    width: 40px;
    height: 40px;
    margin: 0 12px 8px 0;
    font-size: 25px;
  }
  .stats .rank {
    clear: both;
  }
  .stats dl {
    margin: 12px 0;
  }
  .world {
    display: flex;
    flex-direction: column;
  }
  .world .panel-title,
  .world-footer,
  #destinations {
    flex-shrink: 0;
  }
  #world {
    flex: 1;
    min-height: 0;
    aspect-ratio: auto;
  }
  .stats {
    grid-column: 1;
    grid-row: 1;
  }
  .world {
    grid-column: 2;
    grid-row: 1;
  }
  .skills {
    grid-column: 3;
    grid-row: 1;
  }
  .quests {
    grid-column: 1;
    grid-row: 2;
  }
  .dialogue {
    grid-column: 2;
    grid-row: 2;
  }
  .actions {
    grid-column: 3;
    grid-row: 2;
  }
}
@media (max-width: 999px) {
  main {
    padding: 24px 16px;
  }
  .game-grid {
    grid-template-columns: 1fr 1fr;
  }
  .world,
  .dialogue,
  .actions {
    grid-column: 1/-1;
  }
  .world {
    order: 0;
  }
  .dialogue {
    order: 1;
  }
  .actions {
    order: 2;
  }
  .quests {
    order: 3;
  }
  .stats {
    order: 4;
  }
  .skills {
    order: 5;
  }
  .build {
    display: none;
  }
  .chapter-chip {
    display: none;
  }
  .page-footer {
    flex-direction: column;
    gap: 5px;
  }
  .actions .panel-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .actions button {
    width: auto;
  }
  .actions p {
    width: 100%;
    margin: 0;
  }
  .panel-body {
    padding: 16px;
  }
}
@media (max-width: 560px) {
  .game-grid {
    display: flex;
    flex-direction: column;
  }
  .masthead {
    height: 56px;
  }
  .chapter-heading p:last-child {
    font-size: 12px;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: 1.4px;
  }
  .world-footer span:last-child {
    display: none;
  }
  .dialogue .panel-body {
    padding: 18px;
  }
  .modal-inner {
    padding: 24px;
  }
  .evidence {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 32px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
