:root {
  --ink: #17202a;
  --muted: #687386;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(24, 38, 54, 0.16);
  --navy: #203b5f;
  --blue: #2f7dbe;
  --green: #2f8f6b;
  --red: #b84d4d;
  --gold: #c28a26;
  --violet: #7256a4;
  --shadow: 0 18px 50px rgba(12, 24, 38, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #101b24;
}

button,
select {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
}

button {
  min-height: 36px;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

select {
  height: 36px;
  padding: 0 10px;
}

h1,
h2,
p {
  margin: 0;
}

.rpgScreen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.mapBoard {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--map-image, url("assets/academic-rpg-map.png")) var(--map-position, center) / var(--map-size, cover) no-repeat;
  filter: var(--map-filter, none);
}

.mapShade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 16, 24, 0.34), rgba(8, 16, 24, 0.04) 22%, rgba(8, 16, 24, 0.14) 100%),
    radial-gradient(circle at 50% 50%, transparent 0 45%, rgba(6, 13, 22, 0.16) 100%);
}

.hudTop {
  position: absolute;
  z-index: 10;
  top: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.gameTitle,
.metric,
.topButtons,
.placeHud,
.actionHud,
.paperHud,
.navigatorHud,
.teamHud,
.logHud,
.controlHint {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.gameTitle {
  display: grid;
  grid-template-columns: 34px auto;
  gap: 8px;
  align-items: center;
  min-width: 210px;
  padding: 7px 10px;
  border-radius: 10px;
}

.brandMark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--navy);
  font-size: 18px;
  font-weight: 900;
}

.gameTitle h1 {
  font-size: 16px;
  letter-spacing: 0;
}

.gameTitle p {
  color: var(--muted);
  font-size: 11px;
}

.statusStrip {
  display: grid;
  grid-template-columns: repeat(7, minmax(64px, 1fr));
  gap: 8px;
}

.metric {
  width: 88px;
  min-height: 42px;
  border-radius: 10px;
  padding: 5px 8px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metric b {
  display: block;
  margin-top: 1px;
  color: var(--navy);
  font-size: 17px;
}

.topButtons {
  display: flex;
  gap: 6px;
  padding: 7px;
  border-radius: 10px;
}

.topButtons button {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.placeHud {
  position: absolute;
  z-index: 10;
  left: 16px;
  bottom: 72px;
  width: 330px;
  border-radius: 10px;
  padding: 14px;
}

.placeHud h2,
.paperHud h2 {
  margin-top: 3px;
  font-size: 18px;
}

.placeHud p,
.placeLine {
  color: var(--muted);
  font-size: 12px;
}

.placeLine {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.placeLine span:first-child {
  color: var(--ink);
  font-weight: 800;
}

.actionHud {
  position: absolute;
  z-index: 10;
  right: 16px;
  top: 104px;
  width: 350px;
  max-height: min(48vh, 430px);
  border-radius: 10px;
  padding: 14px;
}

.actionList {
  display: grid;
  gap: 9px;
  max-height: calc(min(48vh, 430px) - 40px);
  overflow: auto;
  padding-right: 4px;
  margin-top: 10px;
}

.actionItem {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.actionTop {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.actionTop b {
  display: block;
  font-size: 13px;
}

.actionTop span {
  color: var(--muted);
  font-size: 11px;
}

.actionItem button {
  justify-self: start;
  min-height: 31px;
  padding: 5px 10px;
  color: #fff;
  background: var(--navy);
}

.paperHud {
  position: absolute;
  z-index: 10;
  left: 364px;
  right: 386px;
  bottom: 72px;
  min-width: 360px;
  border-radius: 10px;
  padding: 14px;
}

.paperHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.statePill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--violet);
  font-size: 11px;
  font-weight: 800;
}

.progressGrid {
  display: grid;
  gap: 8px;
}

.barRow {
  display: grid;
  grid-template-columns: 42px 1fr 34px;
  gap: 8px;
  align-items: center;
}

.barRow span {
  color: var(--muted);
  font-size: 12px;
}

.barRow div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 59, 95, 0.13);
}

.barRow i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.2s ease;
}

.barRow:nth-child(2) i { background: var(--green); }
.barRow:nth-child(3) i { background: var(--gold); }
.barRow:nth-child(4) i { background: var(--violet); }
.barRow:nth-child(5) i { background: var(--red); }

.barRow b {
  text-align: right;
  font-size: 12px;
}

.navigatorHud {
  position: absolute;
  z-index: 10;
  right: 16px;
  bottom: 72px;
  width: 350px;
  border-radius: 10px;
  padding: 14px;
}

.navigatorTop {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.navPlan {
  margin-top: 3px;
  color: var(--ink);
  font-size: 12px;
}

.buttonRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.buttonRow button:first-child {
  color: #fff;
  background: var(--navy);
}

.teamHud {
  position: absolute;
  z-index: 10;
  left: 16px;
  top: 104px;
  width: 230px;
  border-radius: 10px;
  padding: 12px;
}

.teamLine {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
}

.teamLine span {
  color: var(--muted);
  text-align: right;
}

.logHud {
  position: absolute;
  z-index: 10;
  left: 16px;
  top: 236px;
  width: 310px;
  max-height: 255px;
  border-radius: 10px;
  padding: 12px;
}

.logList {
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
  margin-top: 9px;
}

.logLine {
  padding: 7px 8px;
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  color: var(--rpg-cream);
  background: rgba(8, 13, 21, 0.46);
  font-size: 12px;
}

.logLine.warn { border-left-color: var(--red); }
.logLine.good { border-left-color: var(--green); }

.controlHint {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 10px 16px;
  color: #273443;
  font-size: 13px;
  white-space: nowrap;
}

.controlHint b {
  color: var(--navy);
}

.controlHint span {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.mapNode {
  position: absolute;
  z-index: 4;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  padding: 0;
  color: #fff;
  background: rgba(32, 59, 95, 0.82);
  box-shadow: 0 0 0 6px rgba(49, 145, 210, 0.16), 0 8px 22px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.mapNode.active {
  background: var(--gold);
  box-shadow: 0 0 0 7px rgba(255, 210, 92, 0.32), 0 0 26px rgba(255, 210, 92, 0.55);
}

.mapNode.target {
  outline: 3px solid rgba(255, 255, 255, 0.82);
  outline-offset: 4px;
}

.mapNode .nodeIcon {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 16px;
  font-weight: 900;
}

.mapNode b,
.mapNode p {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.mapNode b {
  top: 48px;
  min-width: 90px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.mapNode:hover b,
.mapNode.active b {
  opacity: 1;
}

.mapNode p {
  display: none;
}

.routeLine {
  position: absolute;
  z-index: 3;
  height: 4px;
  opacity: 0;
  border-radius: 999px;
  background: rgba(255, 234, 151, 0.8);
  box-shadow: 0 0 14px rgba(255, 230, 142, 0.8);
  transform-origin: left center;
  transition: opacity 0.18s ease;
}

.routeLine.show {
  opacity: 1;
}

.playerPawn {
  position: absolute;
  z-index: 6;
  width: 38px;
  height: 50px;
  transform: translate(-50%, -88%);
  transition: left 0.62s cubic-bezier(0.22, 1, 0.36, 1), top 0.62s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.playerPawn.walking {
  transition: none;
}

.playerPawn span {
  display: block;
  width: 46px;
  height: 58px;
  margin: 4px auto 0;
  border: 0;
  border-radius: 0;
  background: url("assets/professor-sprite.png") center / contain no-repeat;
  filter: drop-shadow(0 12px 8px rgba(9, 18, 27, 0.38));
}

.playerPawn span::after {
  content: "";
  display: block;
  width: 24px;
  height: 6px;
  margin: 54px auto 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}

.npcPawn {
  position: absolute;
  z-index: 5;
  width: 42px;
  height: 50px;
  transform: translate(-50%, -88%);
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.npcPawn span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 42px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 14px 14px 9px 9px;
  color: #fff;
  background: var(--npc-color, #7256a4);
  box-shadow: 0 10px 18px rgba(9, 18, 27, 0.32);
  font-size: 18px;
  font-weight: 900;
}

.npcPawn.active span {
  box-shadow: 0 0 0 7px rgba(255, 215, 84, 0.24), 0 0 24px rgba(255, 215, 84, 0.7);
}

.npcPawn b {
  position: absolute;
  left: 50%;
  top: 44px;
  min-width: 80px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
}

.npcPawn:hover b,
.npcPawn.active b {
  opacity: 1;
}

.guideOverlay,
.modal,
.battleOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 18, 28, 0.5);
  backdrop-filter: blur(8px);
}

.guideOverlay.hidden,
.modal.hidden,
.battleOverlay.hidden {
  display: none;
}

.guideBox,
.modalBox {
  width: min(650px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.guideBox {
  padding: 30px;
}

.guideKicker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.guideBox h2 {
  margin: 4px 0 10px;
  font-size: 28px;
}

.guideBox p {
  color: #344255;
  font-size: 15px;
}

.guideSteps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
}

.guideSteps div {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(244, 248, 251, 0.9);
}

.guideSteps b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
}

.guideSteps span {
  color: #334052;
  font-size: 13px;
}

#startGuideBtn {
  min-width: 140px;
  color: #fff;
  background: var(--navy);
}

.modalContent {
  padding: 24px;
}

.modalContent h2 {
  margin: 4px 0 12px;
  font-size: 24px;
}

#modalBody {
  white-space: pre-wrap;
  color: #344052;
  font-size: 14px;
}

.storyScene {
  display: grid;
  gap: 10px;
  white-space: normal;
}

.storyLineItem {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(226, 189, 99, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.storyLineItem b {
  color: #ffdda1;
  font-size: 12px;
}

.storyLineItem span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.modalButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.modalButtons button:first-child {
  color: #fff;
  background: var(--navy);
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 31, 43, 0.94);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.25);
  font-size: 13px;
}

.battleBox {
  width: min(920px, calc(100vw - 32px));
  border: 2px solid rgba(255, 218, 115, 0.86);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(31, 38, 48, 0.97), rgba(13, 19, 28, 0.97)),
    #141b25;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48), inset 0 0 0 2px rgba(255, 255, 255, 0.08);
  padding: 18px;
}

.battleTop {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}

.battleTitle {
  padding: 7px 12px;
  border: 1px solid rgba(255, 218, 115, 0.55);
  border-radius: 8px;
  color: #ffe3a1;
  background: rgba(0, 0, 0, 0.24);
  font-weight: 900;
}

.combatant {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #f6f0df;
  background: rgba(255, 255, 255, 0.08);
}

.combatant.enemy {
  grid-template-columns: 54px 1fr;
}

.portrait {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 218, 115, 0.42);
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(180deg, #2b5f82, #17314d);
  font-weight: 900;
}

.enemyFace {
  background: linear-gradient(180deg, #b84d4d, #6b242e);
}

.hpBar {
  height: 12px;
  overflow: hidden;
  margin: 6px 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
}

.hpBar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.enemyBar i {
  background: var(--red);
}

.combatant span {
  color: rgba(246, 240, 223, 0.72);
  font-size: 12px;
}

.battleLog {
  min-height: 84px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid rgba(255, 218, 115, 0.34);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: #f6f0df;
  white-space: pre-wrap;
  line-height: 1.65;
}

.battleActions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.battleActions button {
  min-height: 42px;
  border: 1px solid rgba(255, 218, 115, 0.36);
  border-radius: 8px;
  color: #fff6df;
  background: linear-gradient(180deg, #314c6b, #1c2d44);
}

@media (max-width: 1120px) {
  .hudTop {
    grid-template-columns: 1fr auto;
  }

  .statusStrip {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, 1fr);
  }

  .actionHud,
  .navigatorHud {
    width: 320px;
  }

  .paperHud {
    left: 16px;
    right: 350px;
  }

  .logHud {
    display: none;
  }
}

@media (max-width: 760px) {
  .gameTitle p,
  .teamHud,
  .logHud,
  .paperHud {
    display: none;
  }

  .hudTop {
    top: 8px;
    left: 8px;
    right: 8px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .gameTitle {
    min-width: 0;
    width: 100%;
    padding-right: 126px;
  }

  .topButtons {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    padding: 5px;
  }

  .topButtons button {
    width: 32px;
    height: 32px;
  }

  .statusStrip {
    grid-column: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric {
    min-height: 44px;
    padding: 5px 8px;
  }

  .metric b {
    font-size: 16px;
  }

  .placeHud {
    left: 8px;
    right: 8px;
    bottom: 66px;
    width: auto;
  }

  .actionHud {
    top: auto;
    right: 8px;
    bottom: 176px;
    width: min(320px, calc(100vw - 16px));
    max-height: 210px;
  }

  .navigatorHud {
    display: none;
  }

  .controlHint {
    bottom: 10px;
    max-width: calc(100vw - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }

  .guideSteps {
    grid-template-columns: 1fr;
  }

  .mapNode b,
  .mapNode p,
  .npcPawn b {
    display: none !important;
  }
}

/* RPG mode overrides: keep the map primary, move detail into temporary windows. */
.paperHud.hidden,
.navigatorHud.hidden,
.logHud.hidden,
.menuPanel.hidden,
.actionHud.hidden {
  display: none !important;
}

.gameTitle,
.metric,
.topButtons,
.placeHud,
.actionHud,
.menuPanel,
.controlHint {
  pointer-events: auto;
}

.statusStrip {
  grid-template-columns: repeat(4, minmax(64px, 1fr));
}

.metric:nth-child(n + 5) {
  display: none;
}

.placeHud {
  left: 50%;
  bottom: 74px;
  width: min(430px, calc(100vw - 28px));
  padding: 12px 14px;
  transform: translateX(-50%);
  text-align: center;
}

.placeLine {
  justify-content: center;
  margin-top: 9px;
  padding-top: 8px;
}

.actionHud {
  left: 50%;
  right: auto;
  top: auto;
  bottom: 68px;
  width: min(760px, calc(100vw - 32px));
  max-height: 42vh;
  padding: 16px;
  transform: translateX(-50%);
}

.dialogSpeaker {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.dialogText {
  margin-top: 10px;
  color: #233244;
  font-size: 15px;
}

.actionList {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 190px;
  margin-top: 12px;
}

.actionTop {
  display: block;
}

.effectLine {
  color: var(--muted);
  font-size: 11px;
}

.paperHud {
  right: 16px;
  left: auto;
  top: 104px;
  bottom: auto;
  width: 430px;
  min-width: 0;
  max-height: 310px;
  overflow: auto;
}

.navigatorHud {
  right: 16px;
  top: 430px;
  bottom: auto;
  width: 430px;
}

.logHud {
  left: 16px;
  top: 104px;
  width: 330px;
  max-height: 310px;
}

.menuTeam {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.menuTeam div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
}

.menuTeam span {
  color: var(--muted);
  text-align: right;
}

.storyPanel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.storyLine {
  display: grid;
  gap: 3px;
}

.storyLine span {
  color: #ffdda1;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.storyLine b {
  color: var(--rpg-cream);
  font-size: 13px;
  line-height: 1.35;
}

.questList {
  display: grid;
  gap: 8px;
  max-height: 122px;
  margin-top: 9px;
  padding-right: 4px;
  overflow: auto;
}

.questItem {
  padding: 8px;
  border: 1px solid rgba(226, 189, 99, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.questItem div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.questItem b {
  color: var(--rpg-cream);
  font-size: 12px;
}

.questItem span,
.questItem p,
.questItem em {
  color: var(--muted);
  font-size: 11px;
}

.questItem p {
  margin: 5px 0 4px;
  line-height: 1.35;
}

.questItem em {
  display: block;
  color: #ffdda1;
  font-style: normal;
}

.questItem.done {
  border-color: rgba(91, 193, 141, 0.38);
  background: rgba(56, 128, 87, 0.18);
}

.questItem.done em {
  color: #9ee0b7;
}

.mapNode {
  width: 24px;
  height: 24px;
  background: rgba(255, 249, 218, 0.78);
  color: var(--node-color, #ffe77c);
  box-shadow: 0 0 0 5px rgba(49, 145, 210, 0.12), 0 0 18px color-mix(in srgb, var(--node-color, #ffe77c) 65%, transparent);
}

.mapNode.active {
  background: var(--gold);
  box-shadow: 0 0 0 8px rgba(255, 210, 92, 0.22), 0 0 28px rgba(255, 210, 92, 0.72);
}

.mapNode .nodeIcon {
  font-size: 0;
  background: transparent !important;
}

.mapNode .nodeIcon::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .placeHud {
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
  }

  .actionHud {
    left: 8px;
    right: 8px;
    bottom: 84px;
    width: auto;
    transform: none;
  }

  .actionList {
    grid-template-columns: 1fr;
  }
}

/* Art pass: RPG visual layer. */
:root {
  --ink: #f3ead8;
  --muted: #b7c0cd;
  --panel: rgba(18, 23, 33, 0.82);
  --panel-strong: rgba(24, 30, 42, 0.94);
  --line: rgba(255, 219, 128, 0.26);
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.38);
  --rpg-bg: rgba(13, 18, 27, 0.82);
  --rpg-bg-strong: rgba(17, 23, 34, 0.96);
  --rpg-gold: #e2bd63;
  --rpg-gold-soft: rgba(226, 189, 99, 0.28);
  --rpg-cream: #fff2d2;
  --rpg-blue: #274965;
}

body {
  color: var(--ink);
  background: #0b1118;
}

button,
select {
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel-strong);
}

.mapShade {
  background:
    linear-gradient(180deg, rgba(5, 9, 15, 0.42), rgba(5, 9, 15, 0.04) 30%, rgba(5, 9, 15, 0.42) 100%),
    linear-gradient(90deg, rgba(5, 9, 15, 0.34), transparent 18%, transparent 82%, rgba(5, 9, 15, 0.34)),
    radial-gradient(circle at 50% 52%, transparent 0 48%, rgba(0, 0, 0, 0.22) 100%);
}

.gameTitle,
.metric,
.topButtons,
.placeHud,
.actionHud,
.menuPanel,
.controlHint,
.guideBox,
.modalBox {
  color: var(--ink);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(38, 47, 62, 0.92), rgba(14, 20, 30, 0.9)),
    var(--rpg-bg);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px) saturate(1.08);
}

.gameTitle,
.metric,
.topButtons {
  border-radius: 8px;
}

.gameTitle {
  min-width: 238px;
  border-left: 3px solid var(--rpg-gold);
}

.brandMark {
  border: 1px solid rgba(255, 229, 157, 0.45);
  border-radius: 7px;
  color: var(--rpg-cream);
  background: linear-gradient(180deg, #315b7a, #172b43);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.gameTitle h1,
.placeHud h2,
.dialogSpeaker,
.battleTitle,
.modalContent h2,
.guideBox h2 {
  color: var(--rpg-cream);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.gameTitle p,
.metric span,
.placeHud p,
.dialogText,
.effectLine,
.combatant span,
.guideBox p,
.guideSteps span,
#modalBody {
  color: var(--muted);
}

.metric {
  width: 86px;
  min-height: 42px;
  padding: 6px 9px;
}

.metric b {
  color: #ffdda1;
  font-size: 18px;
}

.topButtons {
  gap: 5px;
  padding: 6px;
}

.topButtons button,
.battleActions button,
.actionItem button,
.modalButtons button,
#startGuideBtn {
  border: 1px solid rgba(255, 224, 148, 0.32);
  color: #fff4d7;
  background:
    linear-gradient(180deg, rgba(54, 83, 111, 0.98), rgba(26, 41, 62, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.topButtons button:hover:not(:disabled),
.battleActions button:hover:not(:disabled),
.actionItem button:hover:not(:disabled) {
  filter: brightness(1.12);
}

.placeHud {
  border: 2px solid rgba(226, 189, 99, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(34, 40, 52, 0.94), rgba(12, 17, 26, 0.94));
}

.placeHud h2 {
  font-size: 20px;
}

.placeLine {
  border-top-color: rgba(226, 189, 99, 0.28);
}

.placeLine b {
  color: #ffe2a4;
}

.actionHud {
  border: 2px solid rgba(226, 189, 99, 0.54);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(34, 40, 52, 0.97), rgba(12, 17, 26, 0.97));
}

.dialogSpeaker {
  border: 1px solid rgba(226, 189, 99, 0.5);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.actionItem {
  border: 1px solid rgba(226, 189, 99, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.actionItem b,
.paperHeader h2,
.menuTeam b,
.navigatorTop b {
  color: var(--rpg-cream);
}

.controlHint {
  border-radius: 999px;
  border-color: rgba(226, 189, 99, 0.38);
  color: var(--muted);
  background: rgba(13, 18, 27, 0.86);
}

.controlHint b {
  color: #ffdda1;
}

.controlHint span {
  background: rgba(226, 189, 99, 0.28);
}

.mapNode {
  width: 52px;
  height: 58px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--node-color, var(--rpg-gold));
  transform: translate(-50%, -78%);
}

.mapNode .nodeIcon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 2px solid rgba(255, 238, 180, 0.92);
  border-radius: 50% 50% 46% 46%;
  color: #fff8df;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--node-color, #c28a26) 82%, #fff 18%), color-mix(in srgb, var(--node-color, #c28a26) 72%, #111 28%));
  box-shadow:
    0 0 0 4px rgba(12, 17, 26, 0.36),
    0 10px 20px rgba(0, 0, 0, 0.34),
    0 0 18px color-mix(in srgb, var(--node-color, #c28a26) 64%, transparent);
  font-size: 19px !important;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.26);
}

.mapNode .nodeIcon::after {
  display: none;
}

.mapNode::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 28px;
  height: 9px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  transform: translateX(-50%);
  filter: blur(1px);
}

.mapNode.active .nodeIcon,
.mapNode.target .nodeIcon {
  border-color: #ffe8a8;
  box-shadow:
    0 0 0 5px rgba(226, 189, 99, 0.22),
    0 0 28px rgba(255, 218, 117, 0.72),
    0 14px 28px rgba(0, 0, 0, 0.38);
  transform: translateY(-3px);
}

.mapNode b {
  top: 46px;
  min-width: 76px;
  border: 1px solid rgba(226, 189, 99, 0.36);
  border-radius: 6px;
  color: var(--rpg-cream);
  background: rgba(13, 18, 27, 0.92);
}

.mapNode p {
  display: none;
}

.mapNode em {
  position: absolute;
  left: 50%;
  top: -11px;
  min-width: 38px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 238, 180, 0.82);
  border-radius: 999px;
  color: #2d1f06;
  background: #ffd65c;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.28);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  transform: translateX(-50%);
}

.mapNode.portal .nodeIcon {
  animation: portalPulse 1.8s ease-in-out infinite;
}

.mapNode.portal .nodeIcon::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(255, 238, 180, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 218, 117, 0.42);
}

.mapNode.exit em {
  background: #d7ecff;
}

@keyframes portalPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.npcPawn {
  width: 60px;
  height: 70px;
  transform: translate(-50%, -86%);
}

.npcPawn span {
  width: 46px;
  height: 50px;
  border: 2px solid rgba(255, 238, 180, 0.9);
  border-radius: 18px 18px 12px 12px;
  color: #fff8df;
  background:
    radial-gradient(circle at 42% 28%, rgba(255, 255, 255, 0.24), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--npc-color, #7256a4) 82%, #fff 18%), color-mix(in srgb, var(--npc-color, #7256a4) 70%, #0d121b 30%));
  box-shadow:
    0 0 0 4px rgba(12, 17, 26, 0.35),
    0 12px 20px rgba(0, 0, 0, 0.36);
}

.npcPawn.active span {
  box-shadow:
    0 0 0 5px rgba(226, 189, 99, 0.25),
    0 0 26px rgba(255, 218, 117, 0.78),
    0 14px 26px rgba(0, 0, 0, 0.38);
}

.npcPawn.active::before {
  content: "!";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: -18px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 238, 180, 0.96);
  border-radius: 50%;
  color: #3b2505;
  background: #ffd65c;
  font-weight: 900;
  transform: translateX(-50%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.npcPawn.cleared {
  opacity: 0.72;
}

.npcPawn.cleared::after {
  content: "✓";
  position: absolute;
  z-index: 2;
  right: 5px;
  top: -8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 238, 180, 0.9);
  border-radius: 50%;
  color: #20351e;
  background: #9ee0b7;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.npcPawn b {
  top: 54px;
  border: 1px solid rgba(226, 189, 99, 0.36);
  border-radius: 6px;
  color: var(--rpg-cream);
  background: rgba(13, 18, 27, 0.92);
}

.playerPawn {
  z-index: 8;
  width: 58px;
  height: 74px;
  transform: translate(-50%, -84%);
}

.playerPawn::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 52px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
  filter: blur(1px);
}

.playerPawn span {
  position: relative;
  z-index: 1;
  width: 66px;
  height: 80px;
  margin: 0 auto;
  filter:
    drop-shadow(0 0 2px rgba(255, 244, 210, 0.7))
    drop-shadow(0 14px 10px rgba(0, 0, 0, 0.46));
}

.playerPawn span::after {
  display: none;
}

.guideOverlay,
.modal,
.battleOverlay {
  background: rgba(4, 8, 13, 0.58);
}

.guideBox,
.modalBox {
  border: 2px solid rgba(226, 189, 99, 0.5);
  border-radius: 8px;
}

.guideKicker,
.eyebrow {
  color: #ffdda1;
}

.guideSteps div {
  border-color: rgba(226, 189, 99, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.guideSteps b {
  color: #302006;
  background: #ffd65c;
}

.battleBox {
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(34, 40, 52, 0.98), rgba(8, 13, 21, 0.98));
}

.combatant {
  border-color: rgba(226, 189, 99, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.combatant b {
  color: var(--rpg-cream);
}

.battleLog {
  border-color: rgba(226, 189, 99, 0.32);
  background: rgba(0, 0, 0, 0.24);
}

@media (max-width: 760px) {
  .gameTitle {
    min-height: 72px;
    padding-right: 126px;
  }

  .gameTitle h1 {
    font-size: 18px;
  }

  .brandMark {
    width: 38px;
    height: 38px;
  }

  .metric {
    width: auto;
  }

  .placeHud {
    border-radius: 8px;
    bottom: 70px;
  }

  .placeHud h2 {
    font-size: 18px;
  }

  .controlHint {
    justify-content: flex-start;
    padding: 10px 12px;
    overflow-x: auto;
    text-overflow: clip;
    white-space: nowrap;
  }

  .mapNode {
    width: 48px;
    height: 54px;
  }

  .mapNode .nodeIcon {
    width: 38px;
    height: 38px;
    font-size: 18px !important;
  }

  .npcPawn {
    width: 52px;
    height: 64px;
  }

  .npcPawn span {
    width: 42px;
    height: 46px;
    font-size: 15px;
  }

  .playerPawn {
    width: 52px;
    height: 68px;
  }

  .playerPawn span {
    width: 58px;
    height: 72px;
  }

  .battleBox {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 42px);
    padding: 12px;
    overflow: auto;
  }

  .battleTop {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "title title"
      "hero enemy";
    gap: 8px;
  }

  .battleTitle {
    grid-area: title;
    justify-self: center;
  }

  .combatant.hero {
    grid-area: hero;
  }

  .combatant.enemy {
    grid-area: enemy;
  }

  .combatant {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 8px;
  }

  .combatant b {
    display: block;
    overflow-wrap: anywhere;
    font-size: 15px;
  }

  .portrait {
    width: 42px;
    height: 42px;
    font-size: 15px;
  }

  .battleLog {
    min-height: 84px;
    margin: 10px 0;
    font-size: 15px;
  }

  .battleActions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .battleActions button {
    min-height: 44px;
    padding: 8px 6px;
  }
}

/* Generated sprite integration. */
.npcPawn.sprite {
  width: 70px;
  height: 88px;
  transform: translate(-50%, -86%);
}

.npcPawn.sprite::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 46px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  transform: translateX(-50%);
  filter: blur(1px);
}

.npcPawn.sprite span {
  position: relative;
  z-index: 1;
  width: 68px;
  height: 86px;
  border: 0;
  border-radius: 0;
  background: var(--npc-sprite) center bottom / contain no-repeat;
  box-shadow: none;
  filter:
    drop-shadow(0 0 2px rgba(255, 238, 180, 0.62))
    drop-shadow(0 13px 9px rgba(0, 0, 0, 0.42));
}

.npcPawn.sprite.monster {
  width: 82px;
  height: 86px;
}

.npcPawn.sprite.monster span {
  width: 82px;
  height: 86px;
}

.npcPawn.sprite.active span {
  filter:
    drop-shadow(0 0 5px rgba(255, 218, 117, 0.92))
    drop-shadow(0 15px 10px rgba(0, 0, 0, 0.46));
  transform: translateY(-4px);
}

.npcPawn.sprite b {
  top: 76px;
}

.portrait.spriteFace {
  width: 72px;
  height: 78px;
  border: 0;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
  filter: drop-shadow(0 10px 9px rgba(0, 0, 0, 0.36));
}

.combatant,
.combatant.enemy {
  grid-template-columns: 78px 1fr;
}

@media (max-width: 760px) {
  .npcPawn.sprite {
    width: 58px;
    height: 72px;
  }

  .npcPawn.sprite span {
    width: 58px;
    height: 72px;
  }

  .npcPawn.sprite.monster,
  .npcPawn.sprite.monster span {
    width: 66px;
    height: 70px;
  }

  .npcPawn.sprite b {
    top: 64px;
  }

  .portrait.spriteFace {
    width: 50px;
    height: 58px;
  }

  .combatant,
  .combatant.enemy {
    grid-template-columns: 52px minmax(0, 1fr);
  }
}
