:root {
  --bg-dark: #0D120C;
  --card-dark: rgba(24, 32, 23, 0.85);
  --field-dark: rgba(35, 46, 34, 0.70);
  --line-dark: rgba(255, 255, 255, 0.10);
  --text-dark: #F5F7F4;
  --text-dim-dark: #8E9E8C;

  --bg-light: #F7F5F0;
  --card-light: rgba(255, 255, 255, 0.88);
  --field-light: rgba(239, 236, 230, 0.80);
  --line-light: rgba(0, 0, 0, 0.08);
  --text-light: #182216;
  --text-dim-light: #6A7768;

  --yolk: #F5C84B;
  --produce: #6FBF73;
  --dairy: #9BC4E2;
  --eggs: #F5C84B;
  --meat: #D96A4F;
  --flowers: #E58FB3;
  --mush: #C9A87C;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
}

body {
  font-family: 'Instrument Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

/* Micro-Interaction Transitions (§1.9) */
button, .cat, .chip, .lrow, .sd-res, .sd-cat, .price-btn, .soldbtn, .add-item-btn {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:active, .cat:active, .chip:active, .lrow:active {
  transform: scale(0.96);
}

/* Theme Classes */
body.dark-theme {
  --bg: var(--bg-dark);
  --card: var(--card-dark);
  --field: var(--field-dark);
  --line: var(--line-dark);
  --text: var(--text-dark);
  --text-dim: var(--text-dim-dark);
}

body.light-theme {
  --bg: var(--bg-light);
  --card: var(--card-light);
  --field: var(--field-light);
  --line: var(--line-light);
  --text: var(--text-light);
  --text-dim: var(--text-dim-light);
}

.view {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.view.active {
  display: block;
}

/* ================= SMART PWA INSTALLATION BANNER ================= */
.pwa-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--yolk);
  color: #10160F;
  padding: 10px 16px;
  z-index: 500;
  display: none;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  font-size: 13px;
  font-weight: 600;
}

.pwa-banner.show {
  display: flex;
}

.pwa-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-add-btn {
  background: #10160F;
  color: var(--yolk);
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.pwa-dismiss-btn {
  background: none;
  border: none;
  color: #10160F;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
}

#launch {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: radial-gradient(circle at 50% 30%, #172216 0%, #0D120C 100%);
  overflow-y: auto;
}

/* ================= LAUNCH SCREEN ================= */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding-top: max(72px, calc(48px + env(safe-area-inset-top)));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  box-sizing: border-box;
}

@media (max-height: 850px) {
  .hero {
    min-height: auto;
    padding-top: max(52px, calc(36px + env(safe-area-inset-top)));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .hero h1 {
    font-size: clamp(24px, 5vw, 38px);
    margin-bottom: 8px;
  }
  .tagline {
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.35;
  }
  .chip-row {
    margin-bottom: 14px;
    gap: 6px;
  }
  .chip {
    padding: 5px 10px;
    font-size: 11px;
  }
  .cta-row {
    margin-bottom: 16px;
    gap: 12px;
  }
  .cta {
    padding: 12px 22px;
    font-size: 14px;
  }
  .stats {
    padding-top: 10px;
    gap: 10px;
  }
  .stat b {
    font-size: 18px;
  }
  .stat span {
    font-size: 9.5px;
    letter-spacing: 0.02em;
  }
}

.hero-fields {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.4;
}

.launch-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 16px auto;
  overflow: hidden;
  gap: 12px;
}

.wordmark {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-style: italic;
  font-size: 24px;
  color: var(--text-dark);
  flex-shrink: 0;
}

.wordmark .sign {
  background: var(--yolk);
  color: #10160F;
  padding: 3px 10px;
  border-radius: 8px;
  display: inline-block;
  transform: rotate(-2deg);
  box-shadow: 0 4px 14px rgba(245, 200, 75, 0.3);
}

@media (min-width: 900px) {
  .wordmark {
    font-size: 34px;
  }
  .wordmark .sign {
    padding: 4px 14px;
    border-radius: 8px;
  }
  .hero-content {
    max-width: 740px;
  }
}

/* Fix Homepage Horizontal Overflow on Mobile */
.top-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  max-width: 100%;
  padding: 4px 0;
  touch-action: pan-x;
}
.admin-control {
  display: none !important;
}

body.admin-mode .admin-control {
  display: inline-flex !important;
}

.db-pill {
  font-size: 12px;
  font-weight: 700;
  background: var(--card-dark);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-dark);
  color: var(--text-dim-dark);
  padding: 8px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 22px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.db-pill.connected {
  background: rgba(111, 191, 115, 0.15);
  border-color: var(--produce);
  color: var(--produce);
}

.mod-pill {
  font-size: 12px;
  font-weight: 700;
  background: var(--card-dark);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 8px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 22px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--produce);
  background: rgba(111, 191, 115, 0.12);
  border: 1px solid rgba(111, 191, 115, 0.25);
  padding: 5px 12px;
  border-radius: 20px;
  flex-shrink: 0;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--produce);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--produce);
}

.theme-btn {
  background: var(--card-dark);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hero-content {
  z-index: 10;
  margin: auto 0;
  max-width: 640px;
}

.hero h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(32px, 8vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero h1 em {
  font-style: italic;
  color: var(--yolk);
}

.tagline {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dim-dark);
  margin-bottom: 24px;
}

.tagline strong {
  color: var(--text-dark);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.chip {
  background: var(--card-dark);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.cta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.cta {
  background: linear-gradient(135deg, #FAD766 0%, #F5C84B 100%);
  color: #10160F;
  border: none;
  padding: 16px 34px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(245, 200, 75, 0.38);
}

.cta-sub {
  font-size: 13px;
  color: var(--text-dim-dark);
}

.stats {
  display: flex;
  gap: 28px;
  border-top: 1px solid var(--line-dark);
  padding-top: 20px;
}

.stat b {
  display: block;
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--yolk);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat span {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 0.05em;
}

/* ================= LEAFLET MAP STYLES ================= */
.map-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #0D120C !important;
  touch-action: pan-x pan-y;
  z-index: 1;
}

.leaflet-container {
  background: #0D120C !important;
  font-family: inherit;
}

.dark-theme .leaflet-tile {
  filter: brightness(0.72) invert(1) contrast(1.2) hue-rotate(200deg) saturate(0.35);
}

.custom-pin {
  background: none;
  border: none;
}

.pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.pin-head {
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  border: 2px solid rgba(255, 255, 255, 0.95);
}

.pin-head span {
  transform: rotate(45deg);
  font-size: 17px;
}

.pin-label {
  background: rgba(24, 32, 23, 0.90);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-dark);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  margin-top: 4px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

.pin.open-now .pin-head {
  border-color: var(--produce);
}

.pin.pending .pin-head {
  border-color: var(--yolk);
  border-style: dashed;
}

.you-marker {
  width: 16px;
  height: 16px;
  background: #3B82F6;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 14px #3B82F6;
  animation: pulse-you 2s infinite;
}

@keyframes pulse-you {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

/* ================= OVERLAYS & STABLE FIXED TOPBAR ================= */
.topbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 600px;
  pointer-events: auto;
}

.searchrow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-logo-btn {
  background: var(--card-dark);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-style: italic;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.map-logo-btn .logo-sign {
  background: var(--yolk);
  color: #10160F;
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-block;
  transform: rotate(-2deg);
  box-shadow: 0 2px 8px rgba(245, 200, 75, 0.3);
}

.backbtn {
  background: var(--card-dark);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.searchbox {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--card-dark);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--line-dark);
  border-radius: 16px;
  padding: 0 14px;
  height: 44px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}

.searchbox input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 500;
  margin-left: 8px;
}

.searchbox input::placeholder {
  color: var(--text-dim-dark);
  opacity: 0.95;
}

.searchbox .clear {
  background: none;
  border: none;
  color: var(--text-dim-dark);
  cursor: pointer;
  display: none;
}

.searchbox .clear.show {
  display: block;
}

.cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  touch-action: pan-x;
}

.cat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-dark);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 8px 16px;
  min-height: 44px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  touch-action: manipulation;
}

.cat .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.searchdrop {
  display: none;
  background: #141D13 !important;
  border: 1px solid var(--line-dark);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65);
  max-height: 60vh;
  overflow-y: auto;
}

.searchdrop.open {
  display: block;
}

.sd-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim-dark);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.sd-hint-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.sd-hint-chips span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim-dark);
  background: var(--field-dark);
  border: 1px solid var(--line-dark);
  padding: 4px 10px;
  border-radius: 8px;
}

.sd-product-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.sd-product-shortcuts button {
  background: var(--field-dark);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sd-product-shortcuts button:hover {
  background: var(--card-dark);
  border-color: var(--yolk);
}

.sd-cats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.sd-cat {
  background: var(--field-dark);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 10px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  touch-action: manipulation;
}

.sd-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sd-res {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--text-dark);
  padding: 10px;
  min-height: 48px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
}

.sd-res:hover {
  background: var(--field-dark);
}

.ricon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rmain {
  flex: 1;
}

.rname {
  display: block;
  font-weight: 600;
  font-size: 13px;
}

.rsub {
  font-size: 11px;
  color: var(--text-dim-dark);
}

.rstat {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.tag-open-today { color: var(--produce); background: rgba(111,191,115,0.15); }
.tag-verified-recent { color: var(--yolk); background: rgba(245,200,75,0.15); }
.tag-unverified { color: var(--text-dim-dark); background: rgba(255,255,255,0.06); }

/* Multi-Stage Bottom Sheet (Peek / Half / Full) - Mobile Only */
@media (max-width: 999px) {
  .sheet.peek {
    max-height: 220px !important;
  }

  .sheet.half {
    max-height: 55vh !important;
  }

  .sheet.full {
    max-height: 88vh !important;
  }
}

/* ================= CONTROLS & FLOATING BUTTONS ================= */
.zoomers {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(90px, calc(70px + env(safe-area-inset-bottom)));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.zoomers button {
  width: 44px;
  height: 44px;
  background: var(--card-dark);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  border-radius: 14px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.32);
}

.fab {
  position: fixed;
  bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
  right: max(14px, env(safe-area-inset-right));
  z-index: 1000;
  background: linear-gradient(135deg, #FAD766 0%, #F5C84B 100%);
  color: #10160F;
  border: none;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(245, 200, 75, 0.38);
  pointer-events: auto;
}

.placing-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--yolk);
  color: #10160F;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  z-index: 2000;
  display: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

body.placing .placing-banner {
  display: block;
}

/* Mobile Slide-Up Native Sheet Modals */
@media (max-width: 600px) {
  .modal-back {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    border-radius: 28px 28px 0 0;
    max-height: 85vh;
    padding-bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
    transform: translateY(0);
    animation: slideUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}

/* ================= LIST PANEL & DETAIL SHEET ================= */
.listpanel {
  position: fixed;
  inset: 0;
  top: calc(max(48px, env(safe-area-inset-top)) + 92px);
  background: var(--bg-dark);
  z-index: 900;
  display: none;
  flex-direction: column;
  padding: 16px;
  padding-bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
  overflow-y: auto;
}

.listpanel.open {
  display: flex;
}

.list-note {
  font-size: 12px;
  color: var(--text-dim-dark);
  margin-bottom: 12px;
}

.lrow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-dark);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-dark);
  padding: 14px;
  border-radius: 16px;
  margin-bottom: 8px;
  color: var(--text-dark);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

.licon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.lmain { flex: 1; }
.lname { display: block; font-weight: 700; font-size: 15px; }
.lsub { font-size: 12px; color: var(--text-dim-dark); }
.lright { text-align: right; }
.lprice { font-weight: 700; color: var(--yolk); font-size: 14px; }
.lstat { font-size: 11px; font-weight: 700; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-dark);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid var(--line-dark);
  padding: 22px;
  z-index: 1500;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -12px 48px rgba(0,0,0,0.45);
  max-height: 80vh;
  overflow-y: auto;
  touch-action: pan-y;
  pointer-events: auto;
}

.sheet.open {
  transform: translateY(0);
}

@media (min-width: 1000px) {
  .topbar {
    max-width: 440px;
  }
  .cats {
    flex-wrap: wrap;
  }
  .sheet {
    top: 120px;
    bottom: 24px;
    left: 16px;
    right: auto;
    width: 440px;
    border-radius: 24px;
    border: 1px solid var(--line-dark);
    transform: translateX(-120%);
    max-height: calc(100vh - 144px) !important;
    z-index: 1500;
  }
  .sheet.open {
    transform: translateX(0);
  }
}

.grab {
  width: 36px;
  height: 5px;
  background: var(--text-dim-dark);
  opacity: 0.5;
  border-radius: 999px;
  margin: 0 auto 16px auto;
  cursor: grab;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.sheet-head h2 {
  font-family: 'Fraunces', serif;
  font-size: 22px;
}

.verify-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(111, 191, 115, 0.18);
  color: var(--produce);
  padding: 4px 10px;
  border-radius: 8px;
}

.verify-badge.pending {
  background: rgba(245, 200, 75, 0.18);
  color: var(--yolk);
}

.sheet-meta {
  font-size: 13px;
  color: var(--text-dim-dark);
  margin-bottom: 16px;
}

.avail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.avail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--field-dark);
  padding: 12px 14px;
  border-radius: 12px;
}

.avail-row.sold .iname,
.avail-row.sold .price-btn {
  opacity: 0.5;
}

.iname { font-size: 13px; font-weight: 600; }
.flagnote { font-size: 10px; color: var(--meat); font-weight: 700; }
.price { font-weight: 700; color: var(--yolk); }
.soldtag { font-size: 11px; font-weight: 700; color: var(--meat); }

.avail-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.price-btn {
  background: none;
  border: 1px dashed var(--line-dark);
  color: var(--yolk);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.soldbtn {
  background: none;
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 1 !important;
}

.soldbtn.restock {
  border-color: var(--produce);
  color: var(--produce);
  opacity: 1 !important;
}

.add-item-btn {
  width: 100%;
  background: var(--field-dark);
  border: 1px dashed var(--line-dark);
  color: var(--text-dark);
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  text-align: center;
}

.learned {
  font-size: 11px;
  color: var(--text-dim-dark);
  margin-top: 6px;
}

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

.sheet-actions button {
  flex: 1;
  height: 44px;
  background: var(--field-dark);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sheet-actions button.primary {
  background: linear-gradient(135deg, #FAD766 0%, #F5C84B 100%);
  color: #10160F;
  border: none;
}

.sheet-actions button.confirm-btn {
  background: rgba(111, 191, 115, 0.18);
  border: 1px solid var(--produce);
  color: var(--produce);
  min-height: 44px;
}

.sheet-actions button.confirm-btn.confirmed {
  background: var(--produce);
  color: #10160F;
  border: none;
  font-weight: 800;
}

.claim-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--field-dark);
  border: 1px solid var(--line-dark);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-top: 12px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
}

.claim-bar:hover {
  background: var(--card-dark);
  border-color: var(--yolk);
}

.claim-bar b {
  color: var(--yolk);
  font-weight: 700;
}

.owner-badge-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(111, 191, 115, 0.14);
  border: 1px solid rgba(111, 191, 115, 0.3);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--produce);
  margin-top: 12px;
  min-height: 44px;
}

/* Modal Enhancements Section (§1.1) */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  touch-action: pan-y;
}

.modal-back.open {
  display: flex;
}

.modal {
  background: #141D13 !important;
  border: 1px solid var(--line-dark);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
  color: var(--text-dark);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  margin: auto;
}

/* Elegant Mobile Responsive Scaling */
@media (max-width: 600px) {
  .modal-back {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    border-radius: 24px 24px 0 0;
    max-height: 85dvh;
    margin: 0;
    max-width: 100%;
  }
  .launch-topbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .top-controls {
    max-width: 100%;
    width: 100%;
  }
  .topbar {
    left: 10px;
    right: 10px;
    top: max(48px, env(safe-area-inset-top));
  }
  .cats {
    gap: 4px;
  }
  .cat {
    padding: 5px 10px;
    font-size: 11px;
  }
  .zoomers {
    right: 10px;
    bottom: 84px;
  }
  .zoomers button {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  .fab {
    right: 10px;
    bottom: 16px;
    padding: 12px 18px;
    font-size: 14px;
  }
  .sheet {
    padding: 16px;
  }
}

/* ================= PRINTABLE POSTER CANVAS (Full-Page QR) ================= */
.printable-poster-canvas {
  background: #FFFFFF;
  color: #10160F;
  padding: 32px 24px;
  border-radius: 20px;
  margin: 20px 0;
  border: 4px solid var(--yolk);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  text-align: center;
}

.poster-brand {
  font-family: 'Fraunces', serif;
  font-size: 36px;
  font-weight: 900;
  font-style: italic;
  color: #1E1A0C;
  background: var(--yolk);
  padding: 6px 20px;
  display: inline-block;
  border-radius: 8px;
  transform: rotate(-2deg);
  margin-bottom: 16px;
}

.poster-headline {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #10160F;
  letter-spacing: -0.01em;
}

.poster-sub {
  font-size: 14px;
  color: #555;
  margin-bottom: 20px;
}

.poster-qr-img {
  width: 220px;
  height: 220px;
  margin: 10px auto;
  display: block;
}

.poster-callout {
  background: #F7F5F0;
  border: 1px solid #E0DDD5;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  margin: 16px 0;
  color: #10160F;
}

.poster-categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 16px 0;
  font-size: 13px;
  font-weight: 700;
  color: #2D3E30;
}

.poster-footer-pwa {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  border-top: 1px solid #EEE;
  padding-top: 12px;
}

/* ================= PRINTABLE CASH SLOT FARMER PITCH CANVAS ================= */
.printable-pitch-canvas {
  background: #FFFFFF;
  color: #10160F;
  padding: 28px 24px;
  border-radius: 20px;
  margin: 18px 0;
  border: 2px solid var(--line-dark);
  text-align: left;
}

.pitch-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  color: #10160F;
}

.pitch-tag {
  font-size: 12px;
  font-weight: 800;
  background: var(--yolk);
  color: #10160F;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
  margin-bottom: 12px;
}

.pitch-intro {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  margin-bottom: 16px;
}

.pitch-box {
  background: #F7F5F0;
  border: 1px solid #E0DDD5;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.pitch-box h4 {
  font-size: 13px;
  font-weight: 800;
  color: #2D3E30;
  margin-bottom: 8px;
}

.pitch-box ul {
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.5;
  color: #444;
}

.pitch-monetization-box {
  background: #FFFDF5;
  border: 2px dashed #F5C84B;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.pitch-monetization-box h4 {
  font-size: 13px;
  font-weight: 800;
  color: #B48000;
  margin-bottom: 6px;
}

.pitch-monetization-box p {
  font-size: 12px;
  line-height: 1.4;
  color: #444;
  margin-bottom: 8px;
}

.pitch-link {
  font-size: 12px;
  font-weight: 700;
  color: #10160F;
}

.pitch-qr-cutout {
  border-top: 2px dashed #CCC;
  padding-top: 16px;
  margin-top: 16px;
}

.cutout-title {
  font-size: 11px;
  font-weight: 700;
  color: #777;
  margin-bottom: 10px;
}

.cutout-box {
  border: 2px solid #10160F;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  background: #FFF;
}

.cutout-wordmark {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  color: #10160F;
}

.cutout-sub {
  font-size: 11px;
  color: #555;
  margin-bottom: 8px;
}

.cutout-qr {
  width: 140px;
  height: 140px;
  margin: 0 auto;
}

body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100vw !important;
  height: 100vh !important;
  touch-action: none !important;
}

/* ================= MODALS ================= */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  touch-action: pan-y;
}

.modal-back.open {
  display: flex;
}

.modal {
  background: var(--card-dark);
  border: 1px solid var(--line-dark);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  color: var(--text-dark);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 { font-family: 'Fraunces', serif; font-size: 22px; margin-bottom: 8px; }
.modal p { font-size: 13px; color: var(--text-dim-dark); margin-bottom: 16px; }

.modal label { display: block; font-size: 12px; font-weight: 700; margin-top: 12px; margin-bottom: 4px; }
.modal input, .modal select, input, select, textarea {
  width: 100%;
  background: var(--field-dark);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
  font-size: 16px !important; /* Prevents iOS Safari auto-zoom on input focus */
}

.form-warn {
  background: rgba(217, 106, 79, 0.15);
  border: 1px solid var(--meat);
  color: #FF9E88;
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-top: 12px;
  display: none;
}

.form-warn.show { display: block; }

/* Custom Floating Item Suggestions Dropdown */
.item-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #141D13 !important;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 3500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.item-suggestions.open {
  display: block;
}

.item-sug-row {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-dark);
  cursor: pointer;
  border-bottom: 1px solid var(--field-dark);
}

.item-sug-row:last-child {
  border-bottom: none;
}

.item-sug-row:hover, .item-sug-row.active {
  background: var(--field-dark);
}

.item-sug-meta {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim-dark);
}

.ghost-btn {
  background: none;
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 10px 16px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mod-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--field-dark);
  border-radius: 10px;
  margin-bottom: 8px;
}

.mod-item-info b { display: block; font-size: 14px; }
.mod-item-info span { font-size: 12px; color: var(--text-dim-dark); }
.mod-item-actions { display: flex; gap: 6px; }
.mod-item-actions button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card-dark);
  border: 1px solid var(--line-dark);
  color: var(--text-dark);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  z-index: 400;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ================= DEDICATED PRINT STYLESHEET (Clean 1-Page Document Print) ================= */
@media print {
  @page {
    size: letter portrait;
    margin: 0.4in;
  }

  body {
    background: #FFFFFF !important;
    color: #10160F !important;
    overflow: visible !important;
    width: auto !important;
    height: auto !important;
  }

  /* Hide background interface */
  body > *:not(.modal-back) {
    display: none !important;
  }

  .modal-back {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    display: none !important;
    padding: 0 !important;
  }

  .modal-back.open {
    display: block !important;
  }

  .modal-back .modal {
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    background: #FFFFFF !important;
    color: #10160F !important;
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Hide print buttons */
  .modal-back button, .pwa-banner {
    display: none !important;
  }

  .printable-poster-canvas {
    border: 4px solid #F5C84B !important;
    padding: 40px 32px !important;
    margin: 0 !important;
  }

  .printable-pitch-canvas {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}

/* ================= STANDALONE PWA MODE (iPhone "Add to Home Screen" App) ================= */
@media (display-mode: standalone), (display-mode: fullscreen) {
  .launch-topbar {
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .topbar {
    top: max(20px, calc(10px + env(safe-area-inset-top)));
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
  }

  .zoomers {
    bottom: max(110px, calc(86px + env(safe-area-inset-bottom)));
    right: max(16px, env(safe-area-inset-right));
  }

  .fab {
    bottom: max(32px, calc(20px + env(safe-area-inset-bottom)));
    right: max(16px, env(safe-area-inset-right));
  }

  .sheet {
    padding-bottom: max(30px, calc(16px + env(safe-area-inset-bottom)));
  }

  .listpanel {
    top: calc(max(20px, calc(10px + env(safe-area-inset-top))) + 92px);
    padding-bottom: max(30px, calc(16px + env(safe-area-inset-bottom)));
  }
}

body.standalone-pwa .hero {
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

body.standalone-pwa .launch-topbar {
  padding-top: max(16px, env(safe-area-inset-top));
}

body.standalone-pwa .topbar {
  top: max(20px, calc(10px + env(safe-area-inset-top)));
}

body.standalone-pwa .zoomers {
  bottom: max(100px, calc(80px + env(safe-area-inset-bottom)));
}

/* Single Pending Pin Placement Confirmation Banner */
.confirm-pin-banner {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #141D13;
  border: 1px solid var(--yolk);
  color: var(--text-dark);
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.7);
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
  white-space: nowrap;
}

.confirm-pin-btn {
  background: var(--yolk);
  color: #10160F;
  border: none;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245,200,75,0.4);
}

body.standalone-pwa .fab {
  bottom: max(32px, calc(20px + env(safe-area-inset-bottom)));
}

body.standalone-pwa .sheet {
  padding-bottom: max(30px, calc(16px + env(safe-area-inset-bottom)));
}

body.standalone-pwa .listpanel {
  top: calc(max(20px, calc(10px + env(safe-area-inset-top))) + 92px);
  padding-bottom: max(30px, calc(16px + env(safe-area-inset-bottom)));
}
