:root {
  color-scheme: light;
  --bg: #eef2ef;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #66717c;
  --line: #d5ddd6;
  --land: #d8dfd6;
  --land-stroke: #aeb9af;
  --water: #a9c9d9;
  --accent: #cf4f37;
  --accent-dark: #a53d2a;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
  z-index: 2;
}

.brand h1 {
  font-size: 30px;
  line-height: 1.05;
  margin: 0 0 10px;
  letter-spacing: 0;
}

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

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  height: 44px;
  padding: 0 12px;
  width: 100%;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(207, 79, 55, 0.18);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

button {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  padding: 0 14px;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #eef1f0;
  color: var(--ink);
}

button.secondary:hover {
  background: #dde5e0;
}

.stats {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 24px;
}

.stats h2 {
  font-size: 18px;
  margin: 0 0 18px;
}

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

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 3px;
  text-transform: uppercase;
}

dd {
  margin: 0;
}

.ad-spacer {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  min-height: 90px;
  padding-top: 18px;
}

.sidebar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.sidebar-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-links a:hover {
  color: var(--ink);
}

.map-panel {
  background: var(--water);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

#map {
  display: block;
  height: 100%;
  min-height: 100vh;
  width: 100%;
}

.graticule {
  fill: none;
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 0.7;
}

.country {
  fill: var(--land);
  stroke: var(--land-stroke);
  stroke-width: 0.6;
}

.country:hover {
  fill: #cbd6cb;
}

.outline {
  cursor: grab;
  fill: var(--outline-fill, rgba(207, 79, 55, 0.45));
  stroke: var(--outline-stroke, #782a20);
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.outline.active {
  fill: var(--outline-active-fill, rgba(239, 112, 76, 0.56));
  stroke-width: 2.5;
}

.outline:active {
  cursor: grabbing;
}

.map-toolbar {
  display: flex;
  gap: 8px;
  left: 18px;
  position: absolute;
  top: 18px;
  z-index: 1;
}

.map-toolbar button {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 41, 51, 0.1);
  color: var(--ink);
  min-width: 42px;
  padding: 0 12px;
}

.map-toolbar button:hover {
  background: white;
}

.loading {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(31, 41, 51, 0.1);
  border-radius: 8px;
  box-shadow: var(--shadow);
  left: 50%;
  padding: 12px 16px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.loading.hidden {
  display: none;
}

.page-shell {
  margin: 0 auto;
  max-width: 860px;
  padding: 28px;
}

.page-header {
  margin-bottom: 26px;
}

.page-header a {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
}

.page-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.page-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.page-panel h1 {
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 18px;
}

.page-panel h2 {
  font-size: 20px;
  margin: 26px 0 10px;
}

.page-panel p,
.page-panel li {
  color: #35414c;
  line-height: 1.65;
}

.page-panel a {
  color: var(--accent-dark);
  font-weight: 800;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.page-nav a {
  background: #eef1f0;
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 12px;
  text-decoration: none;
}

@media (max-width: 800px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 18px;
  }

  .brand h1 {
    font-size: 24px;
  }

  .brand p {
    margin-bottom: 18px;
  }

  .stats {
    display: none;
  }

  .ad-spacer {
    display: none;
  }

  .map-panel,
  #map {
    min-height: calc(100vh - 222px);
  }
}
