@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Noto+Sans+TC:wght@400;700&display=swap');

:root {
  --primary: #ff4d6d;
  --accent: #ffd60a;
  --ink: #2b1d1a;
  --bg: #fff3e0;
  --panel: #fffdf8;
  --muted: #7a5c52;
  --shadow: 4px 6px 0 rgba(43, 29, 26, 0.18);
  --radius: 22px;
  --blob: #ffc2d1;
  font-family: "Fredoka", "Noto Sans TC", "PingFang HK", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
html { -webkit-text-size-adjust: 100%; }

body.app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 18%, #ffe566 0 42px, transparent 43px),
    radial-gradient(circle at 88% 12%, #ff8fab 0 28px, transparent 29px),
    radial-gradient(circle at 78% 88%, #80ed99 0 36px, transparent 37px),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 18px,
      rgba(255, 77, 109, 0.04) 18px,
      rgba(255, 77, 109, 0.04) 19px
    ),
    var(--bg);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

/* —— Topbar —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #ff8fab 45%, #ffb703 100%);
  color: #fff;
  box-shadow: 0 8px 0 rgba(43, 29, 26, 0.12);
  z-index: 5;
  border-bottom: 4px solid #2b1d1a;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.topbar::after {
  content: "🍜 🥟 🧋 🥩 🍰 🍵";
  position: absolute;
  right: -8px;
  bottom: 2px;
  opacity: 0.22;
  font-size: 1.1rem;
  letter-spacing: 0.35rem;
  pointer-events: none;
  transform: rotate(-4deg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-mascot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #2b1d1a;
  box-shadow: 3px 3px 0 #2b1d1a;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  flex-shrink: 0;
  animation: wiggle 2.8s ease-in-out infinite;
}
.brand-mascot-img {
  object-fit: contain;
  padding: 2px;
  background: #1a1a1a;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.legend-ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.legend-ghost img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(6deg) translateY(-2px); }
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand strong {
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}
.brand span {
  font-size: 0.78rem;
  opacity: 0.96;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 280px);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  z-index: 1;
  flex-shrink: 0;
}
.topbar-phone {
  display: none;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.95;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-btn .btn-emoji { line-height: 1; }
.topbar-btn .btn-label { white-space: nowrap; }

.btn {
  border: 2.5px solid #2b1d1a;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  box-shadow: 3px 3px 0 #2b1d1a;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  font-family: inherit;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #2b1d1a; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #2b1d1a; }
.btn.primary { background: var(--accent); color: #2b1d1a; }
.btn.ghost {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border-color: rgba(255,255,255,0.75);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.18);
}
.btn.danger { background: #ff6b6b; color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* —— Layout —— */
.layout {
  display: grid;
  /* minmax(0,…) prevents long sheet/search text from expanding the viewport */
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  position: relative;
  overflow: hidden;
}
.layout > * {
  min-width: 0;
  max-width: 100%;
}
.layout > div:first-child {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  width: 100%;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
  filter: saturate(1.08);
}

/* Search dock */
.search-dock {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 62px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(520px, calc(100% - 74px));
  min-width: 0;
  width: auto;
  box-sizing: border-box;
}
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fffdf8;
  border: 3px solid #2b1d1a;
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  box-shadow: 5px 5px 0 rgba(43, 29, 26, 0.2);
}
.search-bar .search-ico { font-size: 1.15rem; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-weight: 600;
  /* ≥16px: stop iOS Safari focus-zoom that blows whole layout */
  font-size: 16px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.search-bar input::placeholder { color: #b08980; font-weight: 500; }
.search-bar .btn { padding: 7px 12px; box-shadow: 2px 2px 0 #2b1d1a; }

.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  border: 2px solid #2b1d1a;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 #2b1d1a;
  font-family: inherit;
}
.chip:hover { background: var(--accent); }
.chip.active {
  background: var(--primary);
  color: #fff;
}
.chip-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  align-self: center;
  margin-right: 2px;
}
.radius-chips { margin-top: 2px; }

.coords-block, .ig-block, .img-ocr-block {
  margin-top: 12px;
  padding: 12px;
  border: 2.5px dashed #2b1d1a;
  border-radius: 14px;
  background: #fff8e8;
}
.ig-block {
  background: #f3e8ff;
  border-style: solid;
}
.img-ocr-block {
  background: #e8f6ff;
  border-style: solid;
}
.img-ocr-block input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 6px;
  padding: 10px 8px;
  font-size: 16px; /* avoid iOS zoom */
  border: 2px solid #2b1d1a;
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box;
}
.coords-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-bottom: 8px;
}
.coords-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.coords-row input[readonly] {
  background: #f5f0ea;
  cursor: default;
}
.place-seo-addr { font-weight: 700; font-size: 1.05rem; }
.place-seo-desc {
  background: #fff3e8;
  border: 2px dashed #ffb4a2;
  border-radius: 14px;
  padding: 12px;
  line-height: 1.5;
}
input[readonly] { color: #3d2c28; }

.search-results {
  background: #fffdf8;
  border: 3px solid #2b1d1a;
  border-radius: 18px;
  box-shadow: 5px 5px 0 rgba(43, 29, 26, 0.18);
  max-height: min(42vh, 320px);
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: none;
  box-sizing: border-box;
}
.search-results.open { display: block; }
.search-results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px 6px;
  font-weight: 700;
  font-size: 0.85rem;
}
.search-results-head button {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
}
.sr-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  border: none;
  border-top: 2px dashed #f0d9cf;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
}
.sr-item:hover { background: #fff3cd; }
.sr-item strong {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sr-item .sr-meta {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sr-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid #2b1d1a;
  margin-right: 4px;
}
.sr-badge.off { background: #ff8fab; color: #fff; }
.sr-badge.me { background: var(--accent); color: #2b1d1a; }
.sr-item.sr-user { border-left: 4px solid var(--accent); }
.sr-item.sr-official { border-left: 4px solid #ff8fab; }
.sheet h2.is-user-place { color: #b8860b; }
.sheet h2.is-official-place { color: var(--primary); }

/* Sheet */
.sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  width: auto;
  max-width: calc(100% - 24px);
  max-height: 48vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border-radius: var(--radius);
  border: 3px solid #2b1d1a;
  box-shadow: 6px 6px 0 rgba(43, 29, 26, 0.16);
  padding: 16px 16px 14px;
  z-index: 6;
  transform: translateY(120%);
  transition: transform 0.28s cubic-bezier(.2,1.2,.3,1);
  box-sizing: border-box;
  min-width: 0;
}
.sheet.open { transform: translateY(0); }
.sheet h2,
.sheet .meta,
.sheet .desc {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
/* When sheet open on mobile, tuck legend so it doesn't fight the card */
@media (max-width: 899px) {
  .sheet.open ~ .legend-float,
  .layout:has(.sheet.open) .legend-float { opacity: 0.35; pointer-events: none; }
}
.sheet .sheet-kicker {
  display: inline-block;
  background: var(--accent);
  border: 2px solid #2b1d1a;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.sheet h2 { margin: 0 0 6px; font-size: 1.25rem; line-height: 1.2; }
.sheet .meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; font-weight: 600; }
.sheet .desc {
  margin: 0 0 12px;
  line-height: 1.5;
  background: #fff3e8;
  border-radius: 14px;
  padding: 10px 12px;
  border: 2px dashed #ffb4a2;
}
.sheet .row { display: flex; flex-wrap: wrap; gap: 8px; }

.toast {
  position: absolute;
  top: auto;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b1d1a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 6;
  max-width: 90vw;
  font-size: 0.92rem;
  font-weight: 700;
  display: none;
  border: 2px solid #ffd60a;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}
.toast.show { display: block; animation: pop 0.25s ease; }
@keyframes pop {
  from { transform: translateX(-50%) scale(0.9); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

.pin-banner {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #2b1d1a;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 6;
  max-width: 92vw;
  font-size: 0.9rem;
  font-weight: 800;
  display: none;
  border: 3px solid #2b1d1a;
  box-shadow: 4px 4px 0 rgba(43,29,26,0.2);
}
.pin-banner.show { display: block; }

.bm-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 2.5px solid #2b1d1a;
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  margin: 0 0 8px;
  cursor: pointer;
  font: inherit;
  box-shadow: 3px 3px 0 #2b1d1a;
}
.bm-item:hover { background: #fff3cd; }
.bm-item span { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.fab-set {
  position: absolute;
  right: 12px;
  top: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 4;
  max-width: min(46vw, 160px);
}
.fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #2b1d1a;
  background: #fff;
  box-shadow: 3px 3px 0 #2b1d1a;
  cursor: pointer;
  font-size: 1.2rem;
  transition: transform 0.12s ease;
  flex-shrink: 0;
}
.fab:hover { transform: scale(1.06) rotate(-6deg); background: var(--accent); }
.heading-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 3px solid #2b1d1a;
  background: #e8f0ff;
  box-shadow: 3px 3px 0 #2b1d1a;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  color: #1e3a8a;
  cursor: pointer;
  text-align: center;
  white-space: normal;
  touch-action: manipulation;
}
.heading-badge:active { transform: scale(0.97); }

.auth-wrap, .admin-wrap {
  max-width: 480px;
  margin: 40px auto;
  padding: 0 16px 40px;
}
body:not(.app) {
  background:
    radial-gradient(circle at 20% 20%, #ffe566 0 50px, transparent 51px),
    radial-gradient(circle at 80% 10%, #ff8fab 0 40px, transparent 41px),
    var(--bg);
  min-height: 100%;
}
.card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 3px solid #2b1d1a;
  box-shadow: 6px 6px 0 rgba(43, 29, 26, 0.16);
  padding: 22px;
}
.card h1 { margin-top: 0; }
.card .auth-emoji { font-size: 2.2rem; margin-bottom: 6px; }
label { display: block; font-weight: 700; margin: 12px 0 6px; }
input[type=text],
input[type=password],
input[type=number],
input[type=color],
input[type=url],
input[type=search],
input[type=email],
input[type=tel],
textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 2.5px solid #2b1d1a;
  font: inherit;
  background: #fff;
  box-shadow: 2px 2px 0 rgba(43,29,26,0.08);
  box-sizing: border-box;
}
textarea { min-height: 90px; resize: vertical; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.error { color: #c1121f; margin: 8px 0; font-weight: 700; }
.success { color: #2a9d8f; }
.muted { color: var(--muted); font-size: 0.9rem; font-weight: 600; }

.admin-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-nav a { color: var(--primary); font-weight: 800; text-decoration: none; }
table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid #2b1d1a;
  box-shadow: 4px 4px 0 rgba(43,29,26,0.12);
}
table.admin-table th, table.admin-table td {
  padding: 10px;
  border-bottom: 1px solid #f0e0d8;
  text-align: left;
  font-size: 0.92rem;
}
table.admin-table th { background: #ffe0e6; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 29, 26, 0.4);
  z-index: 7;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fffdf8;
  width: min(480px, 100%);
  border-radius: var(--radius);
  padding: 18px;
  border: 3px solid #2b1d1a;
  box-shadow: 6px 6px 0 rgba(43, 29, 26, 0.22);
  max-height: 80vh;
  overflow: auto;
}
.modal h3 { margin-top: 0; font-size: 1.2rem; }

.legend-float {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  background: rgba(255,253,248,0.94);
  border: 2.5px solid #2b1d1a;
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(43,29,26,0.15);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.legend-float i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #2b1d1a;
  vertical-align: -1px;
  margin-right: 3px;
}
.legend-float .off { background: var(--primary); }
.legend-float .me { background: var(--accent); }
.legend-float .you { background: #2563eb; }

/* —— Mobile first polish (phone / narrow) —— */
@media (max-width: 899px) {
  .topbar {
    padding: 8px 10px calc(8px + env(safe-area-inset-top, 0px));
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    gap: 8px;
    flex-wrap: nowrap;
  }
  .topbar::after { display: none; }
  .brand-mascot,
  .brand-mascot-img { width: 40px; height: 40px; }
  .brand strong { font-size: 0.95rem; line-height: 1.15; }
  .brand span { display: none; }
  .topbar-actions { gap: 5px; }
  .topbar-btn {
    padding: 7px 10px;
    font-size: 0.8rem;
    box-shadow: 2px 2px 0 #2b1d1a;
  }
  .topbar-btn.ghost { box-shadow: 2px 2px 0 rgba(0,0,0,0.18); }
  /* ≤480: icon-first, hide long labels */
  .topbar-phone { display: none !important; }

  .search-dock {
    top: 8px;
    left: 8px;
    right: 56px;
    max-width: none;
    gap: 6px;
  }
  .search-bar {
    padding: 5px 6px 5px 10px;
    border-width: 2.5px;
    box-shadow: 3px 3px 0 rgba(43, 29, 26, 0.18);
  }
  .search-bar .search-ico { font-size: 1rem; }
  /* keep 16px on mobile — never drop below or iOS zooms page */
  .search-bar input { font-size: 16px; }
  .search-bar .btn { padding: 6px 10px; font-size: 0.82rem; }

  .search-chips,
  .radius-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    max-width: 100%;
  }
  .search-chips::-webkit-scrollbar,
  .radius-chips::-webkit-scrollbar { display: none; }
  .chip {
    flex: 0 0 auto;
    padding: 4px 9px;
    font-size: 0.72rem;
    box-shadow: 1.5px 1.5px 0 #2b1d1a;
  }
  .chip-label { flex: 0 0 auto; font-size: 0.7rem; }

  .search-results {
    max-height: min(32vh, 240px);
    border-width: 2.5px;
  }

  .fab-set {
    right: 8px;
    top: 8px;
    gap: 8px;
  }
  .fab {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .legend-float {
    left: 8px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    padding: 5px 8px;
    font-size: 0.65rem;
    gap: 6px;
    max-width: calc(100% - 72px);
  }
  .legend-float img { width: 16px; height: auto; }

  /* Bottom sheet — leave map room above; never expand page width */
  .sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: min(46vh, 360px);
    border-radius: 18px 18px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 0 rgba(43, 29, 26, 0.12);
  }
  .search-dock {
    max-width: calc(100% - 64px);
  }
  .search-results {
    width: 100%;
    max-width: 100%;
  }
  .sheet .sheet-kicker { font-size: 0.68rem; }
  .sheet h2 { font-size: 1.1rem; margin-bottom: 4px; }
  .sheet .meta { font-size: 0.8rem; }
  .sheet .desc {
    font-size: 0.85rem;
    padding: 8px 10px;
    margin-bottom: 10px;
    max-height: 4.5em;
    overflow: auto;
  }
  .sheet .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .sheet .row .btn {
    justify-content: center;
    padding: 10px 8px;
    font-size: 0.85rem;
  }
  .sheet .row .btn.primary {
    grid-column: 1 / -1;
  }
  #btn-close-sheet { grid-column: 1 / -1; }

  .pin-banner {
    top: auto;
    bottom: calc(52vh + 8px);
    font-size: 0.8rem;
    padding: 8px 12px;
    max-width: 92vw;
  }
  .toast {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    font-size: 0.85rem;
    max-width: 92vw;
  }

  .modal-backdrop {
    position: fixed;
    inset: 0;
    padding: 0;
    align-items: flex-end;
    z-index: 20;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: min(88dvh, 100%);
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 420px) {
  .topbar-btn .btn-label { display: none; }
  .topbar-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
    justify-content: center;
  }
  .topbar-btn .btn-emoji { font-size: 1.15rem; }
  .brand strong {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 640px) and (max-width: 899px) {
  .topbar-phone { display: inline-block; }
  .topbar-btn .btn-label { display: inline; }
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  }
  .layout > div:first-child { height: auto; }
  .search-dock {
    right: auto;
    width: min(420px, calc(100% - 16px));
    max-width: min(420px, calc(100% - 16px));
  }
  .topbar-phone { display: inline-block; }
  .sheet {
    position: static;
    transform: none;
    max-height: none;
    height: 100%;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border-left: 3px solid #2b1d1a;
    border-top: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
    padding: 16px 16px 14px;
    overflow-x: hidden;
  }
  .sheet:not(.open) { display: block; }
  .sheet .row {
    display: flex;
    flex-wrap: wrap;
  }
  .sheet .row .btn.primary,
  #btn-close-sheet { grid-column: auto; }
  .legend-float { bottom: 18px; }
  #map { min-height: 320px; }
}
