@import url("./assets/design-jogo/design-system/tokens.css");

@font-face {
  font-family: "Saira";
  src: url("./assets/fontes/Saira[wdth,wght].ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
}

@font-face {
  font-family: "Saira";
  src: url("./assets/fontes/Saira-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Saira";
  src: url("./assets/fontes/Saira-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
}

@font-face {
  font-family: "Saira";
  src: url("./assets/fontes/Saira-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
}

@font-face {
  font-family: "Open Sans";
  src: url("./assets/fontes/TIPOLOGIA/OpenSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Open Sans";
  src: url("./assets/fontes/TIPOLOGIA/OpenSans-Semibold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
}

@font-face {
  font-family: "Open Sans";
  src: url("./assets/fontes/TIPOLOGIA/OpenSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

:root {
  --bg: #D3E3F4;
  --bg-soft: #C0CCD2;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #004B9B;
  --panel-secondary: #7B8C96;
  --line: rgba(123, 140, 150, 0.18);
  --line-strong: rgba(0, 75, 155, 0.22);
  --text: #333B41;
  --muted: #7B8C96;
  --accent: #F6921E;
  --accent-soft: rgba(246, 146, 30, 0.12);
  --success: #00904C;
  --warning: #FDC24E;
  --danger: #F6921E;
  --shadow: 0 24px 70px rgba(0, 42, 104, 0.12);
  --radius: 24px;
  --radius-sm: 16px;
  --font-display: "Saira", "Segoe UI", sans-serif;
  --font-heading: "Saira", "Segoe UI", sans-serif;
  --font-body: "Open Sans", "Segoe UI", sans-serif;
  --font-mono: "Saira", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(0, 75, 155, 0.1), transparent 28%),
    radial-gradient(circle at bottom right, rgba(147, 189, 228, 0.22), transparent 32%),
    linear-gradient(180deg, #D3E3F4 0%, #C0CCD2 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
  background-repeat: no-repeat;
  background-size: contain;
}

body::before {
  top: -18px;
  left: -10px;
  width: min(34vw, 420px);
  height: min(20vw, 220px);
  background-image: none;
}

body::after {
  right: -24px;
  bottom: -12px;
  width: min(38vw, 520px);
  height: min(22vw, 260px);
  opacity: 0.08;
  background-image: none;
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--panel-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(246, 146, 30, 0.6);
  box-shadow: 0 10px 24px rgba(0, 75, 155, 0.12);
}

button.primary {
  background: linear-gradient(135deg, #004B9B, #002A68);
  border-color: rgba(0, 42, 104, 0.45);
  color: #fff;
}

button.ghost {
  padding: 11px 14px;
}

.validation-reset {
  min-height: 42px;
}

.game-app {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: visible;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(135deg, #004B9B, #002A68 72%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  left: -24px;
  top: -14px;
  width: 260px;
  height: 74px;
  opacity: 0.24;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.topbar::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -72px;
  width: 420px;
  height: 180px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar .eyebrow,
.topbar h1 {
  position: relative;
  z-index: 1;
  color: #fff;
}

.topbar button {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.topbar .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
}

h1 {
  font-size: 31px;
  line-height: 1.04;
}

h2 {
  font-size: 22px;
}

p {
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
}

.topbar-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-chip,
.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-family: var(--font-display);
  color: #fff;
}

.layout {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  gap: 18px;
  min-height: 0;
  overflow: visible;
}

.layout.overlay-focus {
  display: block;
}

.board-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  position: relative;
}

.board-section::before,
.intro-hero::before,
.map-modal::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 88px;
  border-radius: var(--radius) var(--radius) 54px 54px;
  background: linear-gradient(135deg, #004B9B, #002A68);
  pointer-events: none;
}

.board-section > *,
.side-panel > *,
.intro-hero > *,
.map-modal > * {
  position: relative;
  z-index: 1;
}

.board-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-shrink: 0;
  padding-top: 10px;
}

.board-head .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.board-head h2 {
  color: #fff;
}

.board-head-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.board-stage {
  flex: 0 0 auto;
  width: 100%;
  min-height: auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}

.board-frame {
  position: relative;
  width: min(100%, 1180px);
  aspect-ratio: 15 / 8;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(9, 21, 27, 0.35), rgba(9, 21, 27, 0.16)),
    url("./assets/tabuleiro-e-layout/tabuleiro_v3.png") center/cover no-repeat;
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.board-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(8, 1fr);
  z-index: 1;
}

.route-assets,
.route-vehicles {
  position: absolute;
  inset: 0;
}

.route-assets {
  z-index: 2;
}

.route-vehicles {
  z-index: 5;
  pointer-events: none;
}

.board-cell {
  position: relative;
  border-right: 1px solid rgba(8, 18, 24, 0.45);
  border-bottom: 1px solid rgba(8, 18, 24, 0.45);
}

.board-cell.terrain-land {
  background: rgba(130, 163, 95, 0.2);
}

.board-cell.terrain-water {
  background: rgba(74, 149, 185, 0.22);
}

.board-cell.terrain-pending {
  background: rgba(246, 211, 101, 0.1);
}

.route-tile,
.route-train {
  position: absolute;
  width: calc(100% / 15);
  height: calc(100% / 8);
}

.route-tile {
  display: grid;
  place-items: center;
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease, scale 0.18s ease;
  z-index: 2;
}

.route-tile img,
.route-train img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.26));
  transition: filter 160ms ease;
}

.route-tile.station img {
  width: 88%;
  height: 88%;
}

.route-tile.station {
  z-index: 3;
}

.route-tile.station.locked img {
  opacity: 0.92;
  filter: saturate(0.82) brightness(0.84) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.26));
}

.route-tile.station.unlocked img {
  opacity: 1;
}

.route-tile.start img,
.route-tile.finish img {
  width: 92%;
  height: 92%;
}

.route-tile.completed {
  opacity: 1;
}

.route-tile.hidden {
  opacity: 0;
  pointer-events: none;
}

.route-tile.revealed {
  opacity: 0.26;
}

.route-tile.current {
  opacity: 1;
  transform: scale(1.04);
}

.route-tile.next {
  opacity: 1;
  filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0.1));
}

.route-tile.next::after,
.route-tile.current::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 16px;
  border: 2px solid rgba(246, 146, 30, 0.86);
  box-shadow: 0 0 0 4px rgba(246, 146, 30, 0.16);
}

.route-tile.current::after {
  border-color: rgba(0, 144, 76, 0.92);
  box-shadow: 0 0 0 4px rgba(0, 144, 76, 0.16);
}

.route-tile.content-track.completed,
.route-tile.terminal-track.completed,
.route-tile.content-track.next,
.route-tile.terminal-track.next,
.route-tile.content-track.current,
.route-tile.terminal-track.current {
  transform-origin: center;
}

.route-tile.content-track.completed:hover,
.route-tile.terminal-track.completed:hover,
.route-tile.content-track.next:hover,
.route-tile.terminal-track.next:hover,
.route-tile.content-track.current:hover,
.route-tile.terminal-track.current:hover {
  filter: brightness(1.06);
  transform: scale(0.94);
}

.route-tile.content-track.completed:hover img,
.route-tile.terminal-track.completed:hover img,
.route-tile.content-track.next:hover img,
.route-tile.terminal-track.next:hover img,
.route-tile.content-track.current:hover img,
.route-tile.terminal-track.current:hover img {
  filter:
    drop-shadow(0 12px 24px rgba(0, 52, 111, 0.26))
    drop-shadow(0 0 18px rgba(246, 146, 30, 0.52))
    drop-shadow(0 0 6px rgba(255, 255, 255, 0.82));
}

.route-tile.reviewable {
  cursor: pointer;
  z-index: 3;
  transform-origin: center;
  transition: transform 160ms ease, filter 160ms ease;
}

.route-tile.reviewable:hover {
  transform: scale(0.94);
  filter: brightness(1.06);
}

.route-tile.reviewable:focus-visible {
  transform: scale(0.94);
  filter: brightness(1.06);
  outline: none;
}

.route-tile.reviewable img {
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 12px rgba(223, 135, 87, 0.18));
}

.route-tile.reviewable .route-label {
  background: rgba(246, 146, 30, 0.96);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  font-weight: 700;
}

.route-tile.content-track.hidden,
.route-tile.terminal-track.hidden {
  opacity: 0;
  visibility: hidden;
}

.route-tile.content-track.completed,
.route-tile.terminal-track.completed {
  opacity: 1;
}

.route-label {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  min-width: 58px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 75, 155, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 10px;
  font-family: var(--font-display);
  text-align: center;
  color: #fff;
  z-index: 3;
}

.route-train {
  display: grid;
  place-items: center;
}

.journey-footer {
  flex-shrink: 0;
  min-height: 0;
  display: grid;
  gap: 10px;
  overflow: hidden;
}

.wagon-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  overflow: hidden;
}

.wagon-card,
.status-box,
.turn-card,
.history-entry,
.offer-card,
.terminal-choice,
.task-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 246, 0.98));
}

.wagon-card,
.status-box,
.turn-card,
.history-entry,
.task-card {
  padding: 10px;
}

.wagon-card img {
  width: 100%;
  aspect-ratio: 3.4 / 1;
  object-fit: contain;
  display: block;
  margin-bottom: 6px;
}

.wagon-card.locked img {
  opacity: 0.25;
}

.side-panel {
  flex: 0 0 min(420px, 32vw);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 320px;
  min-height: auto;
  overflow: visible;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 247, 249, 0.98));
}

.side-panel.is-hidden {
  display: none;
}

.status-card {
  display: grid;
  gap: 6px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.status-box {
  padding: 9px 8px 8px;
  text-align: center;
}

.status-box strong {
  display: block;
  margin-bottom: 3px;
  font-size: 24px;
  line-height: 1;
}

.status-box-highlight {
  border-color: rgba(0, 75, 155, 0.2);
  background:
    linear-gradient(180deg, rgba(147, 189, 228, 0.22), rgba(255, 255, 255, 0.9)),
    rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.status-box span,
.wagon-card p,
.wagon-card strong {
  font-size: 10px;
  line-height: 1.2;
}

.wagon-card {
  min-width: 0;
  padding: 5px 4px;
  text-align: center;
  border-radius: 12px;
}

.wagon-card strong {
  display: block;
  margin-bottom: 1px;
}

.wagon-card p:last-child {
  opacity: 0.88;
}

.wagon-card p:nth-of-type(2) {
  display: none;
}

.wagon-card img {
  width: 100%;
  max-width: 44px;
  height: 24px;
  aspect-ratio: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 3px;
}

.wagon-card strong,
.wagon-card p {
  font-size: 8px;
  line-height: 1.05;
}

.experience-card {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
  display: grid;
  gap: 14px;
  align-content: start;
  align-items: start;
}

.turn-card {
  display: grid;
  gap: 10px;
  align-content: start;
  color: var(--text);
}

.turn-card-feedback {
  min-height: 260px;
  align-content: center;
}

.turn-card-offer {
  align-content: start;
  justify-items: center;
  gap: 10px;
  padding-block: 6px;
  text-align: center;
}

.turn-card-offer > * {
  width: 100%;
}

.turn-card-offer h3,
.turn-card-offer p {
  max-width: 30rem;
  justify-self: center;
}

.turn-card h3 {
  font-size: 20px;
  color: var(--panel-strong);
}

.turn-card p strong,
.turn-card strong {
  color: var(--text);
}

.action-row,
.offer-grid,
.metrics-row,
.task-list,
.choice-list,
.history-list {
  display: grid;
  gap: 12px;
}

.action-row {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.metrics-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.offer-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.offer-card,
.terminal-choice {
  padding: 12px;
  text-align: left;
}

.turn-card-offer .offer-grid {
  width: min(100%, 22rem);
  justify-self: center;
}

.turn-card-offer .offer-card {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 164px;
  padding: 10px 8px;
  text-align: center;
}

.offer-card img {
  width: 100%;
  max-width: 112px;
  height: 82px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}

.offer-card.selected {
  border-color: rgba(0, 75, 155, 0.44);
  background: var(--accent-soft);
}

.turn-card-offer .action-row {
  width: min(100%, 22rem);
  justify-self: center;
}

.feedback {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.94);
}

.feedback.good {
  border-color: rgba(0, 144, 76, 0.3);
  background: rgba(0, 144, 76, 0.09);
  color: #136440;
}

.feedback.bad {
  border-color: rgba(246, 146, 30, 0.36);
  background: rgba(246, 146, 30, 0.12);
  color: #8d4f11;
}

.feedback.warn {
  border-color: rgba(253, 194, 78, 0.5);
  background: rgba(253, 194, 78, 0.16);
  color: #7c5a0e;
}

.terminal-feedback-screen {
  display: grid;
  align-items: center;
  min-height: 140px;
}

.terminal-feedback-screen .feedback {
  padding: 18px 20px;
  font-size: 1.05rem;
  line-height: 1.55;
}

.map-modal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.98);
  border: none;
  box-shadow: none;
  pointer-events: auto;
  overflow: hidden;
  animation: mapModalEnter 240ms ease-out both;
}

.map-modal::before {
  display: none;
}

.map-overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  padding: 0;
  background: rgba(0, 42, 104, 0.18);
  backdrop-filter: none;
  overflow: hidden;
}

.map-overlay-layer.has-modal {
  display: block;
  pointer-events: auto;
}

.map-modal-head,
.map-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-modal-head {
  flex: 0 0 auto;
  min-height: 64px;
  padding: 12px clamp(14px, 2vw, 28px);
  background: rgba(0, 44, 96, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}

.map-modal-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.map-modal-head .eyebrow {
  color: rgba(255, 255, 255, 0.7);
}

.map-modal-head h3 {
  font-size: clamp(17px, 1.8vw, 24px);
  line-height: 1.15;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  gap: 0;
  padding: 0;
  scrollbar-gutter: auto;
}

.map-modal-content {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.map-modal-content .map-modal-body {
  justify-items: stretch;
  align-content: stretch;
  grid-auto-rows: minmax(0, 1fr);
}

.content-embed-shell {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  aspect-ratio: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  border-radius: 0;
  border: none;
  background: #fff;
  overflow: hidden;
}

.map-modal-content .content-embed-shell,
.map-modal-content .content-video-shell {
  width: 100%;
  height: 100%;
  max-width: 100%;
  margin-inline: auto;
}

.map-modal-content .content-embed-shell {
  min-height: 0;
}

.content-video-shell {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  aspect-ratio: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  border-radius: 0;
  border: none;
  background: #05070c;
  overflow: hidden;
}

.content-embed-shell.content-video-shell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-modal-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  min-height: 0;
  margin-left: auto;
}

.map-modal-actions button {
  min-height: 40px;
  padding: 9px 14px;
}

.content-embed-shell > * {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: 100%;
}

.content-embed-shell iframe,
.content-embed-shell .genially-embed,
.content-embed-shell .container-wrapper-genially {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  border: none !important;
}

.content-video-shell > * {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: 100%;
}

.content-embed-shell.content-video-shell > .content-video-shell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.content-video-shell video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.45);
  border-radius: calc(var(--radius-sm) - 2px);
}

.content-video-fallback {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 2;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.content-video-fallback[hidden] {
  display: none;
}

.content-video-fallback p {
  margin: 0 0 6px;
}

.content-video-fallback a {
  color: var(--panel-strong);
  font-weight: 800;
}

.map-modal-content .content-video-shell {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-modal-content .content-video-shell video {
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.overlay-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(253, 194, 78, 0.42);
  background: rgba(253, 194, 78, 0.18);
  color: #7c5a0e;
}

.map-modal-head .overlay-progress-copy {
  max-width: min(540px, 46vw);
  padding: 9px 12px;
  border-radius: 10px;
  color: #fff;
  background: rgba(253, 194, 78, 0.2);
  border-color: rgba(253, 194, 78, 0.45);
}

@keyframes mapModalEnter {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Design system v2 integration */
:root {
  --bg: var(--steel-900);
  --bg-soft: var(--steel-800);
  --panel: var(--surface-card);
  --panel-strong: var(--fips-blue-500);
  --panel-secondary: var(--steel-300);
  --line: var(--border-subtle);
  --line-strong: var(--border-default);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --accent: var(--fips-orange-400);
  --accent-soft: rgba(246, 146, 30, 0.14);
  --shadow: var(--shadow-lift);
  --radius: var(--radius-lg);
}

body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(26, 58, 92, 0.92) 0%, rgba(10, 14, 20, 0) 62%),
    linear-gradient(180deg, var(--steel-900) 0%, #070a0f 100%);
  color: var(--text-primary);
}

body::before,
body::after {
  opacity: 0.08;
  filter: brightness(0) invert(1);
}

.game-app {
  gap: var(--space-4);
  padding: var(--space-4);
}

.panel,
.wagon-card,
.status-box,
.turn-card,
.history-entry,
.offer-card,
.terminal-choice,
.task-card {
  border: 1px solid var(--border-default);
  background: linear-gradient(180deg, rgba(31, 37, 45, 0.98), rgba(19, 24, 32, 0.98));
  box-shadow: var(--shadow-flat);
  color: var(--text-primary);
}

.topbar {
  min-height: var(--topbar-h);
  justify-content: flex-start;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  border-bottom: 3px solid var(--fips-orange-400);
  background: linear-gradient(180deg, var(--steel-700) 0%, var(--steel-800) 100%);
  box-shadow: var(--shadow-flat-lg);
}

.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  top: auto;
  bottom: -3px;
  height: 12px;
  opacity: 1;
  border-radius: 0;
  background: repeating-linear-gradient(45deg, var(--fips-orange-400) 0 8px, var(--steel-900) 8px 16px);
}

.topbar::before {
  left: 0;
  width: 72px;
}

.topbar::after {
  right: 0;
  width: 72px;
}

.avatar-maquinista {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: grid;
  place-items: center;
  border: 3px solid var(--steel-900);
  border-radius: 50%;
  background: var(--grad-orange-cta);
  box-shadow: 0 4px 0 0 var(--fips-orange-700), 0 0 0 4px rgba(246, 146, 30, 0.25);
}

.avatar-face {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--steel-900);
  color: var(--fips-orange-300);
  font-family: var(--font-display);
  font-size: 20px;
}

.topbar-actions {
  margin-left: auto;
}

.progress-chip,
.mini-badge {
  min-height: 36px;
  border-radius: var(--radius-pill);
  border-color: var(--border-default);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-inset);
}

button.primary {
  color: var(--steel-900);
  background: var(--grad-orange-cta);
  border: var(--stroke-cartoon) solid var(--steel-900);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 0 0 var(--fips-orange-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 0 var(--fips-orange-700), var(--shadow-glow-orange);
}

button.ghost {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-primary);
}

.board-section,
.side-panel {
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(31, 37, 45, 0.98), rgba(19, 24, 32, 0.98));
}

.board-section::before,
.intro-hero::before {
  display: none;
}

.board-head {
  padding-top: 0;
}

.board-head .eyebrow,
.topbar .eyebrow,
.intro-hero .eyebrow,
.eyebrow {
  color: var(--fips-orange-400);
}

.board-head h2,
.turn-card h3,
h1,
h2,
h3 {
  color: var(--text-primary);
}

p,
.status-box span,
.wagon-card p {
  color: var(--text-secondary);
}

.board-frame {
  border: 3px solid var(--steel-700);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(10, 17, 26, 0.36), rgba(10, 17, 26, 0.16)),
    url("./assets/tabuleiro-e-layout/tabuleiro_v3.png") center/cover no-repeat;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.04), var(--shadow-flat-lg);
}

.board-frame::before,
.board-frame::after {
  content: "";
  position: absolute;
  z-index: 6;
  width: 24px;
  height: 24px;
  pointer-events: none;
  border: 3px solid var(--fips-orange-400);
}

.board-frame::before {
  top: 8px;
  left: 8px;
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 8px;
}

.board-frame::after {
  right: 8px;
  bottom: 8px;
  border-left: 0;
  border-top: 0;
  border-bottom-right-radius: 8px;
}

.board-cell {
  border-right-color: rgba(10, 14, 20, 0.28);
  border-bottom-color: rgba(10, 14, 20, 0.28);
}

.board-cell.terrain-land {
  background:
    repeating-linear-gradient(45deg, transparent 0 8px, rgba(255, 255, 255, 0.025) 8px 9px),
    linear-gradient(135deg, rgba(216, 195, 151, 0.42), rgba(182, 157, 111, 0.42));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.board-cell.terrain-water {
  background: linear-gradient(180deg, rgba(107, 182, 217, 0.54), rgba(15, 92, 130, 0.58));
  background-size: 200% 100%;
  animation: wave-shimmer 4s infinite ease-in-out;
}

.route-tile {
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-med) var(--ease-bounce), filter var(--dur-fast) var(--ease-out);
}

.route-tile.completed:not(.station) {
  animation: tile-land 520ms var(--ease-bounce) both;
}

.route-tile img,
.route-train img {
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.22)) drop-shadow(0 14px 18px rgba(0, 0, 0, 0.32));
}

.route-tile.station.locked img {
  opacity: 0.86;
  filter: grayscale(0.85) brightness(0.55) drop-shadow(0 8px 0 rgba(0, 0, 0, 0.28));
}

.route-tile.station.next::before,
.route-tile.next::after,
.route-tile.current::after {
  border-color: var(--fips-orange-400);
  box-shadow: 0 0 0 4px rgba(246, 146, 30, 0.16), var(--shadow-glow-orange);
}

.route-train {
  animation: chuga 680ms infinite var(--ease-snap);
}

.side-panel {
  background:
    linear-gradient(180deg, rgba(19, 24, 32, 0.98), rgba(10, 14, 20, 0.98));
}

.turn-card {
  gap: var(--space-3);
}

.turn-card h3 {
  font-size: var(--fs-h3);
}

.offer-card {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-flat);
}

.offer-card:hover {
  transform: translateY(-6px) rotate(-1deg);
}

.offer-card.selected {
  border-color: var(--fips-orange-400);
  background: rgba(246, 146, 30, 0.14);
  box-shadow: var(--shadow-glow-orange), var(--shadow-flat);
}

.status-box-highlight {
  border-color: rgba(246, 146, 30, 0.28);
  background: linear-gradient(180deg, rgba(246, 146, 30, 0.14), rgba(31, 37, 45, 0.92));
}

.status-box strong {
  color: var(--fips-orange-300);
  font-family: var(--font-mono);
}

.wagon-card.locked {
  opacity: 0.42;
}

.intro-overlay {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(26, 58, 92, 0.96) 0%, rgba(10, 14, 20, 0.98) 70%),
    linear-gradient(180deg, var(--steel-900), #070a0f);
}

.intro-hero {
  width: min(760px, 100%);
  gap: var(--space-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(31, 37, 45, 0.92), rgba(10, 14, 20, 0.96));
  box-shadow: var(--shadow-modal);
}

.intro-hero h2 {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  line-height: 1.08;
  text-shadow: 0 4px 0 var(--fips-blue-700), 0 12px 28px rgba(0, 0, 0, 0.55);
}

.intro-hero p:not(.eyebrow) {
  color: var(--text-secondary);
}

.map-overlay-layer {
  background: rgba(10, 14, 20, 0.72);
  backdrop-filter: blur(4px);
}

/* Final override: content modal covers the viewport with 20px edge padding. */
body > .map-overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: stretch;
  padding: 20px;
  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

body > .map-overlay-layer.has-modal {
  display: grid;
  pointer-events: auto;
}

body > .map-overlay-layer .map-modal,
body > .map-overlay-layer .map-modal.map-modal-content,
body > .map-overlay-layer .map-modal.map-modal-terminal,
body > .map-overlay-layer .map-modal.map-modal-station {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 3px solid var(--fips-orange-400);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--steel-800), var(--steel-900));
  box-shadow: var(--shadow-modal);
  animation: mapModalEnter var(--dur-med) var(--ease-bounce) both;
}

body > .map-overlay-layer .map-modal-head {
  min-height: 50px;
  padding: 8px clamp(12px, 1.6vw, 20px);
  background: linear-gradient(180deg, var(--steel-700), var(--steel-800));
  border-bottom: 3px solid var(--fips-orange-400);
}

body > .map-overlay-layer .map-modal-head .eyebrow {
  margin-bottom: 2px;
}

body > .map-overlay-layer .map-modal-head h3 {
  font-size: clamp(15px, 1.35vw, 20px);
  line-height: 1.08;
}

body > .map-overlay-layer .map-modal-actions {
  width: auto;
  margin-left: auto;
}

body > .map-overlay-layer .map-modal-actions button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-default);
}

body > .map-overlay-layer .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-content .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-terminal .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-station .map-modal-body {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: clamp(6px, 1vw, 12px);
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 146, 30, 0.08), transparent 34%),
    var(--steel-900);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  height: auto;
  min-height: 0;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 3px solid rgba(246, 146, 30, 0.55);
  border-radius: var(--radius-sm);
  background: #05070c;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.48),
    0 0 34px rgba(246, 146, 30, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body > .map-overlay-layer .map-modal-foot {
  min-height: 58px;
  padding: 8px clamp(12px, 1.6vw, 20px);
}

body > .map-overlay-layer .map-modal-foot .primary {
  min-height: 40px;
  min-width: 150px;
  padding: 9px 16px;
}

body > .map-overlay-layer .map-modal-foot .overlay-progress-copy {
  font-size: 11px;
}

body > .map-overlay-layer .overlay-progress-track {
  height: 9px;
}

/* Top controls only: final cascade guard. */
body > .map-overlay-layer .map-modal-head {
  min-height: 62px;
}

body > .map-overlay-layer .map-modal-actions {
  flex: 0 1 min(620px, 58vw);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 280px;
  width: auto;
  margin-left: auto;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-panel {
  flex: 1 1 340px;
  min-width: 220px;
  gap: 6px;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  font-size: 11px;
  line-height: 1.2;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy span:last-child {
  flex: 0 0 auto;
  color: var(--fips-orange-300);
  font-family: var(--font-mono);
  font-weight: 700;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-track {
  height: 9px;
}

body > .map-overlay-layer .map-modal-actions .primary {
  flex: 0 0 auto;
  min-width: 150px;
  min-height: 40px;
  padding: 9px 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--steel-900);
  background: var(--grad-orange-cta);
  border: var(--stroke-cartoon) solid var(--steel-900);
  box-shadow: var(--shadow-flat);
}

body > .map-overlay-layer .map-modal-actions .primary:disabled {
  cursor: not-allowed;
  transform: none;
  color: var(--steel-300);
  background: linear-gradient(180deg, var(--steel-600), var(--steel-700));
  border-color: rgba(0, 0, 0, 0.45);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.32);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: min(100%, calc((100vh - 108px) * 16 / 9));
}

body > .map-overlay-layer .map-modal-foot {
  display: none;
}

@media (max-width: 920px) {
  body > .map-overlay-layer .map-modal-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  body > .map-overlay-layer .map-modal-actions {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  body > .map-overlay-layer .map-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body > .map-overlay-layer .map-modal-actions .primary {
    width: 100%;
    min-width: 0;
  }

  body > .map-overlay-layer .content-embed-shell,
  body > .map-overlay-layer .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
    width: 100%;
  }
}

/* Ajustes v2: escolha de trilhos como momento central de decisão. */
.turn-card-offer {
  position: relative;
  isolation: isolate;
  width: min(100%, 560px);
  justify-self: center;
  padding: clamp(16px, 2.2vw, 24px);
  border: 3px solid rgba(246, 146, 30, 0.72);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 0%, rgba(250, 167, 60, 0.18), transparent 48%),
    linear-gradient(180deg, rgba(31, 37, 45, 0.98), rgba(10, 14, 20, 0.96));
  color: var(--text-primary);
  box-shadow: var(--shadow-modal), 0 0 32px rgba(246, 146, 30, 0.16);
}

.turn-card-offer::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--radius-md) - 4px);
  pointer-events: none;
}

.turn-card-offer h3 {
  max-width: 28rem;
  color: var(--steel-50);
  font-family: var(--font-heading);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.08;
}

.turn-card-offer p {
  max-width: 27rem;
  color: var(--steel-200);
}

.turn-card-offer .offer-grid {
  width: min(100%, 420px);
  gap: clamp(8px, 1.6vw, 14px);
  margin-block: 4px;
}

.turn-card-offer .offer-card {
  min-height: clamp(112px, 13vw, 150px);
  padding: clamp(8px, 1.2vw, 12px);
  border: 2px solid #3A3F47;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, rgba(239, 227, 194, 0.98), rgba(182, 157, 111, 0.95));
  color: var(--steel-900);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  animation: offer-enter 280ms var(--ease-out) forwards;
  animation-delay: calc(var(--offer-index, 0) * 80ms);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    filter var(--dur-fast) var(--ease-out);
}

.turn-card-offer .offer-card:hover,
.turn-card-offer .offer-card:focus-visible {
  border-color: var(--fips-orange-300);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.36), 0 0 18px rgba(250, 167, 60, 0.58);
  filter: brightness(1.04);
}

.turn-card-offer .offer-card.selected {
  border: 3px solid var(--fips-blue-500);
  background:
    radial-gradient(circle at 50% 10%, rgba(250, 167, 60, 0.34), transparent 52%),
    linear-gradient(135deg, rgba(239, 227, 194, 1), rgba(182, 157, 111, 0.98));
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.38), 0 0 24px rgba(250, 167, 60, 0.64);
}

.turn-card-offer .offer-card.bad {
  animation: offer-shake 300ms var(--ease-snap), offer-enter 1ms linear forwards;
}

.turn-card-offer .offer-card.good {
  border-color: var(--success);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.38), 0 0 26px rgba(46, 204, 113, 0.64);
}

.turn-card-offer .offer-card img {
  max-width: clamp(68px, 8vw, 104px);
  height: clamp(58px, 7vw, 82px);
  margin-bottom: 8px;
  filter: drop-shadow(0 7px 6px rgba(0, 0, 0, 0.22));
}

.turn-card-offer .offer-card strong {
  color: var(--steel-900);
  font-family: var(--font-heading);
  font-size: clamp(12px, 1.25vw, 14px);
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.turn-card-offer .action-row {
  width: min(100%, 280px);
}

.turn-card-offer .feedback {
  width: min(100%, 420px);
  justify-self: center;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

body > .map-overlay-layer .map-modal.map-modal-intro {
  place-self: center;
  width: min(520px, calc(100vw - 32px));
  height: auto;
  max-height: calc(100vh - 32px);
  border: 3px solid var(--fips-orange-400);
  border-radius: var(--radius-md);
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(250, 167, 60, 0.2), transparent 48%),
    linear-gradient(180deg, var(--steel-800), var(--steel-900));
}

body > .map-overlay-layer .map-modal.map-modal-intro .map-modal-head {
  min-height: auto;
  padding: 20px 22px 12px;
  border-bottom: 3px solid var(--fips-orange-400);
}

body > .map-overlay-layer .map-modal.map-modal-intro .map-modal-head h3 {
  color: var(--steel-50);
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1;
}

body > .map-overlay-layer .map-modal.map-modal-intro .map-modal-body {
  padding: 22px;
}

.intro-cinematic-copy {
  display: grid;
  gap: 16px;
  color: var(--steel-100);
  font-size: 15px;
  line-height: 1.6;
}

.intro-cinematic-copy .primary {
  justify-self: start;
  min-width: 160px;
}

@keyframes offer-enter {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes offer-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-1deg); }
  40% { transform: translateX(7px) rotate(1deg); }
  60% { transform: translateX(-5px) rotate(-1deg); }
  80% { transform: translateX(5px) rotate(1deg); }
}

@media (max-width: 760px) {
  .turn-card-offer .offer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .turn-card-offer {
    padding: 14px;
  }

  .turn-card-offer .offer-grid {
    grid-template-columns: 1fr;
    width: min(100%, 220px);
  }

  .turn-card-offer .offer-card {
    min-height: 96px;
  }

  body > .map-overlay-layer .map-modal.map-modal-intro {
    width: 100%;
    min-height: 100%;
    border-radius: 0;
  }
}

body > .map-overlay-layer .content-embed-shell > *,
body > .map-overlay-layer .content-embed-shell iframe,
body > .map-overlay-layer .content-embed-shell .genially-embed,
body > .map-overlay-layer .content-embed-shell .container-wrapper-genially {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

@media (max-width: 767px) {
  body > .map-overlay-layer {
    padding: 20px;
  }

  body > .map-overlay-layer .map-modal-head {
    align-items: flex-start;
    flex-wrap: nowrap;
    padding: 8px 10px;
  }

  body > .map-overlay-layer .map-modal-head h3 {
    white-space: normal;
    font-size: 16px;
  }

  body > .map-overlay-layer .content-embed-shell,
  body > .map-overlay-layer .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* Content emphasis: keep this at the end of the file. */
body > .map-overlay-layer .map-modal-head {
  min-height: 62px;
  padding: 8px clamp(12px, 1.6vw, 20px);
}

body > .map-overlay-layer .map-modal-head .eyebrow {
  margin-bottom: 2px;
}

body > .map-overlay-layer .map-modal-head h3 {
  font-size: clamp(15px, 1.35vw, 20px);
  line-height: 1.08;
}

body > .map-overlay-layer .map-modal-actions {
  flex: 0 1 min(620px, 58vw);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 280px;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-panel {
  flex: 1 1 340px;
  min-width: 220px;
  gap: 6px;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  font-size: 11px;
  line-height: 1.2;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy span:last-child {
  flex: 0 0 auto;
  color: var(--fips-orange-300);
  font-family: var(--font-mono);
  font-weight: 700;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-track {
  height: 9px;
}

body > .map-overlay-layer .map-modal-actions .primary {
  flex: 0 0 auto;
  min-width: 150px;
  min-height: 40px;
  padding: 9px 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--steel-900);
  background: var(--grad-orange-cta);
  border: var(--stroke-cartoon) solid var(--steel-900);
  box-shadow: var(--shadow-flat);
}

body > .map-overlay-layer .map-modal-actions .primary:disabled {
  cursor: not-allowed;
  transform: none;
  color: var(--steel-300);
  background: linear-gradient(180deg, var(--steel-600), var(--steel-700));
  border-color: rgba(0, 0, 0, 0.45);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.32);
}

body > .map-overlay-layer .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-content .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-terminal .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-station .map-modal-body {
  padding: clamp(6px, 1vw, 12px);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: min(100%, calc((100vh - 108px) * 16 / 9));
  border: 3px solid rgba(246, 146, 30, 0.55);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.48),
    0 0 34px rgba(246, 146, 30, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body > .map-overlay-layer .map-modal-foot {
  display: none;
}

body > .map-overlay-layer .map-modal-foot .primary {
  min-height: 40px;
  min-width: 150px;
  padding: 9px 16px;
}

body > .map-overlay-layer .map-modal-foot .overlay-progress-copy {
  font-size: 11px;
}

body > .map-overlay-layer .overlay-progress-track {
  height: 9px;
}

@media (max-width: 920px) {
  body > .map-overlay-layer .map-modal-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  body > .map-overlay-layer .map-modal-actions {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  body > .map-overlay-layer .map-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body > .map-overlay-layer .map-modal-actions .primary {
    width: 100%;
    min-width: 0;
  }

  body > .map-overlay-layer .content-embed-shell,
  body > .map-overlay-layer .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
    width: 100%;
  }
}

/* Final override: content modal covers the viewport with 20px edge padding. */
body > .map-overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: stretch;
  padding: 20px;
  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

body > .map-overlay-layer.has-modal {
  display: grid;
  pointer-events: auto;
}

body > .map-overlay-layer .map-modal,
body > .map-overlay-layer .map-modal.map-modal-content,
body > .map-overlay-layer .map-modal.map-modal-terminal,
body > .map-overlay-layer .map-modal.map-modal-station {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 3px solid var(--fips-orange-400);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--steel-800), var(--steel-900));
  box-shadow: var(--shadow-modal);
  animation: mapModalEnter var(--dur-med) var(--ease-bounce) both;
}

body > .map-overlay-layer .map-modal-head {
  min-height: 50px;
  padding: 8px clamp(12px, 1.6vw, 20px);
  background: linear-gradient(180deg, var(--steel-700), var(--steel-800));
  border-bottom: 3px solid var(--fips-orange-400);
}

body > .map-overlay-layer .map-modal-head .eyebrow {
  margin-bottom: 2px;
}

body > .map-overlay-layer .map-modal-head h3 {
  font-size: clamp(15px, 1.35vw, 20px);
  line-height: 1.08;
}

body > .map-overlay-layer .map-modal-actions {
  width: auto;
  margin-left: auto;
}

body > .map-overlay-layer .map-modal-actions button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-default);
}

body > .map-overlay-layer .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-content .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-terminal .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-station .map-modal-body {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: clamp(6px, 1vw, 12px);
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 146, 30, 0.08), transparent 34%),
    var(--steel-900);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  height: auto;
  min-height: 0;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 3px solid rgba(246, 146, 30, 0.55);
  border-radius: var(--radius-sm);
  background: #05070c;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.48),
    0 0 34px rgba(246, 146, 30, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body > .map-overlay-layer .map-modal-foot {
  min-height: 58px;
  padding: 8px clamp(12px, 1.6vw, 20px);
}

body > .map-overlay-layer .map-modal-foot .primary {
  min-height: 40px;
  min-width: 150px;
  padding: 9px 16px;
}

body > .map-overlay-layer .map-modal-foot .overlay-progress-copy {
  font-size: 11px;
}

body > .map-overlay-layer .overlay-progress-track {
  height: 9px;
}

body > .map-overlay-layer .content-embed-shell > *,
body > .map-overlay-layer .content-embed-shell iframe,
body > .map-overlay-layer .content-embed-shell .genially-embed,
body > .map-overlay-layer .content-embed-shell .container-wrapper-genially {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

@media (max-width: 767px) {
  body > .map-overlay-layer {
    padding: 20px;
  }

  body > .map-overlay-layer .map-modal-head {
    align-items: flex-start;
    flex-wrap: nowrap;
    padding: 8px 10px;
  }

  body > .map-overlay-layer .map-modal-head h3 {
    white-space: normal;
    font-size: 16px;
  }

  body > .map-overlay-layer .content-embed-shell,
  body > .map-overlay-layer .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* Modal sobreposto ao tabuleiro conforme design-system-guide.md */
.board-stage > .map-overlay-layer {
  position: absolute;
  inset: 0;
  z-index: var(--modal-z);
  display: none;
  place-items: center;
  padding: clamp(10px, 2vw, 22px);
  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

.board-stage > .map-overlay-layer.has-modal {
  display: grid;
  pointer-events: auto;
}

.board-stage > .map-overlay-layer .map-modal,
.board-stage > .map-overlay-layer .map-modal.map-modal-content,
.board-stage > .map-overlay-layer .map-modal.map-modal-terminal,
.board-stage > .map-overlay-layer .map-modal.map-modal-station {
  position: relative;
  inset: auto;
  width: min(94%, 980px);
  height: min(92%, 720px);
  max-width: 980px;
  max-height: calc(100% - 4px);
  border: 3px solid var(--fips-orange-400);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--steel-800), var(--steel-900));
  box-shadow: var(--shadow-modal);
  animation: mapModalEnter var(--dur-med) var(--ease-bounce) both;
}

.board-stage > .map-overlay-layer .map-modal-head {
  min-height: 60px;
  padding: 10px clamp(14px, 2vw, 24px);
  background: linear-gradient(180deg, var(--steel-700), var(--steel-800));
  border-bottom: 3px solid var(--fips-orange-400);
}

.board-stage > .map-overlay-layer .map-modal-actions {
  width: auto;
  margin-left: auto;
}

.board-stage > .map-overlay-layer .map-modal-actions button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-default);
}

.board-stage > .map-overlay-layer .map-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(10px, 1.6vw, 16px);
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 146, 30, 0.08), transparent 34%),
    var(--steel-900);
}

.board-stage > .map-overlay-layer .content-embed-shell,
.board-stage > .map-overlay-layer .content-video-shell,
.board-stage > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
.board-stage > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
.board-stage > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell {
  width: min(100%, 900px);
  height: auto;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #05070c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.board-stage > .map-overlay-layer .content-embed-shell > *,
.board-stage > .map-overlay-layer .content-embed-shell iframe,
.board-stage > .map-overlay-layer .content-embed-shell .genially-embed,
.board-stage > .map-overlay-layer .content-embed-shell .container-wrapper-genially {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

.map-modal-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 12px clamp(14px, 2vw, 24px);
  background: linear-gradient(180deg, var(--steel-800), var(--steel-700));
  border-top: 1px solid var(--border-default);
}

.map-modal-foot .primary {
  flex: 0 0 auto;
  min-width: 170px;
  min-height: 44px;
  padding: 12px 18px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--steel-900);
  background: var(--grad-orange-cta);
  border: var(--stroke-cartoon) solid var(--steel-900);
  box-shadow: var(--shadow-flat);
}

.map-modal-foot .primary:disabled {
  cursor: not-allowed;
  transform: none;
  color: var(--steel-300);
  background: linear-gradient(180deg, var(--steel-600), var(--steel-700));
  border-color: rgba(0, 0, 0, 0.45);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.32);
}

.overlay-progress-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.map-modal-foot .overlay-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 12px;
}

.map-modal-foot .overlay-progress-copy span:last-child {
  flex: 0 0 auto;
  color: var(--fips-orange-300);
  font-family: var(--font-mono);
  font-weight: 700;
}

.overlay-progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-default);
}

.overlay-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--fips-orange-400), var(--fips-orange-300));
  box-shadow: var(--shadow-glow-orange);
  transition: width var(--dur-med) var(--ease-out);
}

@keyframes mapModalEnter {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 767px) {
  .board-stage > .map-overlay-layer {
    padding: 8px;
  }

  .board-stage > .map-overlay-layer .map-modal,
  .board-stage > .map-overlay-layer .map-modal.map-modal-content,
  .board-stage > .map-overlay-layer .map-modal.map-modal-terminal,
  .board-stage > .map-overlay-layer .map-modal.map-modal-station {
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    border-radius: var(--radius-sm);
  }

  .board-stage > .map-overlay-layer .map-modal-head {
    align-items: flex-start;
    flex-wrap: nowrap;
    padding: 8px 10px;
  }

  .board-stage > .map-overlay-layer .map-modal-head h3 {
    white-space: normal;
    font-size: 16px;
  }

  .board-stage > .map-overlay-layer .content-embed-shell:has(iframe),
  .board-stage > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell:has(iframe),
  .board-stage > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell:has(iframe),
  .board-stage > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell:has(iframe) {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .map-modal-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    padding: 10px;
  }

  .map-modal-foot .primary {
    width: 100%;
    min-width: 0;
  }
}

.intro-overlay {
  overflow: hidden;
}

/* Viewport modal override: 20px from every screen edge */
body > .map-overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: stretch;
  padding: 20px;
  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

body > .map-overlay-layer.has-modal {
  display: grid;
  pointer-events: auto;
}

body > .map-overlay-layer .map-modal,
body > .map-overlay-layer .map-modal.map-modal-content,
body > .map-overlay-layer .map-modal.map-modal-terminal,
body > .map-overlay-layer .map-modal.map-modal-station {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 3px solid var(--fips-orange-400);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--steel-800), var(--steel-900));
  box-shadow: var(--shadow-modal);
  animation: mapModalEnter var(--dur-med) var(--ease-bounce) both;
}

body > .map-overlay-layer .map-modal-head {
  min-height: 60px;
  padding: 10px clamp(14px, 2vw, 24px);
  background: linear-gradient(180deg, var(--steel-700), var(--steel-800));
  border-bottom: 3px solid var(--fips-orange-400);
}

body > .map-overlay-layer .map-modal-actions {
  width: auto;
  margin-left: auto;
}

body > .map-overlay-layer .map-modal-actions button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-default);
}

body > .map-overlay-layer .map-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(10px, 1.6vw, 18px);
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 146, 30, 0.08), transparent 34%),
    var(--steel-900);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell {
  width: min(100%, calc((100vh - 192px) * 16 / 9));
  height: auto;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #05070c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body > .map-overlay-layer .content-embed-shell > *,
body > .map-overlay-layer .content-embed-shell iframe,
body > .map-overlay-layer .content-embed-shell .genially-embed,
body > .map-overlay-layer .content-embed-shell .container-wrapper-genially {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

@media (max-width: 767px) {
  body > .map-overlay-layer {
    padding: 20px;
  }

  body > .map-overlay-layer .map-modal,
  body > .map-overlay-layer .map-modal.map-modal-content,
  body > .map-overlay-layer .map-modal.map-modal-terminal,
  body > .map-overlay-layer .map-modal.map-modal-station {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
  }

  body > .map-overlay-layer .map-modal-head {
    align-items: flex-start;
    flex-wrap: nowrap;
    padding: 8px 10px;
  }

  body > .map-overlay-layer .map-modal-head h3 {
    white-space: normal;
    font-size: 16px;
  }

  body > .map-overlay-layer .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.intro-motion,
.intro-port-lines,
.intro-train-cameo {
  position: absolute;
  pointer-events: none;
}

.intro-motion {
  inset: 0;
  z-index: 0;
}

.motion-particle {
  position: absolute;
  bottom: -12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fips-orange-300);
  box-shadow: 0 0 16px rgba(246, 146, 30, 0.7);
  opacity: 0;
  animation: introFloatUp 8s infinite linear;
}

.motion-particle:nth-child(1) { left: 8%; animation-delay: 0s; animation-duration: 8.8s; }
.motion-particle:nth-child(2) { left: 18%; animation-delay: 1.4s; animation-duration: 7.2s; }
.motion-particle:nth-child(3) { left: 31%; animation-delay: 3s; animation-duration: 9.4s; }
.motion-particle:nth-child(4) { left: 46%; animation-delay: 0.7s; animation-duration: 8s; }
.motion-particle:nth-child(5) { left: 58%; animation-delay: 2.1s; animation-duration: 10s; }
.motion-particle:nth-child(6) { left: 70%; animation-delay: 4s; animation-duration: 7.8s; }
.motion-particle:nth-child(7) { left: 83%; animation-delay: 1s; animation-duration: 9s; }
.motion-particle:nth-child(8) { left: 93%; animation-delay: 3.5s; animation-duration: 8.4s; }

.intro-port-lines {
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: 100%;
  height: min(32vh, 260px);
  opacity: 0.34;
}

.intro-port-lines path {
  fill: none;
  stroke: rgba(246, 146, 30, 0.82);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 680;
  stroke-dashoffset: 680;
  animation: introLineDraw 4.8s var(--ease-out) infinite;
}

.intro-port-lines path:nth-child(2n) {
  animation-delay: 0.28s;
}

.intro-port-lines path:nth-child(3n) {
  animation-delay: 0.56s;
}

.intro-train-cameo {
  right: clamp(18px, 5vw, 72px);
  bottom: clamp(18px, 5vw, 54px);
  z-index: 2;
  width: clamp(150px, 18vw, 260px);
  filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.28)) drop-shadow(0 18px 28px rgba(0, 0, 0, 0.46));
  animation: introTrainBob 680ms infinite var(--ease-snap);
}

.intro-train-cameo img {
  display: block;
  width: 100%;
  height: auto;
}

.intro-vapor {
  position: absolute;
  left: 16%;
  top: -6%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.36);
  opacity: 0;
  animation: introVapor 1.8s infinite var(--ease-out);
}

.intro-vapor-2 {
  left: 20%;
  animation-delay: 0.5s;
}

.intro-vapor-3 {
  left: 13%;
  animation-delay: 1s;
}

.intro-shell,
.intro-hero {
  position: relative;
  z-index: 1;
}

.intro-hero {
  animation: introHeroIn 620ms var(--ease-bounce) both;
}

.intro-hero .eyebrow,
.intro-hero h2,
.intro-hero p,
.intro-actions {
  animation: introRiseIn 620ms var(--ease-out) both;
}

.intro-hero .eyebrow { animation-delay: 80ms; }
.intro-hero h2 { animation-delay: 160ms; }
.intro-hero p { animation-delay: 240ms; }
.intro-actions { animation-delay: 320ms; }

.intro-actions button {
  position: relative;
  overflow: hidden;
}

.intro-actions button::after {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -45%;
  width: 34%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.52), transparent);
  animation: introButtonShine 2.6s infinite var(--ease-out);
}

@keyframes introFloatUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.6);
  }

  12%,
  82% {
    opacity: 0.78;
  }

  100% {
    opacity: 0;
    transform: translate3d(26px, -105vh, 0) scale(1.35);
  }
}

@keyframes introLineDraw {
  0% {
    stroke-dashoffset: 680;
    opacity: 0;
  }

  18%,
  72% {
    opacity: 0.74;
  }

  86%,
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}

@keyframes introTrainBob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-4px) rotate(-0.35deg);
  }
}

@keyframes introVapor {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.45);
  }

  35% {
    opacity: 0.82;
  }

  100% {
    opacity: 0;
    transform: translate(-42px, -72px) scale(1.9);
  }
}

@keyframes introHeroIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes introRiseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes introButtonShine {
  0% {
    transform: translateX(0) rotate(18deg);
  }

  38%,
  100% {
    transform: translateX(430%) rotate(18deg);
  }
}

@media (max-width: 767px) {
  .intro-train-cameo {
    right: 50%;
    bottom: 18px;
    width: 150px;
    transform: translateX(50%);
  }

  .intro-port-lines {
    height: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-particle,
  .intro-port-lines path,
  .intro-train-cameo,
  .intro-vapor,
  .intro-hero,
  .intro-hero .eyebrow,
  .intro-hero h2,
  .intro-hero p,
  .intro-actions,
  .intro-actions button::after {
    animation: none !important;
  }

  .motion-particle,
  .intro-vapor {
    display: none;
  }
}

.map-modal-head {
  background: linear-gradient(180deg, var(--steel-700), var(--steel-800));
  border-bottom: 3px solid var(--fips-orange-400);
}

.map-modal {
  background: var(--steel-900);
  animation: mapModalEnter var(--dur-med) var(--ease-bounce) both;
}

.history-list {
  grid-template-columns: 1fr;
}

.history-entry small {
  color: var(--muted);
}

.task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-card.done {
  border-color: rgba(0, 144, 76, 0.34);
  background: rgba(0, 144, 76, 0.08);
}

.intro-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at top center, rgba(246, 146, 30, 0.18), transparent 24%),
    radial-gradient(circle at right 18%, rgba(255, 255, 255, 0.08), transparent 18%),
    linear-gradient(180deg, rgba(0, 23, 57, 0.9), rgba(0, 42, 104, 0.82));
  z-index: 20;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.intro-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-shell {
  width: min(820px, 100%);
}

.intro-hero {
  display: grid;
  gap: 18px;
  padding: 34px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 250, 0.98));
  border: 1px solid rgba(123, 140, 150, 0.14);
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.intro-hero h2 {
  font-size: 36px;
  line-height: 1.06;
  color: var(--panel-strong);
  margin-top: 26px;
}

.intro-hero .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.intro-hero p:not(.eyebrow) {
  max-width: 56ch;
  margin-inline: auto;
}

.intro-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.intro-actions-centered {
  justify-content: center;
}

.intro-actions button {
  min-width: 220px;
  padding: 15px 22px;
  font-size: 16px;
}

@media (max-width: 1366px) and (min-width: 768px) {
  .game-app {
    padding: 14px;
    gap: 14px;
    overflow: visible;
  }

  .topbar {
    padding: 14px 18px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .layout {
    display: flex;
    gap: 14px;
    min-height: 0;
  }

  .board-section,
  .side-panel {
    padding: 16px;
  }

  .board-section {
    gap: 14px;
    min-height: 0;
  }

  .board-head {
    gap: 12px;
  }

  .board-frame {
    width: min(100%, 1080px);
  }

  .side-panel {
    flex: 0 0 320px;
    min-width: 320px;
    max-width: 320px;
  }

  .experience-card {
    gap: 10px;
    overflow: visible;
  }

  .turn-card {
    gap: 10px;
    padding: 12px;
  }

  .turn-card h3 {
    font-size: 18px;
  }

  .offer-grid {
    gap: 8px;
  }

  .turn-card-offer .offer-card {
    min-height: 144px;
  }

  .offer-card img {
    max-width: 92px;
    height: 68px;
    margin-bottom: 8px;
  }

  .journey-footer {
    gap: 8px;
    overflow: hidden;
  }

  .status-card {
    gap: 8px;
  }

  .status-box {
    padding: 8px 6px;
    text-align: center;
  }

  .status-box strong {
    font-size: 18px;
    line-height: 1;
    margin-bottom: 2px;
  }

  .status-box span {
    display: block;
    font-size: 9px;
    line-height: 1.15;
  }

  .wagon-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }

  .wagon-card {
    padding: 4px 3px;
    border-radius: 12px;
  }

  .wagon-card img {
    max-width: 38px;
    height: 20px;
    margin-bottom: 2px;
  }

  .wagon-card strong,
  .wagon-card p {
    font-size: 7px;
    line-height: 1.1;
  }

  .wagon-card strong {
    margin-bottom: 1px;
  }

  .map-modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
  }

  .map-modal-content .content-embed-shell,
  .map-modal-content .content-video-shell {
    width: 100%;
    height: 100%;
  }

  .map-modal-content .content-embed-shell {
    min-height: 0;
    max-height: none;
  }

  .map-modal-content .content-video-shell {
    min-height: 0;
    max-height: none;
  }

  .map-modal-content .content-video-shell video {
    height: 100%;
    max-height: 100%;
  }
}

@media (max-width: 1024px) {
  .layout {
    flex-direction: column;
  }

  .side-panel {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
  }

  .journey-footer {
    gap: 8px;
  }

  .status-card {
    min-width: 0;
  }
}

@media (max-width: 920px) {
  .game-app {
    padding: 14px;
  }

  .topbar,
  .board-section,
  .side-panel {
    padding: 16px;
  }

  .topbar,
  .board-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .wagon-strip,
  .status-grid,
  .metrics-row,
  .offer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey-footer {
    gap: 8px;
  }

  .turn-card-offer {
    align-content: start;
    justify-items: stretch;
    text-align: left;
  }

  .turn-card-offer h3,
  .turn-card-offer p,
  .turn-card-offer .offer-grid,
  .turn-card-offer .action-row {
    max-width: none;
    width: 100%;
    justify-self: stretch;
  }

  .turn-card-offer .offer-card {
    min-height: 152px;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .topbar-actions,
  .status-grid,
  .metrics-row,
  .offer-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: grid;
    width: 100%;
  }

  h1 {
    font-size: 26px;
  }

  .intro-hero h2 {
    font-size: 28px;
  }

  .route-label {
    display: none;
  }

  .overlay-progress-copy {
    flex-direction: column;
    align-items: flex-start;
  }

  .journey-footer {
    gap: 10px;
  }

  .wagon-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .map-overlay-layer {
    padding: 0;
  }

  .map-modal {
    border-radius: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    max-height: none;
  }

  .map-modal-content {
    width: 100%;
    height: 100%;
  }

  .map-modal-content .content-embed-shell,
  .map-modal-content .content-video-shell {
    width: 100%;
  }

  .content-embed-shell {
    max-height: none;
  }

  .content-video-shell,
  .content-video-shell video {
    max-height: 100%;
  }
}

@media (max-width: 767px) {
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .game-app {
    width: 100%;
    height: auto;
    min-height: 100vh;
    padding: 12px;
    gap: 12px;
    overflow: visible;
  }

  .topbar,
  .layout,
  .board-section,
  .side-panel {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .topbar .eyebrow {
    margin-bottom: 8px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 10px;
  }

  .progress-chip,
  .mini-badge,
  .validation-reset {
    width: 100%;
  }

  .layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
  }

  .board-section,
  .side-panel {
    padding: 16px;
    overflow: visible;
  }

  .journey-footer {
    padding: 0;
    overflow: visible;
  }

  .board-section {
    gap: 14px;
  }

  .board-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .board-head > div:first-child {
    width: 100%;
  }

  .board-head-meta {
    width: 100%;
    justify-content: center;
  }

  .board-stage {
    overflow: auto;
    padding-right: 0;
  }

  .board-frame {
    width: 100%;
    border-radius: 18px;
    background-position: center;
    background-size: cover;
  }

  .route-tile img,
  .route-train img {
    width: 98%;
    height: 98%;
  }

  .route-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    bottom: 4px;
    min-width: 52px;
    padding: 4px 6px;
    font-size: 9px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .side-panel {
    flex: 0 0 auto;
  }

  .experience-card {
    overflow: visible;
  }

  .turn-card {
    gap: 10px;
    padding: 14px;
  }

  .turn-card-offer {
    justify-items: stretch;
    text-align: left;
  }

  .turn-card-offer h3,
  .turn-card-offer p {
    max-width: none;
    width: 100%;
    text-align: left;
  }

  .turn-card-offer h3 {
    font-size: 20px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .offer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .offer-card,
  .turn-card-offer .offer-card {
    min-height: 0;
    padding: 10px 6px;
    gap: 6px;
    align-content: start;
    justify-items: center;
    text-align: center;
  }

  .offer-card img {
    width: 100%;
    max-width: 72px;
    height: 56px;
    margin-bottom: 4px;
  }

  .offer-card strong {
    display: block;
    font-size: 11px;
    line-height: 1.2;
    word-break: break-word;
  }

  .turn-card-offer .action-row {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .turn-card-offer .action-row .primary {
    width: 100%;
    justify-self: center;
  }

  .journey-footer {
    gap: 8px;
  }

  .status-card {
    gap: 8px;
  }

  .status-card .eyebrow {
    text-align: center;
  }

  .status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .status-box {
    padding: 8px 6px;
    text-align: center;
  }

  .status-box strong {
    margin-bottom: 2px;
    font-size: 18px;
    line-height: 1;
  }

  .status-box span {
    display: block;
    font-size: 10px;
    line-height: 1.2;
  }

  .wagon-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
  }

  .wagon-card {
    padding: 5px 4px;
  }

  .wagon-card img {
    max-width: 38px;
    height: 20px;
    margin-bottom: 2px;
  }

  .wagon-card strong,
  .wagon-card p {
    font-size: 8px;
    line-height: 1.1;
  }

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

  .action-row {
    grid-template-columns: 1fr;
  }

  .map-overlay-layer {
    padding: 0;
  }

  .map-modal {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    padding: 0;
    border-radius: 0;
  }

  .map-modal-head {
    align-items: flex-start;
    flex-wrap: wrap;
    min-height: 0;
    padding: 10px 12px;
  }

  .map-modal-actions {
    width: 100%;
    margin-left: 0;
  }

  .map-modal-head .overlay-progress-copy {
    width: 100%;
    max-width: none;
    flex-wrap: wrap;
  }

  .map-modal-head h3 {
    font-size: clamp(16px, 4.8vw, 22px);
    white-space: normal;
  }

  .content-embed-shell {
    max-height: none;
    padding: 0;
    border-radius: 0;
  }

  .map-modal-content .content-embed-shell {
    min-height: 0;
  }

  .map-modal-body {
    align-content: start;
  }

  .map-modal-content .content-embed-shell:has(iframe),
  .map-modal-terminal .content-embed-shell:has(iframe) {
    flex: 0 0 auto;
    width: max(100%, 760px);
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .map-modal-content .map-modal-body:has(iframe),
  .map-modal-terminal .map-modal-body:has(iframe) {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .content-video-shell {
    padding: 0;
    border-radius: 0;
    max-height: none;
  }

  .map-modal-content .content-video-shell {
    min-height: 0;
  }

  .content-video-shell video {
    height: 100%;
    max-height: 100%;
  }
}

.map-overlay-layer .map-modal.map-modal-content,
.map-overlay-layer .map-modal.map-modal-terminal,
.map-overlay-layer .map-modal.map-modal-station {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.map-overlay-layer .map-modal.map-modal-content .map-modal-body,
.map-overlay-layer .map-modal.map-modal-terminal .map-modal-body,
.map-overlay-layer .map-modal.map-modal-station .map-modal-body {
  flex: 1 1 auto;
  width: 100%;
  aspect-ratio: auto;
  overflow: hidden;
}

.map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
.map-overlay-layer .map-modal.map-modal-content .content-video-shell,
.map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
.map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
.map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
.map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
}

@media (max-width: 767px) {
  .map-overlay-layer .map-modal.map-modal-content .map-modal-body:has(iframe),
  .map-overlay-layer .map-modal.map-modal-terminal .map-modal-body:has(iframe),
  .map-overlay-layer .map-modal.map-modal-station .map-modal-body:has(iframe) {
    overflow: auto;
    align-content: start;
    -webkit-overflow-scrolling: touch;
  }

  .map-overlay-layer .map-modal.map-modal-content .content-embed-shell:has(iframe),
  .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell:has(iframe),
  .map-overlay-layer .map-modal.map-modal-station .content-embed-shell:has(iframe) {
    flex: 0 0 auto;
    width: max(100%, 760px);
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
}

/* Final design-system cascade guard */
body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(26, 58, 92, 0.92) 0%, rgba(10, 14, 20, 0) 62%),
    linear-gradient(180deg, var(--steel-900) 0%, #070a0f 100%);
  color: var(--text-primary);
}

.topbar,
.board-section,
.side-panel,
.panel,
.wagon-card,
.status-box,
.turn-card,
.history-entry,
.offer-card,
.terminal-choice,
.task-card {
  border-color: var(--border-default);
  background: linear-gradient(180deg, rgba(31, 37, 45, 0.98), rgba(19, 24, 32, 0.98));
  color: var(--text-primary);
}

.topbar {
  min-height: var(--topbar-h);
  justify-content: flex-start;
  border-bottom: 3px solid var(--fips-orange-400);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-flat-lg);
}

.board-section::before,
.intro-hero::before {
  display: none;
}

.board-head h2,
.turn-card h3,
.topbar h1,
.intro-hero h2 {
  color: var(--text-primary);
}

.eyebrow,
.board-head .eyebrow,
.topbar .eyebrow,
.intro-hero .eyebrow {
  color: var(--fips-orange-400);
}

p,
.status-box span,
.wagon-card p {
  color: var(--text-secondary);
}

.board-frame {
  border: 3px solid var(--steel-700);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.04), var(--shadow-flat-lg);
}

.intro-overlay {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(26, 58, 92, 0.96) 0%, rgba(10, 14, 20, 0.98) 70%),
    linear-gradient(180deg, var(--steel-900), #070a0f);
}

.intro-hero {
  width: min(760px, 100%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(31, 37, 45, 0.92), rgba(10, 14, 20, 0.96));
  box-shadow: var(--shadow-modal);
}

.intro-hero h2 {
  margin-top: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  line-height: 1.08;
  text-shadow: 0 4px 0 var(--fips-blue-700), 0 12px 28px rgba(0, 0, 0, 0.55);
}

.map-overlay-layer {
  background: rgba(10, 14, 20, 0.72);
  backdrop-filter: blur(4px);
}

/* Final override: content modal covers the viewport with 20px edge padding. */
body > .map-overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: stretch;
  padding: 20px;
  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

body > .map-overlay-layer.has-modal {
  display: grid;
  pointer-events: auto;
}

body > .map-overlay-layer .map-modal,
body > .map-overlay-layer .map-modal.map-modal-content,
body > .map-overlay-layer .map-modal.map-modal-terminal,
body > .map-overlay-layer .map-modal.map-modal-station {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 3px solid var(--fips-orange-400);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--steel-800), var(--steel-900));
  box-shadow: var(--shadow-modal);
  animation: mapModalEnter var(--dur-med) var(--ease-bounce) both;
}

body > .map-overlay-layer .map-modal-head {
  min-height: 60px;
  padding: 10px clamp(14px, 2vw, 24px);
  background: linear-gradient(180deg, var(--steel-700), var(--steel-800));
  border-bottom: 3px solid var(--fips-orange-400);
}

body > .map-overlay-layer .map-modal-actions {
  width: auto;
  margin-left: auto;
}

body > .map-overlay-layer .map-modal-actions button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-default);
}

body > .map-overlay-layer .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-content .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-terminal .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-station .map-modal-body {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: clamp(10px, 1.6vw, 18px);
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 146, 30, 0.08), transparent 34%),
    var(--steel-900);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: min(100%, calc((100vh - 192px) * 16 / 9));
  height: auto;
  min-height: 0;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #05070c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body > .map-overlay-layer .content-embed-shell > *,
body > .map-overlay-layer .content-embed-shell iframe,
body > .map-overlay-layer .content-embed-shell .genially-embed,
body > .map-overlay-layer .content-embed-shell .container-wrapper-genially {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

@media (max-width: 767px) {
  body > .map-overlay-layer {
    padding: 20px;
  }

  body > .map-overlay-layer .map-modal-head {
    align-items: flex-start;
    flex-wrap: nowrap;
    padding: 8px 10px;
  }

  body > .map-overlay-layer .map-modal-head h3 {
    white-space: normal;
    font-size: 16px;
  }

  body > .map-overlay-layer .content-embed-shell,
  body > .map-overlay-layer .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* Content emphasis: keep this at the end of the file. */
body > .map-overlay-layer .map-modal-head {
  min-height: 50px;
  padding: 8px clamp(12px, 1.6vw, 20px);
}

body > .map-overlay-layer .map-modal-head .eyebrow {
  margin-bottom: 2px;
}

body > .map-overlay-layer .map-modal-head h3 {
  font-size: clamp(15px, 1.35vw, 20px);
  line-height: 1.08;
}

body > .map-overlay-layer .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-content .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-terminal .map-modal-body,
body > .map-overlay-layer .map-modal.map-modal-station .map-modal-body {
  padding: clamp(6px, 1vw, 12px);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  border: 3px solid rgba(246, 146, 30, 0.55);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.48),
    0 0 34px rgba(246, 146, 30, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body > .map-overlay-layer .map-modal-foot {
  min-height: 58px;
  padding: 8px clamp(12px, 1.6vw, 20px);
}

body > .map-overlay-layer .map-modal-foot .primary {
  min-height: 40px;
  min-width: 150px;
  padding: 9px 16px;
}

body > .map-overlay-layer .map-modal-foot .overlay-progress-copy {
  font-size: 11px;
}

body > .map-overlay-layer .overlay-progress-track {
  height: 9px;
}

/* Top controls only: final cascade guard. */
body > .map-overlay-layer .map-modal-head {
  min-height: 62px;
}

body > .map-overlay-layer .map-modal-actions {
  flex: 0 1 min(620px, 58vw);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 280px;
  width: auto;
  margin-left: auto;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-panel {
  flex: 1 1 340px;
  min-width: 220px;
  gap: 6px;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  font-size: 11px;
  line-height: 1.2;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-copy span:last-child {
  flex: 0 0 auto;
  color: var(--fips-orange-300);
  font-family: var(--font-mono);
  font-weight: 700;
}

body > .map-overlay-layer .map-modal-actions .overlay-progress-track {
  height: 9px;
}

body > .map-overlay-layer .map-modal-actions .primary {
  flex: 0 0 auto;
  min-width: 150px;
  min-height: 40px;
  padding: 9px 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--steel-900);
  background: var(--grad-orange-cta);
  border: var(--stroke-cartoon) solid var(--steel-900);
  box-shadow: var(--shadow-flat);
}

body > .map-overlay-layer .map-modal-actions .primary:disabled {
  cursor: not-allowed;
  transform: none;
  color: var(--steel-300);
  background: linear-gradient(180deg, var(--steel-600), var(--steel-700));
  border-color: rgba(0, 0, 0, 0.45);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.32);
}

body > .map-overlay-layer .content-embed-shell,
body > .map-overlay-layer .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
  width: min(100%, calc((100vh - 108px) * 16 / 9));
}

body > .map-overlay-layer .map-modal-foot {
  display: none;
}

@media (max-width: 920px) {
  body > .map-overlay-layer .map-modal-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  body > .map-overlay-layer .map-modal-actions {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  body > .map-overlay-layer .map-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body > .map-overlay-layer .map-modal-actions .primary {
    width: 100%;
    min-width: 0;
  }

  body > .map-overlay-layer .content-embed-shell,
  body > .map-overlay-layer .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-content .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-terminal .content-video-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-embed-shell,
  body > .map-overlay-layer .map-modal.map-modal-station .content-video-shell {
    width: 100%;
  }
}
/* Board brandbook v2 visual guard. Keep this scoped to the game board only. */
.board-stage {
  padding: 4px;
}

.board-frame {
  border: 6px solid #002a68;
  border-radius: 12px;
  background:
    url("./assets/tabuleiro-e-layout/tabuleiro-no-jogo.png") center/100% 100% no-repeat,
    #004b9b;
  box-shadow:
    inset 0 0 0 2px rgba(0, 144, 208, 0.42),
    inset 0 0 0 6px rgba(0, 42, 104, 0.48),
    0 18px 44px rgba(0, 42, 104, 0.34);
}

.board-frame::before,
.board-frame::after {
  width: 30px;
  height: 30px;
  z-index: 8;
  border-color: #f6921e;
  filter: drop-shadow(0 0 7px rgba(246, 146, 30, 0.58));
}

.board-frame::before {
  top: 6px;
  left: 6px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 8px;
}

.board-frame::after {
  right: 6px;
  bottom: 6px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 8px;
}

.board-grid {
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
  pointer-events: none;
  z-index: 4;
}

.board-grid::before {
  content: none;
}

.board-cell {
  z-index: 4;
  border: 1px solid rgba(0, 18, 42, 0.36);
  border-radius: 6px;
  overflow: hidden;
}

.board-cell::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 5px;
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 202, 0.16),
    inset 0 -8px 18px rgba(51, 59, 65, 0.06);
}

.board-cell.terrain-land,
.board-cell.terrain-pending {
  background: rgba(255, 218, 140, 0.02);
}

.board-cell.terrain-water {
  background: rgba(0, 144, 208, 0.02);
  box-shadow: none;
}

.board-cell.terrain-water::after {
  box-shadow:
    inset 0 1px 0 rgba(204, 239, 255, 0.12),
    inset 8px 0 12px rgba(255, 255, 255, 0.04),
    inset -8px 0 14px rgba(3, 42, 72, 0.08);
}

.route-tile img,
.route-train img {
  filter:
    drop-shadow(0 4px 0 rgba(0, 10, 24, 0.28))
    drop-shadow(0 10px 14px rgba(0, 10, 24, 0.26));
}

.route-tile {
  overflow: hidden;
  border-radius: 6px;
}

.route-tile:not(.station):not(.start):not(.finish) img {
  width: 104%;
  height: 104%;
  max-width: none;
  object-fit: cover;
  opacity: 0.9;
  filter:
    saturate(0.88)
    contrast(0.94)
    brightness(0.92)
    drop-shadow(0 1px 1px rgba(0, 10, 24, 0.22));
}

.route-tile.completed:not(.station):not(.start):not(.finish)::before,
.route-tile.next:not(.station):not(.start):not(.finish)::before,
.route-tile.current:not(.station):not(.start):not(.finish)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 202, 0.18),
    inset 0 -10px 18px rgba(69, 45, 17, 0.12);
  background: rgba(255, 218, 140, 0.04);
  mix-blend-mode: multiply;
}

.route-tile.completed:not(.station):not(.start):not(.finish),
.route-tile.next:not(.station):not(.start):not(.finish),
.route-tile.current:not(.station):not(.start):not(.finish) {
  transform-origin: center;
}

.route-tile.completed:not(.station):not(.start):not(.finish):hover,
.route-tile.next:not(.station):not(.start):not(.finish):hover,
.route-tile.current:not(.station):not(.start):not(.finish):hover,
.route-tile.reviewable:focus-visible {
  transform: scale(0.94);
  filter: brightness(1.06);
}

.route-tile.completed:not(.station):not(.start):not(.finish):hover::after,
.route-tile.next:not(.station):not(.start):not(.finish):hover::after,
.route-tile.current:not(.station):not(.start):not(.finish):hover::after,
.route-tile.reviewable:focus-visible::after {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: 4;
  pointer-events: none;
  border: 3px solid rgba(246, 146, 30, 0.94);
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.42),
    inset 0 0 18px rgba(255, 214, 128, 0.34),
    0 0 0 3px rgba(246, 146, 30, 0.2),
    0 0 20px rgba(246, 146, 30, 0.58);
}

.route-tile.completed:not(.station):not(.start):not(.finish):hover img,
.route-tile.next:not(.station):not(.start):not(.finish):hover img,
.route-tile.current:not(.station):not(.start):not(.finish):hover img,
.route-tile.reviewable:focus-visible img {
  opacity: 1;
  filter:
    saturate(1.08)
    contrast(1.02)
    brightness(1.03)
    drop-shadow(0 2px 2px rgba(0, 10, 24, 0.26))
    drop-shadow(0 0 14px rgba(246, 146, 30, 0.62));
}
