:root {
  color-scheme: light;
  --land: #f5f0e7;
  --sea: #dbecee;
  --ink: #2f302d;
  --muted: #706f69;
  --line: #d8d1c7;
  --edge: #faf7f1;
  --panel: rgba(250, 247, 241, .96);
  --shadow: 0 14px 40px rgba(47, 48, 45, .14);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--land);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button { font: inherit; }

.map-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-height: 520px;
  background: var(--land);
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px 15px;
  border-bottom: 1px solid var(--line);
}

.map-header h1 {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.35rem, 2.7vw, 2rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.map-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.35;
}

.areas-toggle {
  display: none;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: 0;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--sea);
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 430px;
  touch-action: none;
  cursor: grab;
}

#map.is-dragging { cursor: grabbing; }
.map-land { fill: var(--land); }
.sea { fill: var(--sea); }
.coast { fill: none; stroke: #60939a; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.road { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.road-minor { stroke: #8a867f; stroke-width: .55; opacity: .34; }
.road-major { stroke: #858079; stroke-width: 1.15; opacity: .58; }
.road-highway { stroke: #555752; stroke-width: 3.2; opacity: .9; }
.zone { stroke: var(--edge); stroke-width: 1.5; fill-opacity: .64; stroke-linejoin: round; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill-opacity 140ms ease, stroke 140ms ease; }
.zone:hover, .zone:focus-visible { fill-opacity: .78; outline: none; }
.zone.is-active { fill-opacity: .78; stroke: var(--ink); stroke-width: 2.6; }
.zone-7 { fill-opacity: .18; stroke: #77746d; }
.zone-7:hover, .zone-7:focus-visible, .zone-7.is-active { fill-opacity: .28; }
.marker { cursor: pointer; }
.marker circle { fill: var(--ink); stroke: var(--edge); stroke-width: 1.7; vector-effect: non-scaling-stroke; }
.marker text { fill: #fff; font-size: 20px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.marker.is-active circle { fill: var(--edge); stroke: var(--ink); stroke-width: 2.4; }
.marker.is-active text { fill: var(--ink); }
.map-label { fill: var(--ink); font-size: 17px; font-weight: 700; letter-spacing: .04em; paint-order: stroke; stroke: var(--land); stroke-width: 5px; stroke-linejoin: round; pointer-events: none; }
.sea-label { fill: #4f8289; font-size: 18px; letter-spacing: .08em; pointer-events: none; }

.map-controls {
  position: absolute;
  left: 18px;
  top: 18px;
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(47, 48, 45, .28);
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(47, 48, 45, .12);
}

.map-controls button {
  width: 42px;
  height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 1.35rem;
  cursor: pointer;
}

.map-controls button:last-child { border-bottom: 0; font-size: 1.15rem; }
.map-controls button:hover, .map-controls button:focus-visible { background: #e9e3d9; outline: none; }

.map-credit {
  position: absolute;
  left: 18px;
  bottom: 12px;
  padding: 4px 6px;
  background: rgba(245, 240, 231, .86);
  color: var(--muted);
  font-size: .68rem;
}

.guide-panel {
  min-height: 0;
  overflow: auto;
  padding: 23px 20px 22px;
  border-left: 1px solid var(--line);
  background: #faf7f1;
}

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

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .13em;
}

.panel-close {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.8rem;
  cursor: pointer;
}

.selected-area {
  min-height: 150px;
  padding: 14px 0 17px;
  border-bottom: 1px solid var(--line);
}

.selected-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.selected-number {
  display: grid;
  flex: 0 0 31px;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 700;
}

.selected-area h2 {
  margin: 1px 0 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.18rem;
  font-weight: 400;
  line-height: 1.2;
}

.selected-area p {
  margin: 12px 0 0;
  color: #555650;
  font-size: .88rem;
  line-height: 1.48;
}

.area-list { padding-top: 9px; }

.area-button {
  display: grid;
  grid-template-columns: 17px 1fr;
  width: 100%;
  gap: 10px;
  align-items: start;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.area-button:last-child { border-bottom: 0; }
.area-button:hover, .area-button:focus-visible { background: #f0eae0; outline: none; }
.area-button.is-active { background: #ece5da; }
.area-swatch { width: 14px; height: 14px; margin-top: 2px; }
.area-button strong { display: block; font-size: .82rem; line-height: 1.25; }
.area-copy { display: block; }
.area-short { display: block; margin-top: 3px; color: var(--muted); font-size: .74rem; line-height: 1.3; }

footer {
  padding: 8px 18px 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .69rem;
  line-height: 1.3;
}

@media (max-width: 760px) {
  .map-header { padding: 13px 14px 11px; }
  .map-header h1 { max-width: 490px; font-size: 1.2rem; }
  .map-header p { display: none; }
  .areas-toggle { display: block; }
  .map-layout { display: block; position: relative; }
  .map-stage { width: 100%; height: 100%; }
  .guide-panel {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(72%, 560px);
    padding: 15px 17px 24px;
    border: 0;
    border-top: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateY(105%);
    transition: transform 220ms ease;
  }
  .guide-panel.is-open { transform: translateY(0); }
  .panel-close { display: block; }
  .selected-area { min-height: 0; }
  .area-button { padding: 9px 3px; }
  .area-short { display: none; }
  footer { padding: 7px 10px 8px; font-size: .61rem; }
}

@media (prefers-reduced-motion: reduce) {
  .guide-panel, .zone { transition: none; }
}
