*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:        #0f0f0f;
  --paper:      #F4EFE6;
  --paper2:     #EBE5D8;
  --white:      #ffffff;
  --red:        #D93B22;
  --red-dim:    rgba(217,59,34,0.10);
  --blue:       #1A4DE8;
  --blue-dim:   rgba(26,77,232,0.08);
  --green:      #18C96A;
  --green-light:#8BC34A;
  --green-dim:  rgba(24,201,106,0.10);
  --amber:      #E8920F;
  --muted:      #8a8578;
  --border:     #D5CFC4;
  --safe-fill:  rgba(24,201,106,0.10);
  --safe-stroke:rgba(24,201,106,0.55);
  --gap-stroke: rgba(217,59,34,0.85);
  --community:  #E88A1A;
  --community-dim: rgba(232,138,26,0.10);
  --shadow-sm:  0 1px 2px rgba(15,15,15,0.06);
  --shadow-md:  0 2px 8px rgba(15,15,15,0.08), 0 1px 2px rgba(15,15,15,0.04);
  --shadow-lg:  0 4px 16px rgba(15,15,15,0.10), 0 2px 4px rgba(15,15,15,0.04);
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: var(--ease-expo);
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'DM Mono', monospace;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -- HEADER -- */
header {
  background: var(--ink);
  color: var(--paper);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 14px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}
header::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(to bottom, rgba(15,15,15,0.08), transparent);
  pointer-events: none;
}

h1.logo { margin: 0; }
.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.logo-shield {
  width: 28px; height: 28px;
  background: var(--red);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
  transition: transform 0.3s var(--ease-spring);
}
header:hover .logo-shield { transform: scale(1.08); }

.logo-he {
  font-family: 'Noto Sans Hebrew', sans-serif;
  font-size: 12px; opacity: 0.35; font-weight: 400;
}
.header-tag {
  margin-left: auto;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.3;
}

/* -- LAYOUT -- */
.app { display: flex; flex: 1; overflow: hidden; }

/* -- SIDEBAR -- */
.sidebar {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--paper);
  overflow: hidden;
  position: relative;
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: -6px; bottom: 0; width: 6px;
  background: linear-gradient(to right, rgba(15,15,15,0.04), transparent);
  pointer-events: none;
  z-index: 2;
}
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 20px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.lbl {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  margin-top: 22px;
  font-weight: 500;
}
.lbl:first-child { margin-top: 0; }

/* -- INPUT FIELDS -- */
.field {
  position: relative;
  margin-bottom: 8px;
}
.field-dot {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  pointer-events: none; z-index: 2;
  box-shadow: 0 0 0 2px var(--white);
}
.field-dot.s { background: var(--green); }
.field-dot.e { background: var(--red); }

input[type=text], input[type=password] {
  width: 100%;
  padding: 11px 12px 11px 30px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-family: 'DM Mono', monospace;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  border-radius: var(--radius-sm);
}
input[type=text].plain, input[type=password].plain { padding-left: 12px; }
input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}
input::placeholder { color: var(--muted); }

.loc-btn {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  padding: 10px; z-index: 2;
  color: var(--border); font-size: 16px; line-height: 1;
  transition: color 0.2s, transform 0.2s var(--ease-spring);
  display: flex; align-items: center;
  border-radius: 4px;
}
.loc-btn:hover { color: var(--blue); transform: translateY(-50%) scale(1.1); }
.loc-btn.active { color: var(--blue); }
.loc-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* -- SWAP BUTTON -- */
.fields-wrap {
  display: flex; align-items: center; gap: 6px;
}
.fields-inputs { flex: 1; min-width: 0; }
.swap-btn {
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; padding: 7px; color: var(--muted);
  transition: all 0.2s var(--ease-out);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.swap-btn:hover { color: var(--blue); border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.swap-btn:active { transform: scale(0.94); }
.swap-btn svg { width: 20px; height: 20px; fill: currentColor; }
body.he .swap-btn { order: -1; }

/* -- RADIUS ROW -- */
.radius-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
}
.radius-row label { font-size: 11px; color: var(--muted); flex: 1; }

/* -- TOGGLE ROW -- */
.toggle-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
}
.toggle-row label { font-size: 11px; color: var(--muted); cursor: pointer; }
.toggle-row > label:first-child { flex: 1; }
.toggle-switch {
  position: relative; display: inline-block;
  width: 44px; height: 26px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border); border-radius: 13px;
  transition: background 0.25s var(--ease-out);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: transform 0.25s var(--ease-spring);
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* -- DRAG HINT -- */
.drag-hint {
  font-size: 10px; color: var(--blue); margin-top: 10px;
  padding: 8px 10px; background: var(--blue-dim);
  border-radius: var(--radius-sm); line-height: 1.5;
  display: none;
  border-left: 3px solid var(--blue);
}
.drag-hint.show {
  display: block;
}

/* -- SELECT -- */
select {
  font-family: 'DM Mono', monospace; font-size: 12px;
  border: 1.5px solid var(--border); background: var(--white);
  padding: 6px 10px; outline: none; cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color 0.2s;
}
select:focus { border-color: var(--blue); }

/* -- BUTTONS -- */
.btn {
  width: 100%; padding: 13px;
  background: var(--ink); color: var(--paper);
  border: none; font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 13px;
  letter-spacing: 0.06em; cursor: pointer;
  transition: all 0.2s var(--ease-out);
  margin-top: 16px;
  border-radius: var(--radius-sm); position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.06), transparent);
  pointer-events: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .sp {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.6s linear infinite; margin: 0 auto;
}
.btn.loading .bt { display: none; }
.btn.loading .sp { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -- STATUS -- */
.status {
  font-size: 11px; min-height: 28px;
  padding: 8px 0; color: var(--muted);
  line-height: 1.5;
  transition: color 0.2s;
}
.status.err  { color: var(--red); }
.status.info { color: var(--blue); }
.status.ok   { color: var(--green); }

/* -- SCORE CARD -- */
.score-wrap {
  display: none; margin-top: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  padding: 16px 16px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s;
}
.score-wrap:hover { box-shadow: var(--shadow-md); }
.score-wrap.show {
  display: block;
  animation: fadeUp 0.4s var(--ease-out);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.score-top {
  display: flex; align-items: baseline;
  justify-content: space-between; margin-bottom: 12px;
}
.score-pct {
  font-family: 'Syne', sans-serif;
  font-weight: 900; font-size: 32px;
  letter-spacing: -1px;
  line-height: 1;
}
.score-pct.full  { color: var(--green); }
.score-pct.high  { color: var(--green-light); }
.score-pct.mid   { color: var(--amber); }
.score-pct.low   { color: var(--red); }
.score-label {
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-top: 2px;
}
.score-detail { text-align: right; }
.score-detail-label { font-size: 10px; color: var(--muted); }
.score-detail-label--spaced { margin-top: 4px; }
.score-detail-value {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px;
}

.score-bar-track {
  height: 8px; background: var(--paper);
  border-radius: 4px; overflow: hidden;
}
.score-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 0.8s var(--ease-out);
}

.score-meta {
  display: flex; gap: 0; margin-top: 14px;
  border-top: 1px solid var(--paper2);
  padding-top: 12px;
}
.smeta {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; text-align: center;
}
.smeta:not(:last-child) { border-right: 1px solid var(--paper2); }
.smeta-v {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15px;
}
.smeta-l {
  font-size: 8px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* -- SHARE ROW -- */
.share-row {
  display: none;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--paper2);
}
.score-wrap.show .share-row { display: flex; }
.share-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px; font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  min-width: 0;
}
.share-btn:hover {
  background: var(--white);
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.share-btn:active { transform: scale(0.97); }
.share-btn--pdf { color: var(--red); border-color: rgba(217,59,34,0.25); }
.share-btn--pdf:hover { border-color: var(--red); background: rgba(217,59,34,0.06); }
.share-btn svg { flex-shrink: 0; }

/* -- SHELTER LIST -- */
.section-head {
  font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
  margin: 20px 0 10px;
  display: flex; align-items: center; gap: 8px;
  font-weight: 500;
}
.section-head::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.section-head--toggle {
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink);
  font-weight: 600;
  padding: 10px 0;
  margin: 16px 0 0;
  transition: color 0.2s;
  user-select: none;
}
.section-head--toggle:hover { color: var(--blue); }
.section-head--toggle::after { display: none; }
.shelter-count {
  font-weight: 400;
  color: var(--muted);
  font-size: 10px;
}
.section-chevron {
  fill: currentColor;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-out);
}
.section-head--toggle.open .section-chevron {
  transform: rotate(180deg);
}
.shelter-list-collapsible {
  display: none;
}
.shelter-list-collapsible.open {
  display: block;
  animation: fadeUp 0.3s var(--ease-out);
}

.s-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.s-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md), 0 0 0 3px var(--blue-dim);
  transform: translateY(-1px);
}
.s-card.active {
  border-color: var(--blue);
  background: var(--blue-dim);
  box-shadow: 0 0 0 3px var(--blue-dim);
}
.s-card-row { display: flex; align-items: flex-start; gap: 10px; }
.s-num {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 10px; background: var(--blue); color: white;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
  box-shadow: 0 1px 3px rgba(26,77,232,0.3);
}
.s-name { font-size: 11.5px; font-weight: 500; flex: 1; line-height: 1.45; }
.s-dist {
  font-size: 10.5px; color: var(--blue); font-weight: 500; flex-shrink: 0;
  font-family: 'Syne', sans-serif;
}
.s-addr { font-size: 10px; color: var(--muted); margin-top: 4px; padding-left: 32px; }
.s-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; padding-left: 32px; }
.s-tag {
  font-size: 8.5px; padding: 2px 7px;
  border-radius: 3px; background: var(--paper);
  color: var(--muted); white-space: nowrap;
  letter-spacing: 0.02em;
}
.s-tag.accessible { background: var(--green-dim); color: #1a7a3a; }
.s-tag.filtered { background: var(--blue-dim); color: #1152b8; }
.s-tag.status-ok { background: var(--green-dim); color: #1a7a3a; }
.s-tag.status-bad { background: var(--red-dim); color: var(--red); }
.s-tag.community { background: var(--community-dim); color: #9a5a00; font-weight: 500; }
.s-notes {
  font-size: 10px; color: var(--muted); margin-top: 6px; padding-left: 32px;
  line-height: 1.5; direction: rtl; text-align: right;
}


/* -- DISCLAIMER -- */
.disc {
  background: var(--community-dim);
  border: 1px solid rgba(232,146,15,0.3);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 10px; line-height: 1.7;
  color: var(--ink); margin-top: 14px;
}
.disc strong { color: var(--red); }

/* -- EMPTY STATE -- */
.empty {
  text-align: center; padding: 28px 16px 20px;
  color: var(--muted);
}
.empty-icon {
  font-size: 36px; margin-bottom: 12px;
  width: 56px; height: 56px;
  background: var(--red);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  line-height: 1;
}
.empty-txt {
  font-size: 11.5px; line-height: 1.8;
  max-width: 280px; margin: 0 auto;
  color: var(--ink);
}
.empty-txt strong {
  font-weight: 600;
}
.empty-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 20px;
}
.empty-step {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--ink);
}
.empty-step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue); color: white;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.empty-step-arrow {
  color: var(--border); font-size: 12px; flex-shrink: 0;
}
body.he .empty-step-arrow { transform: scaleX(-1); }
.empty-divider {
  width: 40px; height: 1px; background: var(--border);
  margin: 18px auto;
}
.empty-examples-label {
  font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px; font-weight: 500;
}
.empty-examples {
  display: flex; flex-direction: column; gap: 6px;
  max-width: 280px; margin: 0 auto;
}
.example-chip {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s var(--ease-out);
}
.example-chip:hover {
  border-color: var(--blue);
  background: var(--blue-dim);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.example-chip:active {
  transform: translateY(0);
}
body.he .example-chip { text-align: right; }
@media (max-width: 768px) {
  .empty-steps { gap: 4px; }
  .empty-step { font-size: 9px; }
  .empty-step-num { width: 17px; height: 17px; font-size: 9px; }
}

/* -- LEGEND -- */
.legend {
  position: absolute; bottom: 20px; right: 20px;
  background: var(--white); border: 1px solid var(--border);
  padding: 12px 16px; z-index: 5;
  box-shadow: var(--shadow-lg);
  font-size: 11px; min-width: 175px;
  display: none;
  border-radius: var(--radius-md);
}
.legend.show {
  display: block;
}
.legend-title {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 11px; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--paper2);
  letter-spacing: -0.2px;
}
.leg-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.leg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.leg-line { width: 22px; height: 4px; flex-shrink: 0; border-radius: 2px; }

/* -- MAP -- */
.map-wrap { flex: 1; position: relative; min-width: 0; min-height: 0; }
#map { width: 100%; height: 100%; display: block; }

/* -- DATA SOURCE -- */
.data-src {
  font-size: 9px; color: var(--muted); margin-top: 8px;
  letter-spacing: 0.05em; opacity: 0.7;
}
.data-src a { color: var(--blue); text-decoration: none; }

/* -- RATINGS -- */
.s-rating {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding-left: 32px;
  font-size: 10px; color: var(--muted);
}
.s-stars { color: var(--amber); letter-spacing: 1px; }
.star-input span {
  cursor: pointer; font-size: 18px; color: var(--border);
  transition: color 0.1s, transform 0.15s var(--ease-spring);
}
.star-input span.active { color: var(--amber); }
.star-input span:hover { color: var(--amber); transform: scale(1.2); }
.review-form textarea {
  width: 100%; font-family: 'DM Mono', monospace; font-size: 11px;
  border: 1px solid var(--border); padding: 8px;
  margin-top: 6px; resize: vertical; min-height: 40px;
  border-radius: var(--radius-sm); outline: none;
  transition: border-color 0.2s;
}
.review-form textarea:focus { border-color: var(--blue); }
.review-form button {
  margin-top: 6px; padding: 5px 12px; font-size: 10px;
  font-family: 'Syne', sans-serif; font-weight: 700;
  background: var(--ink); color: var(--paper); border: none;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: opacity 0.15s;
}
.review-form button:hover { opacity: 0.8; }
.review-form button:disabled { opacity: 0.35; cursor: not-allowed; }
.iw-reviews { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.iw-review { font-size: 10px; color: var(--muted); margin-bottom: 4px; line-height: 1.4; }
.iw-review .iw-r-stars { color: var(--amber); font-size: 9px; }

/* -- ADD MIKLAT BUTTON -- */
.btn-community {
  background: var(--white);
  color: var(--community);
  border: 1.5px dashed var(--community);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  margin-top: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  border-radius: var(--radius-sm);
}
.btn-community:hover {
  background: var(--community-dim);
  border-style: solid;
  transform: translateY(-1px);
}

/* -- COMMUNITY PLACEMENT BAR -- */
.community-bar {
  display: none;
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 60;
  background: var(--community);
  color: #fff;
  padding: 12px 18px;
  font-size: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(232,138,26,0.3);
}
.community-bar.show { display: flex; }
.community-bar-hint { flex: 1; font-weight: 500; }
.community-bar-cancel {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  font-family: 'DM Mono', monospace; font-size: 11px;
  padding: 6px 14px; cursor: pointer; border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.community-bar-cancel:hover { background: rgba(255,255,255,0.35); }

/* -- COMMUNITY FORM OVERLAY -- */
.community-form-overlay {
  display: none;
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 55;
  background: rgba(15,15,15,0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  align-items: center; justify-content: center;
}
.community-form-overlay.show { display: flex; }
.community-form {
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 24px 24px 20px;
  width: 360px;
  max-width: 92vw;
  border-radius: var(--radius-md);
  animation: formEnter 0.3s var(--ease-out);
}
@keyframes formEnter {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.community-form-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 16px;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.community-form-disclaimer {
  font-size: 10px; color: #9a5a00;
  background: var(--community-dim);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  line-height: 1.5;
}
.community-form label {
  font-size: 9px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.12em;
  display: block; margin-bottom: 5px;
  font-weight: 500;
}
.community-form input[type=text] {
  margin-bottom: 10px;
}
.community-form textarea {
  width: 100%;
  font-family: 'DM Mono', monospace; font-size: 12px;
  border: 1.5px solid var(--border); background: var(--white);
  padding: 10px 12px; resize: vertical; min-height: 54px;
  border-radius: var(--radius-sm); color: var(--ink); outline: none;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.community-form textarea:focus { border-color: var(--community); box-shadow: 0 0 0 3px var(--community-dim); }
.community-form-addr-status {
  font-size: 10px; min-height: 16px; margin-bottom: 8px;
  color: var(--muted); line-height: 1.4;
}
.community-form-addr-status.err { color: var(--red); }
.community-form-hint {
  font-size: 9.5px; color: var(--muted); line-height: 1.5;
  margin-bottom: 12px;
}
.community-form-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.community-form-cancel {
  background: none; border: 1.5px solid var(--border); color: var(--muted);
  font-family: 'DM Mono', monospace; font-size: 11px;
  padding: 8px 16px; cursor: pointer; border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.community-form-cancel:hover { border-color: var(--ink); color: var(--ink); }
.community-form-save {
  background: var(--community); border: none; color: #fff;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 12px;
  padding: 8px 20px; cursor: pointer; border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  transition: all 0.2s var(--ease-out);
}
.community-form-save:hover { opacity: 0.85; transform: translateY(-1px); }
.community-form-save:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* -- LANGUAGE SELECTOR -- */
#langSel {
  background: transparent; color: var(--paper);
  border: 1px solid rgba(244,239,230,0.2);
  font-family: 'DM Mono', monospace; font-size: 11px; padding: 4px 8px;
  cursor: pointer; border-radius: var(--radius-sm); margin-left: 12px;
  transition: border-color 0.2s;
}
#langSel:hover { border-color: rgba(244,239,230,0.5); }
#langSel option { background: var(--ink); color: var(--paper); }

/* -- RTL (Hebrew) -- */
body.he { direction: rtl; }
body.he .sidebar { border-right: none; border-left: 1px solid var(--border); }
body.he .sidebar::after { right: auto; left: auto; right: unset; left: -6px; background: linear-gradient(to left, rgba(15,15,15,0.04), transparent); }
body.he .field-dot { left: auto; right: 12px; }
body.he input[type=text], body.he input[type=password] { padding: 11px 30px 11px 12px; }
body.he input[type=text].plain, body.he input[type=password].plain { padding-right: 12px; }
body.he .s-addr, body.he .s-tags, body.he .s-rating, body.he .s-notes { padding-left: 0; padding-right: 32px; }
body.he .legend { right: auto; left: 20px; }
body.he .header-tag { margin-left: 0; margin-right: auto; }
body.he #langSel { margin-left: 0; margin-right: 12px; }
body.he .loc-btn { right: auto; left: 6px; }
body.he .drag-hint { border-left: none; border-right: 3px solid var(--blue); }
body.he .section-chevron { margin-left: 0; margin-right: auto; }
body.he .disc { border-left: 1px solid rgba(232,146,15,0.3); border-right: 3px solid var(--amber); }
body.he .smeta:not(:last-child) { border-right: none; border-left: 1px solid var(--paper2); }

/* ==== MOBILE: BOTTOM SHEET SEARCH ==== */
.mobile-sheet-search {
  padding: 0 18px 8px;
}
.mobile-sheet-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  justify-content: space-between;
}
.mobile-sheet-header .logo {
  font-size: 14px; gap: 6px;
}
.mobile-sheet-header .mobile-lang-sel {
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--border);
  font-family: 'DM Mono', monospace; font-size: 12px; padding: 4px 8px;
  cursor: pointer; border-radius: var(--radius-sm); flex-shrink: 0;
  -webkit-appearance: menulist; appearance: menulist;
}
.mobile-sheet-header .logo-shield {
  width: 22px; height: 22px; font-size: 9px;
}
.mobile-search-inputs {
  display: flex; flex-direction: column; gap: 6px;
}
.mobile-search-row {
  display: flex; align-items: center; gap: 8px;
  position: relative;
}
.mobile-search-row .field-dot {
  position: static; transform: none;
  width: 8px; height: 8px; flex-shrink: 0;
  box-shadow: none;
}
.mobile-search-row .input-wrap {
  flex: 1; position: relative; min-width: 0;
}
.mobile-search-row input {
  width: 100%; border: 1.5px solid var(--border); background: var(--paper);
  font-family: 'DM Mono', monospace; font-size: 13px;
  padding: 10px 34px 10px 12px; border-radius: var(--radius-md);
  color: var(--ink); outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.mobile-search-row input:focus {
  border-color: var(--blue); background: var(--white);
  box-shadow: 0 0 0 3px var(--blue-dim);
}
.mobile-search-row input::placeholder { color: var(--muted); }
.mobile-search-row .loc-btn {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  padding: 10px;
}
body.he .mobile-search-row .loc-btn { right: auto; left: 6px; }
body.he .mobile-search-row input { padding: 10px 12px 10px 34px; }

/* -- MOBILE SWAP BUTTON -- */
.mobile-fields-wrap {
  display: flex; align-items: center; gap: 6px;
}
.mobile-fields-col {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.mobile-swap-btn {
  padding: 8px; border-radius: var(--radius-md);
}
.mobile-swap-btn svg { width: 22px; height: 22px; }

.mobile-search-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.mobile-search-actions .btn {
  margin-top: 0; flex: 1; padding: 8px; font-size: 11px;
  border-radius: var(--radius-md);
  min-width: 0; white-space: nowrap; overflow: hidden;
}

/* -- MOBILE SETTINGS COLLAPSIBLE -- */
.mobile-settings-toggle {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  width: 100%; margin-top: 8px; padding: 7px;
  background: none; border: none; cursor: pointer;
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--muted); letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.mobile-settings-toggle:hover { color: var(--ink); }
.mobile-settings-chevron {
  fill: currentColor;
  transition: transform 0.25s var(--ease-out);
}
.mobile-settings-toggle.open .mobile-settings-chevron {
  transform: rotate(180deg);
}
.mobile-settings-panel {
  display: none;
  padding: 4px 0 0;
  animation: settingsReveal 0.25s var(--ease-out);
}
.mobile-settings-panel.open { display: block; }
@keyframes settingsReveal {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-settings-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.mobile-settings-row label {
  font-size: 10px; color: var(--muted); flex: 1;
}
.mobile-settings-row select {
  font-size: 12px; border-radius: var(--radius-md); padding: 7px 10px;
  border: 1.5px solid var(--border); background: var(--paper);
}
.mobile-settings-panel .toggle-row { margin-top: 8px; }
.mobile-settings-panel .toggle-row label { font-size: 10px; }
.mobile-settings-panel .btn-community {
  margin-top: 8px; font-size: 11px; padding: 7px;
}

/* ==== MOBILE: BOTTOM SHEET ==== */
.bottom-sheet {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 100vh; height: 100dvh;
  z-index: 100;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 20px rgba(15,15,15,0.12);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  transform: translateY(100%);
}
.bottom-sheet.no-transition { transition: none; }
.bottom-sheet .drag-handle {
  display: flex; justify-content: center; padding: 12px 0 8px;
  cursor: grab;
  touch-action: none;
}
.bottom-sheet .drag-handle::after {
  content: ''; width: 40px; height: 4px;
  background: var(--border); border-radius: 2px;
  transition: background 0.2s;
}
.bottom-sheet .drag-handle:active::after { background: var(--muted); }
.bottom-sheet-content {
  flex: 1; min-height: 0;
  overflow-y: auto; padding: 0 18px 24px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.bottom-sheet-content::-webkit-scrollbar { width: 0; }

/* -- MOBILE: STATUS PILL -- */
.mobile-status {
  display: none; font-size: 11px; color: var(--muted);
  text-align: center; padding: 4px 0 2px;
}
.mobile-status.err { color: var(--red); }
.mobile-status.info { color: var(--blue); }
.mobile-status.ok { color: var(--green); }

/* ==== MOBILE RESPONSIVE ==== */
@media (max-width: 768px) {
  header { display: none; }

  body { display: flex; flex-direction: column; }

  .app {
    flex: 1; position: relative;
    display: flex; flex-direction: column;
  }

  .map-wrap { flex: 1; min-height: 0; position: relative; }
  #map { width: 100%; height: 100%; z-index: 0; isolation: isolate; }
  .bottom-sheet { display: flex; flex-direction: column; }
  .community-bar { z-index: 120; }
  .community-form-overlay { z-index: 110; }

  .sidebar { display: none !important; }
  .mobile-status { display: block; }

  .legend {
    display: none !important;
  }

  .mobile-legend-inline {
    display: block !important;
    position: static;
    margin-top: 16px;
    padding: 12px 14px;
    font-size: 10px;
    min-width: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: none;
    background: var(--paper);
  }
}

/* -- FIRST-RUN TIP -- */
.first-run-tip {
  position: absolute;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 14px;
  max-width: 420px;
  width: calc(100% - 40px);
  animation: tipSlideUp 0.4s var(--ease-out);
}
.first-run-tip.out {
  animation: tipSlideDown 0.3s var(--ease-out) forwards;
}
.first-run-tip-text {
  font-size: 11.5px;
  line-height: 1.5;
  flex: 1;
}
.first-run-tip-dismiss {
  background: rgba(244,239,230,0.15);
  border: none;
  color: var(--paper);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 10px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.first-run-tip-dismiss:hover {
  background: rgba(244,239,230,0.25);
}

@keyframes tipSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes tipSlideDown {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

@media (max-width: 768px) {
  .first-run-tip {
    bottom: 136px;
    max-width: 340px;
  }
}

/* -- Score reveal choreography -- */
.score-wrap.show .score-pct {
  animation: scoreFadeIn 0.5s var(--ease-expo) both;
}
.score-wrap.show .score-bar-track {
  animation: scoreFadeIn 0.5s var(--ease-expo) 0.15s both;
}
.score-wrap.show .score-meta {
  animation: scoreFadeIn 0.4s var(--ease-expo) 0.3s both;
}
@keyframes scoreFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -- Staggered card entrance -- */
.s-card {
  animation: cardEnter 0.35s var(--ease-expo) both;
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -- Swap button rotation -- */
.swap-btn svg {
  transition: transform 0.3s var(--ease-expo);
}
.swap-btn.rotated svg {
  transform: rotate(180deg);
}

/* -- Field dot pulse on focus -- */
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--white); }
  50% { box-shadow: 0 0 0 2px var(--white), 0 0 0 5px rgba(26,77,232,0.15); }
}
.field:focus-within .field-dot {
  animation: dotPulse 1.2s var(--ease-out) 1;
}

/* -- Status crossfade -- */
.status {
  transition: color 0.2s, opacity 0.15s;
}
.status.fade-out { opacity: 0; }

/* -- Empty state stagger -- */
.empty-step {
  animation: fadeUp 0.4s var(--ease-expo) both;
}
.empty-step:nth-child(1) { animation-delay: 0.1s; }
.empty-step:nth-child(2) { animation-delay: 0.2s; }
.empty-step:nth-child(3) { animation-delay: 0.3s; }
.empty-step-arrow {
  animation: fadeUp 0.3s var(--ease-expo) both;
}
.empty-step-arrow:nth-of-type(1) { animation-delay: 0.15s; }
.empty-step-arrow:nth-of-type(2) { animation-delay: 0.25s; }
.empty-examples .example-chip {
  animation: fadeUp 0.35s var(--ease-expo) both;
}
.empty-examples .example-chip:nth-child(1) { animation-delay: 0.35s; }
.empty-examples .example-chip:nth-child(2) { animation-delay: 0.45s; }
.empty-examples .example-chip:nth-child(3) { animation-delay: 0.55s; }

/* -- Drag hint slide entrance -- */
.drag-hint.show {
  animation: slideInLeft 0.4s var(--ease-expo);
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
body.he .drag-hint.show {
  animation-name: slideInRight;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* -- Legend entrance -- */
.legend.show {
  animation: legendEnter 0.4s var(--ease-expo);
}
@keyframes legendEnter {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* -- Community form overlay fade -- */
.community-form-overlay.show {
  animation: overlayFadeIn 0.25s var(--ease-out);
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* -- Reduced motion -- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -- Text overflow safety -- */
.s-name {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.s-addr, .s-notes {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* -- Focus visible for keyboard nav -- */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* -- Draggable route waypoints -- */
.drag-waypoint { cursor: grab; }
.drag-waypoint:active { cursor: grabbing; }

/* -- Photon Autocomplete Dropdown -- */
.photon-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}
.photon-item {
  padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  border-bottom: 1px solid var(--paper2);
  transition: background 0.1s;
}
.photon-item:last-child { border-bottom: none; }
.photon-item:hover { background: var(--blue-dim); }

/* -- Leaflet popup overrides -- */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-family: 'DM Mono', monospace;
}
.leaflet-popup-content { margin: 8px 12px; }
.leaflet-popup-tip { box-shadow: var(--shadow-sm); }
