:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #f0f4f8;
  --border: #d9e1ec;
  --text: #172033;
  --muted: #61708a;
  --blue: #2266d3;
  --green: #14855f;
  --green-bg: #e7f6ef;
  --amber: #a56400;
  --amber-bg: #fff3d6;
  --red: #b72f39;
  --shadow: 0 14px 30px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

button:hover {
  border-color: #aebbd0;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  margin: 5px 0 0;
  color: var(--muted);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stat,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.stat {
  color: #2f3d56;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 130px 190px auto auto;
  gap: 12px;
  align-items: end;
  padding: 14px 24px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--border);
}

.field {
  display: grid;
  gap: 5px;
}

.field span,
.toggle span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 4px;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.view-toggle {
  display: inline-flex;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.view-toggle button {
  min-width: 70px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.view-toggle button:last-child {
  border-right: 0;
}

.view-toggle button.active {
  color: #fff;
  background: var(--blue);
}

.layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(460px, 1.05fr);
  min-height: 0;
}

.list-pane {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.results-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}

.results-header span {
  color: var(--muted);
}

.results {
  display: grid;
}

.special {
  display: grid;
  gap: 9px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.special:hover,
.special.selected {
  background: #f8fbff;
}

.special-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.special h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.28;
  letter-spacing: 0;
}

.venue-line {
  color: var(--muted);
  font-size: 13px;
}

.description {
  color: #253149;
  line-height: 1.38;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag.eatclub {
  color: var(--green);
  background: var(--green-bg);
}

.tag.source {
  color: #28446f;
  background: #e9f0fb;
}

.tag.time {
  color: var(--amber);
  background: var(--amber-bg);
}

.tag.distance {
  color: #4d5870;
  background: var(--surface-strong);
}

.map-pane {
  position: relative;
  min-height: 520px;
  background: #e7edf5;
}

#map {
  position: absolute;
  inset: 0;
}

.map-token-panel {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 3;
  width: min(360px, calc(100% - 36px));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.map-token-panel.hidden {
  display: none;
}

.map-token-panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: 0;
}

.map-token-panel button {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  font-weight: 700;
}

.marker {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.35);
}

.marker.eatclub {
  width: 20px;
  height: 20px;
  background: var(--green);
}

.popup h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.popup p {
  margin: 0 0 6px;
  color: #33425d;
}

.popup a {
  color: var(--blue);
  font-weight: 700;
}

.empty {
  padding: 24px 18px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .field:not(.compact),
  .view-toggle {
    grid-column: 1 / -1;
  }

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

  .list-pane {
    border-right: 0;
  }

  .map-pane {
    display: none;
    min-height: 70vh;
  }

  .layout.map-active .list-pane {
    display: none;
  }

  .layout.map-active .map-pane {
    display: block;
  }
}

@media (min-width: 981px) {
  .view-toggle {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar,
  .controls {
    padding-left: 14px;
    padding-right: 14px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .field.compact,
  .toggle {
    grid-column: 1 / -1;
  }

  .special-top {
    display: grid;
  }
}
