.game-page {
  --hud: #102c43;
  --hud-dark: #0c2337;
  --hud-line: #86c4da70;
  --hud-ink: #edf9fc;
  --hud-muted: #c0dce7;
  --hud-aqua: #9ce9ef;
  --hud-gold: #efd99f;
  --edge: clamp(12px, 2.2vw, 30px);
  color-scheme: dark;
  color: var(--hud-ink);
  background: #173e60;
  -webkit-tap-highlight-color: transparent;
}

.game-page :focus-visible { outline: 2px solid var(--hud-gold); outline-offset: 4px; }
.game-page .skip-link { z-index: 20; color: #172019; }
.game-page .footer { display: none; }
.game-shell { position: relative; height: 100svh; min-height: 340px; }
.game-main, .campaign-board { height: 100%; }
.game-main:focus { outline: none; }

.game-header {
  position: absolute;
  z-index: 3;
  top: var(--edge);
  left: var(--edge);
}
.game-header h1 { font: inherit; }
.game-header a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px 8px 8px;
  border-radius: 7px;
}
.game-header img { border-radius: 5px; }
.game-header strong, .game-header small { display: block; }
.game-header strong { font-size: 15px; line-height: 1.2; }
.game-header small { margin-top: 2px; color: var(--hud-muted); font-size: 11px; font-weight: 600; }

.campaign-board { position: relative; isolation: isolate; }
.board-camera {
  position: absolute;
  inset: 0;
  overflow: clip;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background-color: #1d527b;
  background-image: radial-gradient(ellipse at 50% 44%, #397fa267, #102c433f 75%);
}
.board-camera:focus-visible { outline-offset: -4px; }
.board-camera[data-dragging], .board-camera[data-dragging] a { cursor: grabbing; }

.board-terrain {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100%, 145svh, 960px);
  aspect-ratio: 4 / 3;
  transform: translate(calc(-50% + var(--pan-x, -23.5%)), calc(-50% + var(--pan-y, -14.4%))) scale(var(--map-zoom, 2));
}
.board-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
[data-at-fit] .board-art { box-shadow: 0 0 0 2px #94bfd16e, 0 0 0 9px #173d5c, 0 12px 24px #0c2c49bb; }
.board-ripples { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.board-ripples span {
  position: absolute;
  width: var(--ripple-width);
  height: 4px;
  border-top: 1px solid #c6f5f1;
  border-radius: 55% 60% 0 0;
  opacity: .18;
}
.board-ripples span::after {
  content: '';
  position: absolute;
  inset: 2px 2px -2px 3px;
  border-top: 1px solid #9cdbdd;
  border-radius: inherit;
  opacity: .45;
}
@media (prefers-reduced-motion: no-preference) {
  .board-ripples span { animation: sea-ripple 7s var(--ripple-phase) ease-in-out infinite; }
}
@keyframes sea-ripple {
  0%, 100% { opacity: .08; transform: translate(-3px, -1px) scaleX(.76); }
  42% { opacity: .52; }
  78% { opacity: .12; transform: translate(4px, 2px) scaleX(1.08); }
}

.board-marker, .board-unit {
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  cursor: pointer;
  -webkit-user-drag: none;
}
.board-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 0;
  transform: translateX(-50%) scale(var(--marker-scale, .5));
  min-width: 44px;
  min-height: 44px;
  white-space: nowrap;
}
.marker-point {
  position: absolute;
  top: 0;
  left: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%);
  border: 2px solid #fcf1d2;
  border-radius: 50%;
  background: #306b7a;
  box-shadow: 0 0 0 2px #142d4a9e;
}
.marker-point::after { content: ''; position: absolute; inset: -12px; }
.marker-name {
  position: relative;
  margin-top: 9px;
  padding: 3px 8px;
  border: 1px solid #9bd1df78;
  border-radius: 4px;
  color: var(--hud-ink);
  background: #102c43f5;
  box-shadow: 0 2px 4px #092a3859;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}
.board-marker:is(:hover, :focus-visible, [aria-expanded="true"], [aria-current]) { z-index: 3; }
.board-marker:is(:hover, :focus-visible, [aria-expanded="true"]) .marker-name { color: #123148; background: var(--hud-gold); border-color: #fff1cb; }
.board-marker:is(:hover, :focus-visible, [aria-expanded="true"]) .marker-point { box-shadow: 0 0 0 5px #fff0c673; }
.marker-stop-singapore .marker-name { border-color: #9febe9a3; }
.marker-stop-ho-chi-minh-city .marker-name {
  position: absolute;
  top: 0;
  left: calc(50% + 12px);
  margin: 0;
  transform: translateY(-50%);
}
.board-marker[aria-current] .marker-point { background: var(--hud-aqua); border-color: #d6fdff; }
.board-terrain:has(.board-unit:not([hidden])) [aria-current="location"] .marker-point { visibility: hidden; }

.board-unit {
  z-index: 4;
  width: 48px;
  min-height: 72px;
  transform: translate(-50%, -100%) scale(var(--marker-scale, .5));
  transform-origin: 50% 100%;
}
.board-unit img { width: 100%; height: auto; max-height: 106px; object-fit: contain; filter: drop-shadow(1px 3px 2px #0a273a66); pointer-events: none; }
.board-unit:active img { transform: translateY(2px) scale(.96); transform-origin: center bottom; }
.unit-ring {
  position: absolute;
  z-index: -1;
  inset: auto 2px -7px;
  height: 16px;
  border: 1px solid #9ce9efd9;
  border-radius: 50%;
  background: #3b9ca647;
  box-shadow: 0 0 8px #8cf2f19c, inset 0 0 6px #183e5a85;
  pointer-events: none;
}
.unit-ripple { position: absolute; inset: -1px; border: 1px solid #b8fcff; border-radius: inherit; opacity: 0; }
.board-unit:is(:hover, :focus-visible, [aria-expanded="true"]) .unit-ring { border-color: #e5ffff; box-shadow: 0 0 12px #9cf5f5c2; }
.unit-level {
  position: absolute;
  right: -3px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #fff1c9;
  border-radius: 4px 4px 7px 7px;
  color: #173548;
  background: var(--hud-gold);
  font-size: 11px;
  font-weight: 700;
}
[data-overview] .board-unit {
  width: 44px;
  min-height: 44px;
  transform: translate(-50%, -50%) scale(var(--marker-scale));
  transform-origin: center;
}
[data-overview] .board-unit img,
[data-overview] .unit-level { display: none; }
[data-overview] .unit-ring {
  inset: 50% auto auto 50%;
  width: 12px;
  height: 12px;
  translate: -50% -50%;
  background: var(--hud-aqua);
  border-color: #e0ffff;
  box-shadow: 0 0 0 2px #18445b, 0 0 9px 3px #9ce9ef8c;
}

.game-header a, .game-dock, .map-controls, .map-journal {
  border: 1px solid var(--hud-line);
  background: var(--hud);
  box-shadow: 0 2px 0 #0b213d7a, 0 6px 22px #0a2e495c, inset 0 1px #c1e8ff21;
}

.game-dock, .map-controls {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 8px;
}
.game-dock {
  left: 50%;
  bottom: max(var(--edge), env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
}
.game-dock a, .map-controls button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  color: var(--hud-ink);
  background: transparent;
  cursor: pointer;
}
.game-dock a { gap: 1px; padding: 4px 11px; font-size: 11px; font-weight: 700; line-height: 1.1; }
.game-icon { line-height: 1; }
.game-dock .game-icon { color: var(--hud-gold); font-size: 19px; }
.game-dock a:is(:hover, [data-active]), .map-controls button:hover { background: #295572; }
.map-controls {
  right: var(--edge);
  bottom: max(var(--edge), env(safe-area-inset-bottom));
}
.music-icon { position: relative; color: var(--hud-aqua); font: 700 24px/1 var(--text); }
.music-control[aria-pressed="false"] .music-icon { color: var(--hud-muted); }
.music-control[aria-pressed="false"] .music-icon::after {
  content: '';
  position: absolute;
  inset: 50% -5px auto;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -1px var(--hud);
  transform: rotate(-45deg);
}
.music-control[aria-busy="true"] .music-icon { opacity: .65; }
.music-error {
  position: absolute;
  right: 0;
  bottom: calc(100% + 5px);
  width: max-content;
  padding: 5px 7px;
  border: 1px solid var(--hud-line);
  border-radius: 4px;
  background: var(--hud);
  color: var(--hud-ink);
  font-size: 12px;
}
.map-controls button { padding: 0; font: 500 21px/1 var(--text); }
.map-controls button + button { border-left: 1px solid #8ebacf35; }
.map-credit {
  position: absolute;
  left: var(--edge);
  bottom: var(--edge);
  color: #e1f6fd;
  font-size: 10px;
  text-shadow: 0 1px 2px #102d48, 0 1px 4px #102d48;
  pointer-events: none;
}

.map-journal {
  position: absolute;
  z-index: 7;
  inset: auto var(--edge) calc(max(var(--edge), env(safe-area-inset-bottom)) + 62px) auto;
  width: min(590px, 50vw);
  height: min(630px, calc(100% - var(--edge) - 86px));
  overflow: hidden;
  border-top: 2px solid #acd1df;
  border-radius: 10px;
  box-shadow: 0 12px 38px #0620368c;
}
.journal-section {
  display: grid;
  grid-template: auto minmax(0, 1fr) / 148px minmax(0, 1fr);
  height: 100%;
}
.map-journal:has(#base:not([hidden]), #base-profile:target) {
  width: min(380px, 50vw);
  height: auto;
  max-height: calc(100% - var(--edge) - 86px);
}
.journal-section#base { grid-template: auto minmax(0, 1fr) / minmax(0, 1fr); }
.journal-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 51px;
  padding: 3px 4px 3px 17px;
  border-bottom: 1px solid #8dbfd139;
  background: #18374e;
}
.journal-header h2 { font: 700 15px/1.2 var(--text); }
.journal-close {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  color: var(--hud-muted);
  background: transparent;
  font: 400 24px/1 var(--text);
  cursor: pointer;
}
.journal-close:hover { color: var(--hud-ink); background: #28516a; }
.journal-index {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px 8px;
  border-right: 1px solid #8dbfd139;
  background: #0e273c;
}
.journal-index a {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--hud-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.22;
}
.journal-index small { color: var(--hud-muted); font-size: 10px; font-weight: 500; }
.journal-index a:hover { background: #1c425d; }
.journal-index [aria-current] { color: #fff2d0; background: #234861; border-color: #bed18986; }
.journal-index [aria-current] small { color: #e6d9ae; }
.journal-index a:focus-visible { outline-offset: -2px; }
.journal-body {
  --journal-padding-start: 19px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--journal-padding-start) 20px 26px;
  scroll-padding-block-start: var(--journal-padding-start);
  scrollbar-gutter: stable;
  scrollbar-color: #80adbf #173448;
  scrollbar-width: thin;
}
.journal-body:focus-visible { outline-offset: -3px; }
.journal-entry h3 {
  margin: 3px 0 5px;
  font: 700 clamp(23px, 2vw, 31px)/1.13 var(--text);
  letter-spacing: -.02em;
  text-wrap: pretty;
}
.journal-entry h3:focus { outline: none; }
.journal-entry p { margin-block: 0 12px; color: var(--hud-muted); font-size: 14px; line-height: 1.57; }
.journal-entry h4 { margin: 19px 0 4px; font: 700 14px/1.3 var(--text); }
.journal-entry h5 { margin: 0 0 6px; font: 700 15px/1.3 var(--text); }
.journal-entry .education-highlights { margin: 0 0 17px; }
.journal-entry .education-heading h4 { margin-top: 5px; }
.journal-entry .education-series { grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); }
.journal-entry .education-series p { font-size: 13px; margin-bottom: 4px; }
.journal-entry .education-series .journal-sources { margin: 0; }
.journal-entry .education-series a { min-height: 36px; }
.journal-entry .writing-list p { margin: 0; }
.journal-entry .writing-item-heading a { min-height: 36px; font-size: 14px; }
.journal-writing-collection > h4 { margin: 0 0 5px; font-size: 17px; }
.journal-writing-collection + .journal-writing-collection { margin-top: 22px; }
.journal-entry .video-library-controls { margin: 0 0 16px; }
.journal-entry .video-library-controls nav { gap: 0 11px; }
.journal-entry .video-library-controls nav a { font-size: 12px; }
.journal-entry .video-collection { margin-block: 16px 24px; scroll-margin-top: 5px; }
.journal-entry .video-collection-title { margin-top: 0; font-size: 17px; }
.journal-entry .video-card p { margin: 0; font-size: 13px; }
.journal-entry .video-card p.video-duration { font-size: 12px; }
.journal-entry .company-record:first-of-type { border-top: 0; padding-top: 0; }
.journal-entry .company-record > h4 { color: var(--hud-gold); margin-top: 0; }
.journal-entry .destination-record { margin-block: 10px; padding-top: 10px; }
.journal-entry .destination-record > h4 { color: var(--hud-ink); font-size: 16px; margin: 2px 0 4px; }
.journal-entry .destination-record > .company-record-meta { color: var(--hud-gold); font-size: 12px; margin: 0; }
.journal-entry .journal-meta { margin: 0; color: var(--hud-gold); font-size: 11px; font-weight: 700; }
.journal-entry .journal-subtitle { color: var(--hud-muted); font-size: 13px; font-weight: 600; }
.journal-entry .journal-highlight { color: var(--hud-ink); font-weight: 700; font-size: 15px; }
.journal-entry-header { margin-bottom: 11px; }
.journal-entry-header p:last-child { margin-bottom: 0; }
.journal-sources { margin: 3px 0 12px; }
.journal-sources a, .journal-profiles a, .journal-related a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  color: var(--hud-aqua);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.35;
}
.journal-sources a:hover, .journal-profiles a:hover, .journal-related a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.journal-related, .journal-profiles { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.journal-profiles { gap: 6px; }
.journal-profiles a { padding-inline: 10px; border: 1px solid #8dbfd139; border-radius: 5px; }
.journal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 13px; }
.journal-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 9px;
  border: 1px solid #80bacb75;
  border-radius: 5px;
  background: #1b405a;
  color: var(--hud-ink);
  font: 700 12px/1.2 var(--text);
  cursor: pointer;
}
.journal-actions button:hover { background: #326a85; }

.game-shell:not([data-ready]) .map-journal:has(:target),
.game-shell:not([data-ready]) .journal-entry:target,
.game-shell:not([data-ready]) .journal-section:target:not(:has(.journal-entry:target)) .journal-entry:first-child {
  display: block !important;
}
.game-shell:not([data-ready]) :is(.journal-section:target, .journal-section:has(:target)) { display: grid !important; }
.game-shell:not([data-ready]) .journal-close, .game-shell:not([data-ready]) .journal-actions { display: none; }

.game-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 15;
  place-content: center;
  justify-items: center;
  gap: 13px;
  color: var(--hud-ink);
  background: #163f5f;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
html[data-game-boot="loading"] .game-loader { display: grid; }
.loading-ring {
  position: relative;
  width: 13px;
  height: 13px;
  border: 1px solid #d6fcff;
  border-radius: 50%;
  background: var(--hud-aqua);
  box-shadow: 0 0 10px #9ce9ef8c;
}
.loading-ring::after { content: ''; position: absolute; inset: 0; border: 1px solid var(--hud-aqua); border-radius: 50%; animation: map-loading 850ms ease-out infinite; }
@keyframes map-loading { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(2.8); } }

@media (prefers-reduced-motion: reduce) {
  .board-unit:active img { transform: none; }
  .loading-ring::after { animation: none; }
}

@media (max-width: 1050px) {
  .journal-section { grid-template: auto auto minmax(0, 1fr) / minmax(0, 1fr); }
  .journal-header { min-height: 44px; padding: 0 4px 0 13px; }
  .journal-index {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px 4px;
    padding: 4px 7px;
    border-right: 0;
    border-bottom: 1px solid #8dbfd139;
  }
  .journal-index a { min-height: 41px; padding: 4px 7px; font-size: 12px; }
  #content .journal-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(#career, #destinations) .journal-index { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  :is(#career, #destinations) .journal-index a { flex: 0 0 auto; }
  .journal-index small { display: none; }
  .journal-body { --journal-padding-start: 11px; padding: var(--journal-padding-start) 13px 19px; }
}

@media (max-width: 800px) {
  .map-controls { top: var(--edge); bottom: auto; }
  .game-dock { justify-content: space-evenly; width: min(365px, calc(100% - 24px)); }
  .game-dock a { padding-inline: 4px; }
  .map-journal {
    left: var(--edge);
    width: auto;
    height: min(66%, 540px, calc(100% - 150px));
  }
  .map-journal:has(#base:not([hidden]), #base-profile:target) { width: auto; }
  .music-error { top: calc(100% + 5px); bottom: auto; }
  .map-credit {
    left: 50%;
    bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 53px);
    transform: translateX(-50%);
    white-space: nowrap;
  }
  .campaign-board:has(.map-journal:not([hidden])) .map-credit { visibility: hidden; }
  .marker-name { font-size: 11px; }
  [data-overview] .board-marker {
    height: 44px;
    transform: translate(-50%, -22px) scale(var(--marker-scale));
    transform-origin: 50% 22px;
  }
  [data-overview] .marker-point { top: 22px; }
  [data-overview] .marker-name { flex: none; margin-top: 30px; padding: 2px 4px; font-size: 10px; }
  [data-overview] .marker-stop-seoul .marker-name {
    position: absolute;
    right: calc(50% + 8px);
    top: 14px;
    margin: 0;
  }
  [data-overview] .marker-stop-bangkok .marker-name { position: absolute; top: -7px; margin: 0; }
  [data-overview] .marker-stop-ho-chi-minh-city .marker-name { top: 22px; margin: 0; }
}
@media (max-width: 450px) {
  .game-header small span { display: none; }
}
@media (max-width: 370px) {
  .game-header a { gap: 6px; min-height: 52px; padding: 6px 8px 6px 6px; }
  .game-header img { width: 24px; height: 24px; }
  .game-header small { font-size: 10px; }
  .game-dock a { font-size: 10px; }
}
