:root {
  --cream: #e8d4b4;
  --red: #bf0d3e;
  --navy: #0a3161;
  --ink: #142033;
  --paper: #fff9ef;
  --muted: #6b5c4b;
  --line: rgba(10, 49, 97, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 0;
  background: #f6ecdc;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow: hidden;
}

.travel-map-widget {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0;
}

.map-intro {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  align-items: end;
  gap: 24px;
  padding: 24px 0 18px;
  border-bottom: 2px solid var(--navy);
}

.intro-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 10px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.map-intro p:not(.eyebrow) {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0;
}

.theme-helper {
  display: grid;
  gap: 3px;
  padding: 18px 0 0;
  color: var(--navy);
  text-align: center;
}

.theme-helper span:first-child {
  color: var(--red);
  font-size: 1rem;
  font-weight: 900;
}

.theme-helper span:last-child {
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.45;
}

.filter-button,
.quest-link {
  min-height: 44px;
  border: 2px solid var(--navy);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.filter-button {
  padding: 9px 13px;
  background: var(--paper);
  color: var(--navy);
}

.filter-button:hover,
.filter-button:focus-visible,
.filter-button.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.clear-button {
  background: transparent;
  border-style: dashed;
}

.clear-button:hover,
.clear-button:focus-visible {
  background: var(--cream);
  border-color: var(--navy);
  color: var(--navy);
}

.unlock-panel {
  align-self: stretch;
  padding: 13px;
  border: 1.5px solid var(--line);
  background: rgba(255, 249, 239, 0.72);
}

.unlock-panel h2 {
  margin-bottom: 10px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2vw, 1.28rem);
  line-height: 1.12;
}

.unlock-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.unlock-form {
  display: grid;
  gap: 6px;
}

.unlock-form label {
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.unlock-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.unlock-form input {
  min-height: 36px;
  width: 100%;
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 9px;
}

.unlock-submit-button {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  border: 2px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.unlock-submit-button:hover,
.unlock-submit-button:focus-visible {
  background: var(--red);
  border-color: var(--red);
}

.unlock-form input:focus-visible {
  outline: 3px solid rgba(10, 49, 97, 0.25);
  outline-offset: 2px;
}

.unlock-form.is-unlocked input,
.unlock-form.is-unlocked > div .unlock-submit-button {
  display: none;
}

.unlock-form.is-unlocked .test-reset-button {
  display: inline-flex;
}

.test-reset-button {
  min-height: 32px;
  justify-content: space-between;
  align-items: center;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--navy);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  padding: 5px 9px;
}

.test-reset-button::after {
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: var(--cream);
  box-shadow: inset 0 0 0 2px rgba(10, 49, 97, 0.28);
  content: "";
}

.unlock-form.is-unlocked .test-reset-button::after {
  background: var(--navy);
  box-shadow: inset 0 0 0 4px var(--cream);
}

.test-reset-button:hover,
.test-reset-button:focus-visible {
  color: var(--navy);
}

.unlock-status {
  min-height: 1.25em;
  color: var(--navy);
  font-size: 0.76rem;
  font-weight: 800;
}

.game-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 16px 0 0;
  border: 2px solid rgba(191, 13, 62, 0.58);
  background: var(--paper);
}

.game-panel-section {
  min-width: 0;
  padding: 14px 16px;
}

.game-panel-section + .game-panel-section {
  border-left: 1.5px solid rgba(191, 13, 62, 0.28);
}

.plate-game {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.game-panel h2 {
  margin-bottom: 5px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  line-height: 1.1;
}

.game-panel p {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.42;
}

.game-panel p:last-child {
  margin-bottom: 0;
}

.clear-plates-button {
  min-height: 40px;
  padding: 8px 12px;
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-size: 0.82rem;
  white-space: normal;
}

.clear-plates-button:hover,
.clear-plates-button:focus-visible {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.plate-game-actions {
  display: grid;
  gap: 7px;
  justify-items: stretch;
  max-width: 330px;
}

.plate-progress {
  margin: 0;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: left;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 390px);
  gap: 22px;
  align-items: stretch;
}

.map-shell,
.state-card {
  border: 2px solid var(--navy);
  background: var(--paper);
}

.map-shell {
  padding: clamp(10px, 2vw, 18px);
}

.state-map {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 280px;
}

.state-map svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 640px;
  overflow: visible;
}

.state-map .state-path {
  fill: var(--cream);
  stroke: var(--navy);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition:
    fill 160ms ease,
    opacity 160ms ease,
    stroke 160ms ease;
}

.state-map .state-path:hover,
.state-map .state-path:focus-visible {
  fill: #fff;
  stroke: var(--navy);
  stroke-width: 2.4;
  outline: none;
}

.state-map .state-path.is-selected {
  fill: var(--navy);
  stroke: var(--navy);
}

.state-map .state-path.is-dimmed {
  opacity: 0.22;
}

.state-map .state-path.is-match {
  fill: var(--navy);
  stroke: var(--navy);
  stroke-width: 2.2;
}

.state-map .state-path.is-visited {
  fill: #9fcdb1;
  stroke: var(--navy);
}

.state-map .state-path.is-locked-state:not(.is-match):not(.is-selected) {
  opacity: 0.5;
}

.state-map text,
.state-map .state-label,
.state-map title {
  pointer-events: none;
}

.state-map .plate-badge {
  pointer-events: none;
}

.map-loading,
.map-error {
  margin: 0;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.state-card {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  min-height: 100%;
  padding: 16px;
}

.state-card.is-locked {
  position: sticky;
}

.state-card.is-locked dl,
.state-card.is-locked .quest-links {
  filter: blur(5px);
  opacity: 0.45;
  user-select: none;
  pointer-events: none;
}

.locked-card-message {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  padding: 18px;
  border: 2px solid var(--navy);
  background: rgba(232, 212, 180, 0.96);
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.state-card h2 {
  margin-bottom: 12px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1;
}

dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

dt {
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.32;
}

.state-trackers {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
}

.state-trackers[hidden] {
  display: none;
}

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

.tracker-box {
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  background: var(--cream);
}

.tracker-box[hidden] {
  display: none;
}

.tracker-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
}

.tracker-checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--navy);
}

.tracker-save-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.quest-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}

.quest-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  background: var(--navy);
  color: #fff;
  font-size: 0.82rem;
  text-align: center;
  text-decoration: none;
}

.quest-link:hover,
.quest-link:focus-visible {
  background: var(--red);
  border-color: var(--red);
}

.quest-link-secondary {
  background: var(--paper);
  color: var(--navy);
}

.quest-link-secondary:hover,
.quest-link-secondary:focus-visible {
  background: var(--red);
  color: #fff;
}

.embed-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .map-intro {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .map-layout {
    grid-template-columns: 1fr;
  }

  .unlock-panel,
  .game-panel,
  .plate-game {
    grid-template-columns: 1fr;
  }

  .game-panel-section + .game-panel-section {
    border-left: 0;
    border-top: 1.5px solid rgba(191, 13, 62, 0.28);
  }

  .state-card {
    position: static;
    min-height: auto;
  }

  .quest-links {
    grid-template-columns: 1fr;
  }

  .tracker-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .travel-map-widget {
    width: min(100% - 16px, 1180px);
    padding-top: 12px;
  }

  .filter-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-button {
    min-height: 46px;
    padding: 8px;
    font-size: 0.82rem;
  }

  .unlock-form > div {
    grid-template-columns: 1fr;
  }

  .map-shell {
    padding: 10px;
  }

  .state-map {
    min-height: 220px;
  }
}
