:root {
  color-scheme: light;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  --page-bg:
    radial-gradient(circle at top left, rgba(252, 194, 121, 0.22), transparent 30%),
    radial-gradient(circle at 85% 10%, rgba(88, 141, 160, 0.22), transparent 28%),
    linear-gradient(180deg, #102532 0%, #153a4a 42%, #efe5d7 42%, #f7f1e8 100%);
  --surface: rgba(253, 249, 241, 0.92);
  --surface-strong: #fffaf1;
  --surface-dark: #143441;
  --ink: #173541;
  --ink-soft: rgba(23, 53, 65, 0.72);
  --line: rgba(20, 53, 65, 0.12);
  --accent: #c05f3e;
  --accent-soft: rgba(192, 95, 62, 0.12);
  --teal: #2b6a73;
  --teal-soft: rgba(43, 106, 115, 0.16);
  --shadow: 0 24px 64px rgba(8, 26, 33, 0.18);
  --mono: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.82fr);
  gap: 24px;
  margin-bottom: 24px;
}

.hero__copy,
.hero__controls,
.map-panel,
.inspector {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero__copy,
.hero__controls,
.inspector {
  background: linear-gradient(180deg, rgba(253, 249, 241, 0.96), rgba(245, 236, 224, 0.94));
  backdrop-filter: blur(18px);
}

.hero__copy {
  padding: 30px;
}

.hero__copy h1 {
  margin: 0;
  font-size: clamp(2.8rem, 4vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.hero__lede,
.hero__hint,
.map-panel__footer p {
  color: var(--ink-soft);
  line-height: 1.65;
}

.hero__lede {
  margin: 18px 0 0;
  max-width: 56ch;
  font-size: 1.02rem;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.hero__stat {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(19, 53, 66, 0.08);
  background: rgba(18, 53, 66, 0.05);
}

.hero__stat-value {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1.42rem;
  font-weight: 700;
}

.hero__stat-label {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.hero__controls {
  display: grid;
  gap: 18px;
  padding: 24px;
  align-content: start;
}

.mode-toggle {
  display: grid;
  gap: 12px;
}

.mode-toggle__option {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(19, 53, 65, 0.12);
  border-radius: 22px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.64);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.mode-toggle__option:hover,
.view-actions__button:hover,
.picker select:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(16, 41, 49, 0.08);
}

.mode-toggle__option.is-active {
  background: linear-gradient(180deg, rgba(32, 75, 84, 0.98), rgba(21, 50, 56, 0.98));
  color: #fcf4e7;
  border-color: rgba(255, 255, 255, 0.18);
}

.mode-toggle__label {
  font-size: 1.04rem;
  font-weight: 700;
}

.mode-toggle__description {
  font-size: 0.91rem;
  line-height: 1.55;
  opacity: 0.84;
}

.picker {
  display: grid;
  gap: 10px;
}

.picker__label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.picker select,
.view-actions__button {
  width: 100%;
  border: 1px solid rgba(18, 53, 65, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.picker select {
  padding: 14px 16px;
}

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

.view-actions__button {
  padding: 12px 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 390px);
  gap: 24px;
  align-items: start;
}

.map-panel {
  background: linear-gradient(180deg, rgba(15, 38, 47, 0.12), rgba(14, 40, 49, 0.04));
}

.map-frame {
  position: relative;
  aspect-ratio: 1600 / 840;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background:
    radial-gradient(circle at 20% 18%, rgba(252, 223, 178, 0.45), transparent 24%),
    linear-gradient(180deg, rgba(16, 47, 58, 0.18), rgba(7, 34, 46, 0.02));
}

.map-frame.is-dragging {
  cursor: grabbing;
}

.atlas {
  display: block;
  width: 100%;
  height: 100%;
}

.atlas__ocean {
  fill: url(#ocean-gradient);
}

.atlas__graticule line {
  stroke: rgba(36, 82, 94, 0.14);
  stroke-width: 1.2;
}

.atlas__countries path {
  fill: rgba(255, 250, 242, 0.9);
  stroke: rgba(43, 89, 101, 0.28);
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

.atlas__selection circle {
  fill: rgba(192, 95, 62, 0.16);
  stroke: rgba(192, 95, 62, 0.7);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.marker {
  position: absolute;
  pointer-events: auto;
  z-index: 1;
  border: 0;
  background: none;
  padding: 0;
  user-select: none;
}

.marker__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(16, 48, 58, 0.18);
  background: rgba(255, 250, 242, 0.94);
  box-shadow: 0 12px 20px rgba(11, 31, 38, 0.16);
  color: var(--surface-dark);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

.marker:hover .marker__chip {
  transform: scale(1.04);
  border-color: rgba(43, 106, 115, 0.36);
}

.marker--selected {
  z-index: 3;
  transform: translate(-50%, calc(-100% - 16px));
}

.marker--selected .marker__anchor {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 18px;
  background: rgba(192, 95, 62, 0.65);
  transform: translateX(-50%);
}

.marker--selected .marker__anchor::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255, 250, 242, 0.95);
  transform: translateX(-50%);
  box-shadow: 0 8px 16px rgba(14, 35, 42, 0.22);
}

.marker-card {
  width: 236px;
  height: 124px;
  perspective: 1200px;
}

.marker-card__inner,
.inspector-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 340ms ease;
}

.marker-card.is-flipped .marker-card__inner,
.inspector-card.is-flipped .inspector-card__inner {
  transform: rotateY(180deg);
}

.marker-card__face,
.inspector-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 24px;
  backface-visibility: hidden;
  overflow: hidden;
}

.marker-card__face--code,
.inspector-card__face--code {
  align-items: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(246, 236, 221, 0.96));
  border: 1px solid rgba(18, 53, 65, 0.14);
  box-shadow: 0 18px 32px rgba(11, 30, 37, 0.18);
}

.marker-card__face--details,
.inspector-card__face--details {
  padding: 18px;
  background: linear-gradient(180deg, rgba(31, 72, 81, 0.98), rgba(18, 47, 54, 0.98));
  color: #fdf7ed;
  transform: rotateY(180deg);
  box-shadow: 0 18px 32px rgba(11, 30, 37, 0.18);
}

.marker-card__label,
.inspector-card__kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.78;
}

.marker-card__code,
.inspector-card__code {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.marker-card__tap,
.inspector-card__tap {
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.marker-card__name,
.inspector-card__name {
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.marker-card__location,
.inspector-card__location {
  margin-top: 6px;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.84;
}

.map-frame__status {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid rgba(19, 54, 66, 0.1);
  box-shadow: 0 10px 24px rgba(11, 31, 38, 0.14);
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.map-panel__footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px 20px;
}

.map-panel__footer p {
  margin: 0;
  font-size: 0.92rem;
}

.inspector {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.inspector__empty {
  padding: 20px;
  border-radius: 22px;
  border: 1px dashed rgba(25, 66, 79, 0.18);
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink-soft);
  line-height: 1.6;
}

.inspector-card {
  display: block;
  width: 100%;
  height: 180px;
  padding: 0;
  border: 0;
  background: none;
  perspective: 1400px;
}

.inspector-card.is-hidden {
  display: none;
}

.inspector-card__face {
  border-radius: 28px;
}

.inspector-card__face--code {
  align-items: center;
}

.inspector-card__code {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
}

.inspector-card__name {
  font-size: 1.16rem;
}

.inspector__facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.inspector__fact {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(21, 56, 67, 0.08);
}

.inspector__fact dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
}

.inspector__fact dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .map-panel__footer {
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100%, calc(100% - 20px));
    padding: 14px 0 24px;
  }

  .hero__copy,
  .hero__controls,
  .map-panel,
  .inspector {
    border-radius: 24px;
  }

  .hero__copy,
  .hero__controls,
  .inspector {
    padding: 18px;
  }

  .hero__stats,
  .view-actions {
    grid-template-columns: 1fr;
  }

  .marker__chip {
    min-width: 62px;
    height: 34px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .marker-card {
    width: 212px;
    height: 118px;
  }

  .inspector-card {
    height: 164px;
  }

  .map-frame__status {
    font-size: 0.8rem;
  }
}
