:root {
  --ink: #173b3f;
  --ink-soft: #496466;
  --deep: #12353a;
  --paper: #f5eedf;
  --paper-light: #fffaf0;
  --cream: #efe2c7;
  --sun: #e9bd68;
  --coral: #d96d4b;
  --rose: #c85c76;
  --green: #62826f;
  --green-strong: #4f8b70;
  --green-glow: #9ee0b7;
  --wrong: #c95f55;
  --line: rgba(23, 59, 63, 0.16);
  --shadow: 0 22px 60px rgba(42, 52, 45, 0.16);
  --serif: "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(217, 109, 75, 0.45);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.paper-noise {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(23, 59, 63, 0.16) 0 0.5px, transparent 0.7px),
    radial-gradient(circle at 72% 64%, rgba(217, 109, 75, 0.12) 0 0.5px, transparent 0.8px);
  background-size: 9px 11px, 13px 15px;
  mix-blend-mode: multiply;
}

.eyebrow,
.section-index,
.top-kicker {
  margin: 0;
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.top-kicker {
  letter-spacing: 0.12em;
}

.welcome-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.82fr) minmax(520px, 1.18fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 16%, rgba(255, 250, 229, 0.35), transparent 15%),
    linear-gradient(115deg, #f5ead5 0%, #ecdec2 48%, #194c50 48%, #12383d 100%);
}

.welcome-screen::before {
  content: "";
  position: absolute;
  left: -10%;
  bottom: -130px;
  width: 62%;
  height: 290px;
  border-radius: 50%;
  background: #cf744c;
  transform: rotate(5deg);
  opacity: 0.88;
}

.welcome-screen::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: auto 0 0 43%;
  height: 28%;
  background:
    linear-gradient(152deg, transparent 0 18%, rgba(11, 43, 47, 0.7) 18% 22%, transparent 22%),
    linear-gradient(28deg, transparent 0 34%, rgba(13, 47, 50, 0.82) 34% 38%, transparent 38%);
  opacity: 0.75;
}

.welcome-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: 74px 8vw 90px;
}

.welcome-copy .eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
}

.welcome-copy .eyebrow span {
  display: inline-block;
  width: 38px;
  height: 2px;
  background: currentColor;
}

.welcome-copy h1 {
  max-width: 610px;
  margin: 24px 0 18px;
  color: var(--deep);
  font-family: var(--serif);
  font-size: clamp(74px, 8.3vw, 128px);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 0.86;
}

.welcome-copy h1 em {
  color: var(--coral);
  font-style: normal;
}

.welcome-copy h1 span {
  display: block;
  margin-top: 20px;
  color: var(--deep);
  font-size: .38em;
  letter-spacing: .04em;
  line-height: 1.15;
}

.welcome-subtitle {
  margin: 0;
  color: #4d625f;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.8;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 36px;
}

.primary-button {
  min-width: 260px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 16px 18px 16px 22px;
  color: #fffaf0;
  border: 0;
  border-radius: 2px;
  background: var(--deep);
  box-shadow: 8px 8px 0 rgba(217, 109, 75, 0.28);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 12px 12px 0 rgba(217, 109, 75, 0.28);
}

.button-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--deep);
  background: var(--sun);
  font-size: 20px;
}

.reset-button {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: none;
  cursor: pointer;
}

.save-note {
  margin: 25px 0 0;
  color: #75827c;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.welcome-art {
  position: relative;
  z-index: 2;
  min-height: 680px;
}

.welcome-art > img {
  position: absolute;
  inset: 7% 4% 8% 2%;
  width: 94%;
  height: 85%;
  object-fit: cover;
  border: 1px solid rgba(245, 226, 188, 0.48);
  box-shadow: 0 32px 70px rgba(6, 29, 30, 0.42);
  filter: saturate(0.9) sepia(0.08);
}

.art-caption {
  position: absolute;
  right: 6%;
  bottom: 12%;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 3px 10px;
  color: #f8ead2;
}

.art-caption b {
  color: var(--sun);
  font-family: var(--serif);
  font-size: 26px;
}

.art-caption span {
  font-size: 11px;
  letter-spacing: 0.12em;
}

.art-caption i {
  grid-column: 1 / -1;
  width: 100%;
  height: 1px;
  margin: 5px 0;
  background: rgba(248, 234, 210, 0.28);
}

.welcome-footer {
  position: absolute;
  z-index: 4;
  right: 3.5%;
  bottom: 24px;
  left: 3.5%;
  display: flex;
  justify-content: space-between;
  color: rgba(247, 234, 211, 0.68);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.game-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #efe7d8;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 22px;
  color: #f7eedc;
  background:
    radial-gradient(circle at 10% 20%, rgba(98, 130, 111, 0.26), transparent 28%),
    var(--deep);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(245, 238, 223, 0.5);
  border-radius: 50% 50% 46% 54%;
  color: var(--sun);
  font-family: var(--serif);
  font-size: 20px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.15;
  letter-spacing: 0.14em;
}

.brand-name b { color: var(--sun); font-weight: 700; }

.top-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 0;
  border-radius: 4px;
  color: rgba(247, 238, 220, 0.65);
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: #fffaf0;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active { box-shadow: inset 0 -3px 0 var(--sun); }
.nav-icon { color: var(--sun); font-family: var(--serif); font-size: 16px; }
.nav-icon-image {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}
.nav-icon-image img { width: 16px; height: 16px; object-fit: contain; }

.game-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
}

.game-body:has(> .side-panel.hidden) {
  grid-template-columns: minmax(0, 1fr);
}

.game-body:has(> .side-panel.hidden) .main-stage {
  padding-right: 22px;
}

.main-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px 0 20px 22px;
}

#mapView.active {
  display: flex;
  flex: 1;
  min-height: 0;
}

.side-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 22px 20px 16px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.mini-stat {
  display: grid;
  grid-template-columns: 16px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 6px;
  text-align: left;
}

.mini-stat > span {
  grid-row: 1 / 3;
  color: var(--sun);
  font-size: 14px;
}

.mini-stat small { color: rgba(247, 238, 220, 0.54); font-size: 10px; letter-spacing: 0.1em; }
.mini-stat b { color: #fffaf0; font-family: var(--serif); font-size: 16px; line-height: 1.1; }

.round-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #fffaf0;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.round-button:hover {
  border-color: rgba(233, 189, 104, 0.6);
  background: rgba(255, 255, 255, 0.15);
}

.reset-button {
  padding: 4px 0;
  color: rgba(247, 238, 220, 0.45);
  border-bottom-color: rgba(247, 238, 220, 0.18);
  font-size: 12px;
  transition: color 160ms ease, border-color 160ms ease;
}

.reset-button:hover {
  color: #fffaf0;
  border-bottom-color: currentColor;
}

.view {
  display: none;
  animation: reveal 320ms ease both;
}

.view.active { display: block; }

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
  padding: 20px 22px 20px 0;
}

.page-heading h3 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.page-heading > p {
  max-width: 430px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
  text-align: right;
}

.map-board {
  position: relative;
  overflow: hidden;
}

.location-node {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  text-align: center;
  cursor: pointer;
}

.player {
  position: absolute;
  z-index: 9;
  width: 34px;
  height: 58px;
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.player-halo {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 46px;
  height: 14px;
  border: 1px solid rgba(217, 109, 75, 0.55);
  border-radius: 50%;
  transform: translateX(-50%);
  background: rgba(255, 250, 240, 0.22);
}

.player small {
  position: absolute;
  left: 50%;
  top: 55px;
  width: max-content;
  padding: 2px 5px;
  transform: translateX(-50%);
  color: #fffaf0;
  border-radius: 2px;
  background: var(--deep);
  font-size: 8px;
}

.npc-token {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.location-story {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-light);
  box-shadow: 0 8px 20px rgba(42, 52, 45, 0.07);
}

.story-number {
  color: var(--coral);
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1;
}

.location-story p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.location-story h4 { margin: 3px 0 5px; font-family: var(--serif); font-size: 21px; }

.dock-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.dock-button {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 250, 240, 0.55);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border 160ms ease;
}

.dock-button:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: rgba(217, 109, 75, 0.45);
  background: rgba(255, 250, 240, 0.95);
}

.dock-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.52;
}

.dock-symbol {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-family: var(--serif);
  font-size: 17px;
}

.event-button .dock-symbol { background: var(--coral); }
.dock-button small { display: block; color: var(--ink-soft); font-size: 11px; }
.dock-button b { display: block; overflow: hidden; margin-top: 3px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

/* RPG exploration layer */
.map-board {
  flex: 1;
  min-height: 0;
  isolation: isolate;
  border: 2px solid #402e22;
  border-radius: 7px;
  background-color: #213a35;
  background-image:
    linear-gradient(180deg, rgba(17, 36, 34, 0.04), rgba(12, 29, 29, 0.2)),
    url("./assets/art/fairytale-town-map.png");
  background-position: center;
  background-size: cover;
  box-shadow: 0 28px 70px rgba(24, 35, 31, 0.32), inset 0 0 0 4px rgba(244, 215, 160, 0.22);
  cursor: url("./assets/kenney-ui/cursor_hand.png") 5 2, pointer;
}

.map-board::before {
  content: "";
  position: absolute;
  z-index: 10;
  inset: 0;
  border-radius: 4px;
  box-shadow: inset 0 0 0 3px rgba(255, 237, 193, 0.16), inset 0 0 90px rgba(8, 25, 25, 0.16);
  pointer-events: none;
}

.map-vignette {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 44%, rgba(12, 28, 27, 0.24) 100%);
}

.rpg-panel {
  color: #fff6df;
  border: 14px solid transparent;
  border-image: url("./assets/kenney-ui/panel_brown.png") 24 fill stretch;
  filter: drop-shadow(0 8px 12px rgba(13, 22, 19, 0.32));
}

.player-hud {
  position: absolute;
  z-index: 20;
  top: 15px;
  left: 15px;
  width: 266px;
  min-height: 88px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 1px 4px 2px;
  pointer-events: none;
}

.hud-avatar {
  width: 56px;
  height: 56px;
  overflow: hidden;
  align-self: center;
  border: 2px solid #cfaa68;
  background: #172e2e;
}

.hud-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.hud-copy { min-width: 0; }
.hud-copy p { margin: 0; color: #d7ba83; font-size: 11px; letter-spacing: 0.1em; }
.hud-copy h4 { margin: 2px 0 5px; font-size: 20px; }

.hud-bar {
  height: 9px;
  overflow: hidden;
  margin-top: 4px;
  border-inline: 5px solid transparent;
  border-image: url("./assets/kenney-ui/bar_back_mid.png") 4 fill stretch;
}

.hud-bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: url("./assets/kenney-ui/bar_green_mid.png") center / auto 100% repeat-x;
  transition: width 220ms ease;
}

.hud-bar.blue > span { background-image: url("./assets/kenney-ui/bar_blue_mid.png"); }

.quest-tracker {
  flex: 1 1 240px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-light);
  box-shadow: 0 8px 20px rgba(42, 52, 45, 0.07);
}

.rpg-label {
  margin: 0;
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.quest-tracker h4 { margin: 6px 0 12px; font-family: var(--serif); font-size: 21px; }

.quest-overview {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 59, 63, 0.1);
  border-radius: 4px;
  background: rgba(23, 59, 63, 0.04);
}
.quest-overview > div:first-child { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.quest-overview b { color: var(--deep); font-family: var(--serif); }
.quest-progress-bar { height: 8px; overflow: hidden; margin-top: 8px; border-radius: 99px; background: rgba(23, 59, 63, 0.1); }
.quest-progress-bar span { display: block; width: 0; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green-strong), var(--sun)); transition: width 220ms ease; }
.quest-task-groups { flex: 1 1 auto; min-height: 0; display: grid; gap: 14px; align-content: start; overflow: auto; padding: 2px 4px 8px 0; scrollbar-color: rgba(23, 59, 63, 0.25) transparent; }
.quest-task-group { display: grid; gap: 6px; }
.quest-group-title { display: flex; justify-content: space-between; align-items: center; color: var(--coral); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.quest-group-title b { color: var(--ink); font-family: var(--serif); font-size: 13px; }
.quest-task-row {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  color: var(--ink);
  border: 1px solid rgba(23, 59, 63, 0.12);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.65);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.quest-task-row:hover { border-color: rgba(217, 109, 75, 0.45); background: #fffaf0; transform: translateY(-1px); }
.quest-task-row.done { opacity: .68; }
.quest-task-row img { width: 16px; height: 16px; image-rendering: pixelated; }
.quest-task-row span { min-width: 0; }
.quest-task-row b { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.quest-task-row small { display: block; overflow: hidden; margin-top: 2px; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.quest-task-row em { color: var(--coral); font-size: 11px; font-style: normal; white-space: nowrap; }
.quest-task-row.done em { color: var(--green-strong); }
.quest-more { margin: 2px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.quest-open-note { flex: 0 0 auto; margin: 12px 0 0; padding-top: 10px; color: var(--ink-soft); border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }

.minimap {
  position: absolute;
  z-index: 20;
  top: 15px;
  right: 15px;
  width: 188px;
  padding: 0 2px 3px;
}

.minimap-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 12px; letter-spacing: 0.08em; }
.minimap-title kbd { padding: 1px 4px; color: #253f38; border: 0; background: #e6d09d; font-family: inherit; font-size: 10px; }
.minimap-map {
  position: relative;
  height: 82px;
  overflow: hidden;
  border: 2px solid #a8874f;
  background-image: linear-gradient(rgba(8, 25, 24, 0.2), rgba(8, 25, 24, 0.2)), url("./assets/art/fairytale-town-map.png");
  background-position: center;
  background-size: cover;
}

.minimap-location,
.minimap-player {
  position: absolute;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border: 1px solid #fff0c9;
  border-radius: 50%;
  background: #c86a46;
}

.minimap-location.current { width: 9px; height: 9px; background: var(--sun); box-shadow: 0 0 0 3px rgba(233, 189, 104, 0.28); }
.minimap-player { z-index: 2; width: 6px; height: 6px; border-color: white; background: #5ab6ae; box-shadow: 0 0 0 2px rgba(26, 54, 50, 0.8); transition: left 180ms ease, top 180ms ease; }

.location-node {
  z-index: 8;
  width: 152px;
  min-height: 88px;
  padding: 0;
  color: #fff6df;
  filter: drop-shadow(0 4px 6px rgba(14, 30, 27, 0.4));
}

.location-node .location-pin {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  margin: 0 auto 2px;
  border: 7px solid transparent;
  border-image: url("./assets/kenney-ui/button_square_beige.png") 12 fill stretch;
  transition: transform 160ms ease;
}

.location-pin img { width: 13px; height: 13px; image-rendering: pixelated; }
.location-node:hover .location-pin { transform: translateY(-4px) scale(1.08); }
.location-node strong {
  display: inline-block;
  min-width: 0;
  margin: 0;
  padding: 5px 10px;
  color: #fff7e5;
  border: 1px solid rgba(245, 218, 165, 0.6);
  border-radius: 1px;
  background: rgba(19, 45, 41, 0.9);
  box-shadow: 0 3px 8px rgba(10, 23, 21, 0.28);
  font-family: var(--sans);
  font-size: 14px;
  white-space: nowrap;
}

.location-node small { display: none; }
.location-node.current .location-pin { transform: translateY(-4px) scale(1.12); filter: drop-shadow(0 0 9px #f0c66f); }
.location-node.current strong { color: #342819; border-color: #f5deb0; background: var(--sun); }

.player {
  z-index: 14;
  width: 43px;
  height: 70px;
  transition: left 220ms ease-out, top 220ms ease-out;
}

.player img {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(10, 25, 22, 0.42));
}

.player-halo { bottom: 0; width: 40px; height: 12px; border: 2px solid rgba(244, 200, 108, 0.8); background: rgba(255, 233, 170, 0.18); }
.player small { z-index: 4; top: 66px; padding: 2px 6px; border: 1px solid rgba(245, 222, 176, 0.55); background: rgba(18, 48, 44, 0.92); font-size: 13px; }

.npc-token {
  z-index: 13;
  width: auto;
  height: auto;
  display: grid;
  grid-template-columns: 18px auto;
  gap: 5px;
  padding: 5px 8px 5px 6px;
  color: #fff7e7;
  border: 1px solid rgba(247, 221, 169, 0.72);
  border-radius: 2px;
  background: rgba(27, 54, 49, 0.93);
  box-shadow: 0 6px 15px rgba(15, 29, 26, 0.38);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 800;
  animation: npc-float 2.7s ease-in-out infinite;
}

.npc-token img { width: 16px; height: 15px; image-rendering: pixelated; }
.npc-token:hover { color: #2f2618; border-color: #fff0c9; background: var(--sun); }

.interaction-prompt {
  position: absolute;
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -100%);
  padding: 5px 8px;
  color: #fff7e5;
  border: 1px solid rgba(246, 219, 164, 0.74);
  background: rgba(14, 40, 37, 0.92);
  box-shadow: 0 6px 14px rgba(11, 25, 23, 0.34);
  font-size: 12px;
  pointer-events: none;
}

.interaction-prompt kbd { display: grid; width: 19px; height: 19px; place-items: center; color: #342719; border: 0; background: var(--sun); font-family: inherit; font-size: 9px; font-weight: 900; }

.dialogue-panel {
  position: absolute;
  z-index: 26;
  right: 18%;
  bottom: 73px;
  left: 18%;
  min-height: 112px;
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 2px 7px;
}

.dialogue-name { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding-right: 12px; border-right: 1px solid rgba(240, 205, 139, 0.28); }
.dialogue-name small { color: #d1ae6c; font-size: 11px; letter-spacing: 0.12em; }
.dialogue-name strong { margin-top: 4px; color: #fff4d9; font-size: 20px; }
.dialogue-panel > p { margin: 0; color: rgba(255, 248, 230, 0.84); font-size: 15px; line-height: 1.7; }
.dialogue-actions { display: grid; gap: 4px; }
.dialogue-actions button {
  min-width: 92px;
  min-height: 29px;
  padding: 4px 9px 7px;
  color: #3b2b1d;
  border: 7px solid transparent;
  border-image: url("./assets/kenney-ui/button_long_beige.png") 11 fill stretch;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease;
}

.dialogue-actions button:hover { transform: translateY(-2px); }
.dialogue-actions button:active { border-image-source: url("./assets/kenney-ui/button_long_beige_pressed.png"); }
.dialogue-actions .dialogue-close { color: rgba(255, 246, 223, 0.68); border-image: none; background: transparent; }

.rpg-hotbar {
  position: absolute;
  z-index: 24;
  bottom: 14px;
  left: 50%;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.rpg-hotbar button {
  position: relative;
  width: 70px;
  height: 59px;
  padding: 5px 4px 7px;
  color: #3d2d1e;
  border: 10px solid transparent;
  border-image: url("./assets/kenney-ui/button_square_beige.png") 11 fill stretch;
  background: transparent;
  cursor: pointer;
  transition: transform 120ms ease;
}

.rpg-hotbar button:hover { transform: translateY(-3px); }
.rpg-hotbar button:active { border-image-source: url("./assets/kenney-ui/button_square_beige_pressed.png"); }
.rpg-hotbar button.active { filter: drop-shadow(0 0 8px rgba(244, 199, 105, 0.88)); }
.rpg-hotbar kbd { position: absolute; top: -8px; left: -5px; display: grid; width: 18px; height: 18px; place-items: center; color: #fff4d9; border: 1px solid #967444; background: #183c38; font-family: inherit; font-size: 8px; }
.rpg-hotbar span { display: block; font-size: 12px; font-weight: 900; }

.mobile-dpad { display: none; }

@keyframes npc-float {
  50% { transform: translate(-50%, calc(-50% - 5px)); }
}

.filter-row {
  display: flex;
  gap: 8px;
  padding: 4px 0 20px;
}

.filter-chip {
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.filter-chip.active {
  color: #fffaf0;
  border-color: var(--deep);
  background: var(--deep);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.memory-card {
  position: relative;
  min-height: 255px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(23, 59, 63, 0.17);
  border-radius: 4px;
  background: var(--paper-light);
  box-shadow: 0 8px 20px rgba(42, 52, 45, 0.07);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.memory-card:hover {
  transform: translateY(-5px) rotate(-0.5deg);
  box-shadow: 0 16px 28px rgba(42, 52, 45, 0.13);
}

.memory-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 90px;
  height: 90px;
  border: 1px solid var(--card-color, var(--green));
  border-radius: 50%;
  opacity: 0.3;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  color: var(--card-color, var(--coral));
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.card-portrait {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 20px 0 16px;
  border-radius: 50% 46% 52% 48%;
  color: #fff;
  background: var(--card-color, var(--green));
  box-shadow: 6px 6px 0 rgba(23, 59, 63, 0.09);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 900;
}

.memory-card h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
}

.memory-card > p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.6;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
}

.card-tags span {
  padding: 3px 7px;
  border-radius: 99px;
  background: rgba(23, 59, 63, 0.07);
  font-size: 11px;
}

.content-disclaimer {
  margin-top: 26px;
  padding: 14px 0;
  color: #7d837b;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

#mapView.active ~ .content-disclaimer { display: none; }

.review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 10px;
}

.review-legend span { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 8px; height: 8px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: #a6a69c; }
.status-dot.mastered { background: var(--green-strong); box-shadow: 0 0 0 3px rgba(79, 139, 112, 0.12); }
.status-dot.pending { background: #b3a58b; }
.status-dot.wrong { background: var(--wrong); box-shadow: 0 0 0 3px rgba(201, 95, 85, 0.12); }

.timeline-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.timeline-chapter {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 170px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 250, 240, 0.72);
}

.timeline-chapter > header {
  padding: 20px 16px;
  color: #fff8e8;
  background: var(--deep);
}

.timeline-chapter > header span { color: var(--sun); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.timeline-chapter > header h4 { margin: 8px 0 24px; font-family: var(--serif); font-size: 21px; }
.timeline-chapter > header small { color: rgba(255, 248, 232, .62); font-size: 9px; }
.timeline-events { display: grid; align-content: start; padding: 9px; }

.timeline-event {
  width: 100%;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 9px;
  border: 0;
  border-bottom: 1px solid rgba(23, 59, 63, .09);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.timeline-event:hover { background: rgba(233, 189, 104, .1); }
.timeline-event .status-dot { margin-top: 4px; }
.timeline-event b { display: block; font-family: var(--serif); font-size: 13px; }
.timeline-event small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 8px; }

.network-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, .58);
  font-size: 13px;
}

.network-toolbar label { color: var(--coral); font-weight: 800; letter-spacing: .08em; }
.network-toolbar select { min-width: 290px; padding: 10px 34px 10px 12px; color: var(--ink); border: 1px solid var(--line); background: var(--paper-light); font-size: 13px; }
.network-toolbar span { margin-left: auto; color: var(--ink-soft); }
.network-board { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.graph-column { min-width: 0; }
.network-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 10px; color: var(--ink-soft); font-size: 12px; }
.network-legend span { display: inline-flex; align-items: center; gap: 6px; }
.network-legend i { width: 18px; height: 3px; display: inline-block; background: var(--legend-color); }
.graph-viewport { overflow: auto; border-radius: 6px; }

.relationship-graph {
  position: relative;
  min-width: 640px;
  height: 620px;
  overflow: hidden;
  border: 1px solid rgba(23, 59, 63, .22);
  border-radius: 6px;
  background:
    linear-gradient(rgba(245, 238, 223, .9), rgba(245, 238, 223, .94)),
    url("./assets/art/fairytale-town-map.png") center / cover;
  box-shadow: inset 0 0 70px rgba(23, 59, 63, .08);
}

.relationship-lines { position: absolute; z-index: 1; inset: 0; pointer-events: none; }

.graph-node {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  border-radius: 5px;
  text-align: center;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.graph-node:hover,
.graph-node:focus-visible { z-index: 4; transform: translate(-50%, -50%) scale(1.06); }

.graph-node small,
.graph-node b { display: block; }

.graph-node-center {
  width: 140px;
  min-height: 96px;
  padding: 17px 13px;
  color: #fff8e8;
  border: 2px solid var(--sun);
  background: var(--deep);
  box-shadow: 0 16px 34px rgba(18, 53, 58, .28);
  cursor: default;
}

.graph-node-center small { color: var(--sun); font-size: 11px; letter-spacing: .1em; }
.graph-node-center b { margin-top: 8px; font-family: var(--serif); font-size: 25px; }
.graph-node-person {
  width: 122px;
  min-height: 68px;
  padding: 10px 8px;
  color: var(--ink);
  border: 2px solid var(--relation-color, var(--green));
  background: rgba(255, 250, 240, .96);
  box-shadow: 0 7px 16px rgba(42, 52, 45, .11);
}

.graph-node-person small { color: var(--relation-color, var(--green)); font-size: 10px; font-weight: 800; }
.graph-node-person b { margin-top: 5px; overflow: hidden; font-family: var(--serif); font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.graph-node-person.selected { z-index: 3; color: #fff8e8; border-color: var(--relation-color); background: var(--deep); box-shadow: 0 0 0 4px rgba(233, 189, 104, .5), 0 14px 28px rgba(18, 53, 58, .28); }
.graph-node-person.selected small { color: var(--sun); }

.network-inspector {
  position: sticky;
  top: 16px;
  min-height: 360px;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--relation-color, var(--green));
  border-radius: 5px;
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.network-inspector .relation-type { color: var(--relation-color, var(--green)); font-size: 12px; font-weight: 800; }
.network-inspector > h4 { margin: 16px 0 10px; font-family: var(--serif); font-size: 21px; line-height: 1.35; }
.network-inspector > p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.75; }
.inspector-fact { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.inspector-fact small { display: block; margin-bottom: 6px; color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.inspector-fact p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.inspector-actions { display: grid; gap: 8px; margin-top: 22px; }

.wrong-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wrong-card { display: flex; min-height: 260px; flex-direction: column; padding: 20px; border: 1px solid rgba(201, 95, 85, .28); border-top: 4px solid var(--wrong); background: var(--paper-light); }
.wrong-card > div span { color: var(--wrong); font-size: 8px; letter-spacing: .1em; }
.wrong-card h4 { margin: 7px 0 0; font-family: var(--serif); font-size: 21px; }
.wrong-card p { color: var(--ink-soft); font-size: 11px; line-height: 1.7; }
.wrong-card small { margin-top: auto; color: #8a8275; font-size: 8px; }
.wrong-card button { align-self: flex-start; margin-top: 15px; }

.review-empty {
  padding: 28px;
  border: 1px dashed rgba(23, 59, 63, .25);
  background: rgba(255, 250, 240, .48);
  text-align: center;
}

.review-empty.wide { grid-column: 1 / -1; min-height: 250px; display: grid; place-items: center; align-content: center; }
.review-empty h4 { margin: 0; font-family: var(--serif); font-size: 21px; }
.review-empty p { margin: 8px 0 18px; color: var(--ink-soft); font-size: 11px; }

.achievement-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.achievement-card { position: relative; min-height: 180px; padding: 20px; border: 1px solid var(--line); background: rgba(255, 250, 240, .62); opacity: .72; }
.achievement-card.achieved { border-color: rgba(217, 109, 75, .42); background: var(--paper-light); box-shadow: 0 12px 24px rgba(42, 52, 45, .08); opacity: 1; }
.achievement-index { color: var(--coral); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.achievement-card h4 { margin: 16px 0 5px; font-family: var(--serif); font-size: 21px; }
.achievement-card p { min-height: 34px; margin: 0; color: var(--ink-soft); font-size: 9px; line-height: 1.65; }
.achievement-progress { height: 5px; overflow: hidden; margin: 18px 0 8px; background: rgba(23, 59, 63, .1); }
.achievement-progress span { height: 100%; display: block; background: var(--coral); }
.achievement-card small { color: #857c6d; font-size: 8px; }
.detail-quiz-button { margin-top: 8px; }

/* Readability pass: raise the small-print baseline without changing the layout hierarchy. */
body { font-size: 15px; }
.eyebrow, .section-index, .top-kicker { font-size: 13px; }
.journey-meter small, .stat-pair small { font-size: 11px; }
.journey-meter strong { font-size: 14px; }
.nav-item { font-size: 14px; }
.nav-item i { font-size: 11px; }
.reset-button { font-size: 12px; }
.mini-stat small { font-size: 10px; }
.page-heading > p { font-size: 14px; }
.filter-chip { font-size: 13px; }
.card-meta { font-size: 11px; }
.memory-card > p { font-size: 12px; line-height: 1.7; }
.content-disclaimer { font-size: 11px; }
.review-legend { font-size: 12px; }
.timeline-chapter > header span, .timeline-chapter > header small { font-size: 11px; }
.timeline-event b { font-size: 15px; }
.timeline-event small { font-size: 10px; }
.wrong-card > div span { font-size: 10px; }
.wrong-card p { font-size: 13px; }
.wrong-card small { font-size: 10px; }
.review-empty p { font-size: 13px; }
.achievement-index { font-size: 11px; }
.achievement-card p { font-size: 12px; }
.achievement-card small { font-size: 10px; }

/* Location progress badges and lit-up states. */
.location-progress {
  width: max-content;
  max-width: 148px;
  display: grid;
  gap: 1px;
  margin: 3px auto 0;
  padding: 3px 7px;
  color: #fff5df;
  border: 1px solid rgba(245, 218, 165, .46);
  background: rgba(13, 38, 35, .88);
  box-shadow: 0 3px 8px rgba(10, 23, 21, .24);
  line-height: 1.25;
  white-space: nowrap;
}
.location-progress b { font-size: 11px; }
.location-node .location-progress small { display: block; padding: 1px 6px; color: rgba(255, 245, 223, .78); font-size: 10px; }
.location-node.progress .location-pin { filter: drop-shadow(0 0 7px rgba(84, 193, 154, .8)); }
.location-node.complete .location-pin { filter: drop-shadow(0 0 10px #78ddb3); }
.location-node.complete .location-progress { color: #173b3f; border-color: #b9ebd0; background: #a9ddbd; }
.location-node.complete .location-progress small { color: rgba(23, 59, 63, .76); }
.location-node.current.complete .location-pin { filter: drop-shadow(0 0 11px #f0c66f) drop-shadow(0 0 5px #78ddb3); }
.minimap-location.progress { background: #58a98c; }
.minimap-location.complete { background: var(--green-glow); box-shadow: 0 0 0 3px rgba(119, 215, 170, .32); }

.modal-layer {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 35, 38, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(820px, 92vh);
  border-radius: 5px;
  background: var(--paper-light);
  box-shadow: 0 30px 90px rgba(3, 22, 24, 0.35);
  animation: modal-in 240ms ease both;
}

#modalContent {
  max-height: min(820px, 92vh);
  overflow: auto;
}

.modal-close {
  position: absolute;
  z-index: 4;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.72);
  font-size: 20px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.modal-close:hover {
  border-color: rgba(217, 109, 75, 0.5);
  background: #fffaf0;
}

.modal-header {
  position: relative;
  overflow: hidden;
  padding: 32px 40px 26px;
  color: #fff8e8;
  background: var(--deep);
}

.modal-header::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -90px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(233, 189, 104, 0.28);
  border-radius: 50%;
}

.modal-header .section-index { color: var(--sun); }
.modal-header h3 { position: relative; z-index: 1; margin: 9px 0 0; font-family: var(--serif); font-size: 30px; }
.modal-header p { position: relative; z-index: 1; margin: 8px 0 0; color: rgba(255, 248, 232, 0.65); font-size: 12px; }

.quiz-body { padding: 30px 40px 38px; }
.quiz-run {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 14px;
  margin-bottom: 24px;
  padding: 12px 14px;
  border: 1px solid rgba(23, 59, 63, .13);
  background: rgba(79, 124, 114, .07);
}
.quiz-run > div:first-child { display: contents; }
.quiz-run span { color: var(--deep); font-size: 13px; font-weight: 800; }
.quiz-run b { justify-self: end; color: var(--coral); font-size: 12px; }
.quiz-run-meter { grid-column: 1 / -1; height: 7px; overflow: hidden; background: rgba(23, 59, 63, .12); }
.quiz-run-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #75b892); transition: width 220ms ease; }
.quiz-run small { grid-column: 1 / -1; color: var(--ink-soft); font-size: 11px; }
.quiz-question { margin: 0 0 22px; font-family: var(--serif); font-size: 20px; line-height: 1.55; }
.quiz-options { display: grid; gap: 10px; }

.quiz-option {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(239, 231, 216, 0.35);
  text-align: left;
  cursor: pointer;
}

.quiz-option:hover:not(:disabled) { border-color: var(--coral); background: #fff; }
.quiz-option span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(23, 59, 63, 0.08); font-family: var(--serif); font-weight: 800; }
.quiz-option.correct { color: #276854; border-color: #4e9a7f; background: rgba(78, 154, 127, 0.1); }
.quiz-option.wrong { color: #a94843; border-color: var(--wrong); background: rgba(201, 98, 91, 0.1); }
.quiz-option:disabled { cursor: default; }

.quiz-feedback {
  margin-top: 18px;
  padding: 15px;
  border-left: 3px solid var(--sun);
  background: rgba(233, 189, 104, 0.12);
  font-size: 13px;
  line-height: 1.75;
}

.quiz-feedback strong { display: block; margin-bottom: 3px; font-family: var(--serif); font-size: 15px; }
.quiz-complete {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 13px;
  align-items: center;
  margin-top: 14px;
  padding: 15px;
  color: #17453c;
  border: 1px solid rgba(65, 142, 111, .38);
  background: rgba(113, 201, 156, .14);
}
.quiz-complete img { width: 38px; height: 38px; image-rendering: pixelated; }
.quiz-complete b { display: block; font-family: var(--serif); font-size: 18px; }
.quiz-complete span { display: block; margin-top: 3px; font-size: 12px; line-height: 1.55; }
.district-complete { padding: 34px 40px 40px; text-align: center; }
.district-complete > img { width: 56px; height: 56px; image-rendering: pixelated; }
.district-complete .completion-kicker { margin: 12px 0 2px; color: var(--coral); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.district-complete > strong { display: block; color: var(--deep); font-family: var(--serif); font-size: 46px; }
.district-complete > p:not(.completion-kicker) { max-width: 440px; margin: 8px auto 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.secondary-button { padding: 10px 15px; border: 1px solid var(--line); background: transparent; font-size: 13px; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.secondary-button:hover { border-color: rgba(217, 109, 75, 0.45); background: rgba(255, 250, 240, 0.9); }
.solid-button { padding: 10px 17px; color: #fffaf0; border: 1px solid var(--deep); background: var(--deep); font-size: 13px; cursor: pointer; transition: background 160ms ease, transform 160ms ease; }
.solid-button:hover { background: #1a4a50; }
.secondary-button:active, .solid-button:active { transform: translateY(1px); }
.help-reset { color: var(--wrong); border-color: rgba(201, 95, 85, 0.4); }
.help-reset:hover { border-color: var(--wrong); background: rgba(201, 95, 85, 0.06); }

.detail-card {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 470px;
}

.detail-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 26px;
  color: white;
  background: var(--detail-color, var(--deep));
}

.detail-visual::after { content: ""; position: absolute; right: -70px; bottom: -70px; width: 180px; height: 180px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; }
.detail-visual small { letter-spacing: .14em; }
.detail-avatar { width: 108px; height: 108px; display: grid; place-items: center; align-self: center; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; font-family: var(--serif); font-size: 48px; font-weight: 900; }
.detail-wordmark { align-self: center; max-width: 150px; color: #fff7e6; font-family: var(--serif); font-size: 30px; font-weight: 900; line-height: 1.2; text-align: center; }
.detail-map-image { width: 150px; height: 116px; align-self: center; object-fit: cover; border: 1px solid rgba(255,255,255,.52); box-shadow: 0 10px 20px rgba(7,30,29,.24); }
.detail-stars { color: var(--sun); letter-spacing: .1em; }
.detail-copy { padding: 38px 34px; }
.detail-copy h3 { margin: 0; font-family: var(--serif); font-size: 30px; }
.detail-copy .latin { margin: 4px 0 20px; color: var(--ink-soft); font-family: var(--serif); font-size: 13px; font-style: italic; }
.detail-facts { display: grid; gap: 14px; margin: 20px 0; }
.detail-fact small { display: block; margin-bottom: 4px; color: var(--coral); font-size: 11px; letter-spacing: .13em; }
.detail-fact p { margin: 0; font-size: 13px; line-height: 1.65; }
.mnemonic { padding: 14px; color: var(--deep); border: 1px solid rgba(217,109,75,.3); background: rgba(217,109,75,.07); font-family: var(--serif); font-size: 15px; }

.help-body { padding: 30px 40px 38px; }
.help-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.help-step { padding: 14px 10px; border-top: 3px solid var(--coral); background: rgba(23,59,63,.05); }
.help-step b { display: block; margin-bottom: 8px; color: var(--coral); font-family: var(--serif); font-size: 18px; }
.help-step p { margin: 0; font-size: 12px; line-height: 1.6; }
.help-body > p { margin: 22px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }

.toast-region {
  position: fixed;
  z-index: 300;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 260px;
  padding: 13px 16px;
  color: #fffaf0;
  border-left: 3px solid var(--sun);
  background: var(--deep);
  box-shadow: 0 12px 30px rgba(7, 35, 37, 0.28);
  font-size: 13px;
  animation: toast-in 240ms ease both;
}

.toast b { display: block; margin-bottom: 3px; color: var(--sun); font-family: var(--serif); font-size: 14px; }

@keyframes reveal { from { opacity: 0; transform: translateY(7px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }

@media (max-width: 1221px) {
  .minimap { width: 162px; }
}

@media (max-width: 1100px) {
  .topbar { gap: 14px; padding: 10px 16px; }
  .brand-name { display: none; }
  .nav-item { padding: 8px 10px; font-size: 12px; }
  .game-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .main-stage { padding: 12px 0 16px 16px; }
  .side-panel { padding: 12px 16px 16px 12px; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .timeline-list { grid-template-columns: 1fr; }
  .wrong-grid, .achievement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .network-board { grid-template-columns: 1fr; }
  .network-inspector { position: relative; top: auto; min-height: 0; }
  .player-hud { transform: scale(.86); transform-origin: top left; }
  .minimap { transform: scale(.86); transform-origin: top right; }
  .dialogue-panel { right: 10%; left: 10%; }
}

@media (max-width: 960px) {
  .welcome-screen { grid-template-columns: 1fr; background: linear-gradient(160deg, #f5ead5 0 58%, #17474b 58%); }
  .welcome-copy { padding: 70px 9vw 420px; }
  .welcome-copy h1 { font-size: clamp(70px, 22vw, 112px); }
  .welcome-art { position: absolute; right: 0; bottom: 0; left: 0; min-height: 460px; }
  .art-caption { bottom: 16%; }
  .welcome-footer { color: rgba(247, 234, 211, 0.48); }
}

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 10px 14px; padding: 10px 14px; }
  .brand { flex: 1; }
  .topbar-actions { margin-left: auto; gap: 10px; }
  .reset-button { display: none; }
  .top-nav { order: 3; flex: 1 0 100%; justify-content: flex-start; }
  .nav-item { padding: 7px 9px; font-size: 12px; }
  .mini-stat small { font-size: 9px; }
  .mini-stat b { font-size: 14px; }

  .game-body { display: block; overflow-y: auto; }
  .main-stage { overflow-y: visible; padding: 12px 14px 16px; }
  #mapView.active { display: block; }
  .map-board { height: 58vh; min-height: 380px; }
  .side-panel { border-left: 0; border-top: 1px solid var(--line); padding: 14px; overflow-y: visible; }
  .quest-tracker { flex: none; }
  .quest-task-groups { flex: none; overflow: visible; }

  .page-heading { align-items: start; padding-top: 14px; }
  .page-heading > p { display: none; }
  .interaction-prompt { display: none; }
  .location-node { transform: translate(-50%, -50%) scale(.82); }
  .player-hud { transform: scale(.72); }
  .minimap { width: 150px; }
  .minimap-map { height: 66px; }
  .rpg-hotbar { display: none; }
  .dialogue-panel { right: 12px; bottom: 80px; left: 148px; grid-template-columns: 88px 1fr; }
  .dialogue-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
  .mobile-dpad {
    position: absolute;
    z-index: 24;
    bottom: 14px;
    left: 14px;
    width: 118px;
    height: 96px;
    display: grid;
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(2, 42px);
    gap: 3px;
  }
  .mobile-dpad button { color: #3b2b1d; border: 7px solid transparent; border-image: url("./assets/kenney-ui/button_square_beige.png") 11 fill stretch; background: transparent; font-size: 12px; font-weight: 800; }
  .mobile-dpad button[data-move="up"] { grid-column: 2; }
  .mobile-dpad button[data-move="left"] { grid-column: 1; grid-row: 2; }
  .mobile-dpad button[data-move="down"] { grid-column: 2; grid-row: 2; }
  .mobile-dpad button[data-move="right"] { grid-column: 3; grid-row: 2; }
  .dock-actions { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .relationship-graph { min-width: 0; height: 590px; }
  .toast-region { bottom: 14px; }
}

@media (max-width: 520px) {
  .welcome-copy { padding-top: 55px; }
  .welcome-copy h1 { margin-top: 18px; }
  .welcome-actions { align-items: flex-start; flex-direction: column; }
  .welcome-footer span:last-child { display: none; }
  .dialogue-panel { right: auto; bottom: 112px; left: 142px; width: 230px; grid-template-columns: 1fr; }
  .dialogue-name { padding: 0 0 6px; border-right: 0; border-bottom: 1px solid rgba(240, 205, 139, 0.28); }
  .dialogue-actions { justify-content: flex-start; flex-wrap: wrap; }
  .location-story { grid-template-columns: 40px 1fr; }
  .story-number { font-size: 30px; }
  .card-grid { grid-template-columns: 1fr; }
  .memory-card { min-height: 220px; }
  .filter-row { overflow-x: auto; }
  .filter-chip { flex: 0 0 auto; }
  .network-toolbar { align-items: stretch; flex-direction: column; }
  .network-toolbar select { min-width: 0; width: 100%; }
  .network-toolbar span { margin-left: 0; }
  .wrong-grid, .achievement-grid { grid-template-columns: 1fr; }
  .timeline-chapter { grid-template-columns: 86px minmax(0, 1fr); }
  .detail-card { grid-template-columns: 1fr; }
  .detail-visual { min-height: 230px; }
  .detail-avatar { width: 82px; height: 82px; }
  .quiz-body, .help-body { padding: 26px 22px 30px; }
  .modal-header { padding: 28px 22px 22px; }
  .help-steps { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
