:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66716c;
  --paper: #f4f5ef;
  --surface: #ffffff;
  --surface-soft: #e8ede7;
  --line: #d8ddd5;
  --accent: #0f766e;
  --accent-strong: #0a5d56;
  --warn: #b45309;
  --good: #15803d;
  --shadow: 0 18px 60px rgba(22, 32, 28, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 245, 239, 0.92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48vw;
}

.top-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace {
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
}

.map-workspace {
  position: relative;
  min-height: calc(100svh - 72px);
  overflow: hidden;
  background: #dbe9e2;
}

.map-canvas,
.fallback-map {
  position: absolute;
  inset: 0;
}

.google-embed-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.fallback-map {
  background:
    radial-gradient(circle at 32% 42%, rgba(15, 118, 110, 0.16), transparent 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(180, 83, 9, 0.14), transparent 0 10%, transparent 11%),
    linear-gradient(35deg, transparent 0 47%, rgba(255,255,255,0.64) 47% 49%, transparent 49%),
    linear-gradient(120deg, transparent 0 58%, rgba(255,255,255,0.72) 58% 60%, transparent 60%),
    repeating-linear-gradient(0deg, rgba(23, 33, 29, 0.05) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(90deg, rgba(23, 33, 29, 0.05) 0 1px, transparent 1px 80px),
    #dfeae3;
}

.fallback-map.is-google-overlay {
  background: transparent;
  pointer-events: none;
}

.fallback-map.is-google-overlay .fallback-pin {
  pointer-events: auto;
}

.map-toolbar {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  z-index: 5;
}

.map-toolbar > * {
  pointer-events: auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: clamp(34px, 5.4vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.16;
  letter-spacing: 0;
}

.selected-strip {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(216, 221, 213, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateY(0);
  transition: transform 200ms ease, opacity 200ms ease;
}

.selected-strip.is-empty {
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
}

.selected-main {
  min-width: 0;
  flex: 1;
}

.selected-main strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-main span {
  color: var(--muted);
  font-size: 13px;
}

.control-panel {
  min-height: calc(100svh - 72px);
  max-height: calc(100svh - 72px);
  overflow: auto;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--paper);
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.summary-band div {
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.summary-band span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.summary-band small {
  color: var(--muted);
}

.search-block,
.sort-row,
.list-header {
  margin-bottom: 14px;
}

.search-block label,
.sort-row label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-field svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.search-field input {
  border: 0;
  outline: 0;
  width: 100%;
  min-width: 0;
  background: transparent;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip,
.ghost-button,
.text-button,
.primary-button,
.primary-link,
.icon-button,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.filter-chip,
.ghost-button,
.text-button,
.primary-button,
.primary-link {
  min-height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
}

.filter-chip:hover,
.ghost-button:hover,
.text-button:hover,
.primary-button:hover,
.primary-link:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.filter-chip.is-active,
.primary-button,
.primary-link {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.84);
}

.text-button {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
}

.full {
  width: 100%;
}

.sort-row select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-header h2 {
  font-size: 18px;
}

.toilet-list {
  display: grid;
  gap: 10px;
}

.toilet-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.toilet-item:hover,
.toilet-item.is-selected {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 14px 36px rgba(22, 32, 28, 0.09);
}

.item-pin {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e2f6ea;
  color: var(--good);
  font-weight: 900;
}

.item-pin.is-unverified {
  background: #fff4d8;
  color: var(--warn);
}

.item-body {
  min-width: 0;
}

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

.item-body strong {
  display: block;
  line-height: 1.25;
}

.item-body p {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.score {
  min-width: 42px;
  color: var(--good);
  font-weight: 900;
  text-align: right;
}

.tag-row,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #31423a;
  font-size: 12px;
  font-weight: 700;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(10, 20, 16, 0.36);
  backdrop-filter: blur(3px);
}

.detail-drawer,
.submit-dialog,
.premium-dialog {
  width: min(92vw, 520px);
  padding: 20px;
}

.detail-drawer {
  margin: auto 24px 24px auto;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.muted {
  color: var(--muted);
}

.dialog-actions {
  margin-top: 18px;
}

.submit-dialog form {
  display: grid;
  gap: 12px;
}

.submit-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.submit-dialog input,
.submit-dialog textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--paper);
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 0 8px;
}

.switch-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.premium-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0 0 16px;
  list-style: none;
}

.premium-list li {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.premium-list span {
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  z-index: 50;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.map-canvas {
  font: inherit;
  background: #dfeae3;
}

.toilet-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.35);
  border: 3px solid white;
  font-weight: 900;
}

.toilet-marker.is-unverified {
  background: var(--warn);
  box-shadow: 0 10px 24px rgba(180, 83, 9, 0.28);
}

.toilet-marker.is-selected {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  transform: scale(1.18);
}

.fallback-pin {
  position: absolute;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 3px solid white;
  border-radius: 999px;
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.32);
  font-weight: 900;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.fallback-pin.is-unverified {
  background: var(--warn);
}

.fallback-pin.is-selected {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  transform: translate(-50%, -50%) scale(1.18);
}

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

  .map-workspace {
    min-height: 54svh;
  }

  .control-panel {
    min-height: auto;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .map-toolbar {
    top: 18px;
    left: 16px;
    right: 16px;
  }

  h1 {
    max-width: 420px;
    font-size: clamp(32px, 10vw, 54px);
  }

  .selected-strip {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 620px) {
  .topbar {
    height: 66px;
    padding: 0 12px;
  }

  .brand span {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .primary-button {
    padding: 0 10px;
  }

  .workspace {
    min-height: calc(100svh - 66px);
  }

  .map-workspace {
    min-height: 58svh;
  }

  .map-toolbar {
    align-items: flex-start;
  }

  .map-toolbar .ghost-button {
    min-width: 88px;
  }

  .selected-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-band div {
    padding: 10px;
  }

  .summary-band span {
    font-size: 20px;
  }

  .detail-drawer {
    width: 100vw;
    max-width: none;
    margin: auto 0 0;
    border-radius: 8px 8px 0 0;
  }
}
