:root {
  --bg: #f3eadc;
  --ink: #1c1612;
  --muted: #4e433a;
  --card: #fffdf8;
  --line: #e0d3c2;
  --accent: #8d2b2b;
  --test: #8a5a12;
  --ok: #1f6b45;
  --info: #1d4e89;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 8px;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 36rem;
}

button,
select,
summary,
.directions {
  font: inherit;
}

#locate {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

#locate:disabled { opacity: 0.6; }

.banner {
  margin: 8px 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.banner-info { background: #eef4fb; border-color: #c5d6ea; }
.banner-ok { background: #e8f6ee; border-color: #b7dfc8; }
.banner-warn { background: #fff6e8; border-color: #efd3a4; }
.banner-test {
  background: #fff4df;
  border-color: #e0b15a;
  color: #5c3b08;
  font-weight: 650;
}
.banner-error { background: #fde8e4; border-color: #e3a299; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 0 16px 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

select {
  min-height: 44px;
  min-width: 11rem;
  padding: 0 10px;
  border: 1px solid #cbbba6;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.view-switch {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 10rem;
}

.view-switch button {
  flex: 1;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #cbbba6;
  background: #fff;
  font-weight: 700;
}

.view-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

@media (max-width: 899px) {
  body[data-view="list"] .map-wrap { display: none; }
  body[data-view="map"] .list { display: none; }
}

.layout { display: flex; flex-direction: column; }

.map-wrap { padding: 0 16px; }

#map {
  height: 38vh;
  min-height: 220px;
  border-radius: 16px;
  border: 1px solid #d9cbb8;
  background: #e7dccb;
}

.pin-count,
.legend {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend { margin-top: 2px; margin-bottom: 12px; }

.list { padding: 0 16px 28px; }

.group { margin-bottom: 8px; }

.group h2 {
  margin: 8px 0;
  font-size: 1.05rem;
}

.count {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0 6px;
  border-radius: 999px;
  background: #efe2d2;
  font-size: 0.8rem;
  text-align: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.card-test {
  border: 2px dashed #c47b12;
  background: #fff9ef;
}

.card-active { box-shadow: 0 0 0 3px #1d4e89; }

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

.card h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.badge {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  padding: 4px 8px;
  border-radius: 999px;
  background: #efe2d2;
}

.badge-branch { background: #f6e4c4; color: #6a4510; }

.badge-to_try { background: #f6d6d2; color: #6e221c; }
.badge-visited { background: #d9e6f5; color: #1d3f68; }
.badge-maybe { background: #dce8e1; color: #1d4a34; }
.badge-location_to_confirm { background: #f6e4c4; color: #6a4510; }

.test-badge {
  margin: 8px 0 0;
  color: var(--test);
  font-weight: 750;
}

.meta,
.distance,
.notes,
details p,
.empty {
  margin: 8px 0 0;
}

.distance { font-weight: 650; }

.notes { color: var(--ink); overflow-wrap: break-word; }

.dishes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.dishes li {
  background: #f3e6d4;
  border-radius: 999px;
  padding: 4px 10px;
}

details { margin-top: 8px; }

summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.nav-off {
  margin: 8px 0 0;
  color: #6b4a12;
}

.directions {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--ok);
  color: #fff;
  text-decoration: none;
  font-weight: 750;
  text-align: center;
}

.directions-test { background: var(--test); }

.actions {
  display: flex;
  gap: 8px;
}

.actions .directions,
.actions .text-button {
  flex: 1;
}

.text-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid #cbbba6;
  background: #fff;
  font-weight: 700;
}

a { color: var(--info); }

:focus-visible {
  outline: 3px solid var(--info);
  outline-offset: 2px;
}

.pin {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-weight: 800;
}

.pin-real { background: var(--accent); }
.pin-test { background: #c47b12; }

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

  .layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    padding: 0 16px 24px;
  }

  .map-wrap {
    order: 1;
    flex: 1.15;
    position: sticky;
    top: 12px;
    padding: 0;
  }

  #map { height: calc(100vh - 210px); min-height: 420px; }

  .list {
    order: 2;
    flex: 0.9;
    max-height: calc(100vh - 180px);
    overflow: auto;
    padding: 0 4px 0 0;
  }
}

/* V1.1 — simplified restaurant finder */
.top { align-items: center; padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: 12px; }
h1 { font-size: clamp(1.45rem, 5vw, 1.8rem); }
.location-status { margin: 0 16px 10px; padding: 0; color: var(--muted); font-size: .85rem; }
.location-status.status-ok { color: var(--ok); }
.location-status.status-warn { color: var(--muted); }
.controls { align-items: end; gap: 8px; }
.field { flex: 1 1 120px; min-width: 0; }
.field select { min-width: 0; width: 100%; }
.view-switch { flex: 1 1 185px; }
.list-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 8px 0; }
.list-heading h2 { margin: 0; font-size: 1rem; }
.sort-note { font-size: .82rem; color: var(--muted); }
.card-top h3 { font-size: 1.17rem; }
.cuisine-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.cuisine-tag { font-size: .77rem; background: #eee3d4; color: #60422f; padding: 3px 8px; border-radius: 999px; }
.card .meta { margin: 7px 0 0; }
.card .district { color: var(--muted); font-size: .85rem; }
.card .distance { color: var(--accent); margin: 7px 0 0; font-weight: 750; font-variant-numeric: tabular-nums; }
.dishes { margin-top: 9px; }
.dishes li { font-size: .88rem; }
.actions { display: flex; align-items: center; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.actions .text-button, .actions .maps-app-link { flex: 1 1 130px; margin: 0; }
.maps-app-link { display: inline-flex; justify-content: center; align-items: center; text-align: center; min-height: 46px; padding: 9px 12px; background: var(--accent); color: white; text-decoration: none; border-radius: 12px; font-weight: 700; }
.maps-app-link:hover { filter: brightness(.95); }
.maps-web-link { font-size: .81rem; white-space: nowrap; }
.more-source { margin: 10px 0 2px; font-size: .85rem; }
.card { padding: 15px; }
.pin-count, .legend, .nav-off, .directions { display: none; }
.map-wrap { padding-bottom: 14px; }
@media (max-width: 600px) {
 .top { gap: 8px; }
 #locate { padding: 0 10px; font-size: .88rem; }
 .controls { gap: 8px; }
 .field { flex: 1 1 42%; }
 .view-switch { flex-basis: 100%; }
 .card .actions .text-button, .card .actions .maps-app-link { flex: 1 1 125px; }
}
@media (min-width: 900px) {
 #map { height: calc(100vh - 160px); }
 .list { max-height: calc(100vh - 145px); }
}

.card .card-top .distance { white-space: nowrap; flex: 0 0 auto; font-size: .88rem; margin: 0; align-self: flex-start; }
.card .card-top h3 { min-width: 0; }
.actions .maps-app-link { white-space: nowrap; }
.more-source { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
