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

:root {
  --bg: #0a0a0a;
  --panel: #141414;
  --panel-2: #1d1d1d;
  --line: #2a2a2a;
  --text: #e8e8e8;
  --muted: #8a8a8a;
  --accent: #f0a500;
  --yes: #2ecc71;
  --no: #e74c3c;
}

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---- topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 1200;
  flex-shrink: 0;
}
.title-block { flex: 1; min-width: 0; }
.topbar h1 {
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.3px;
}
.subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-link {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.68rem; font-weight: bold; letter-spacing: 0.5px;
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
}
.sc-link:hover { border-color: var(--accent); color: #fff; }
.icon-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: border-color .15s;
}
.icon-btn:hover { border-color: var(--accent); }

/* ---- map ---- */
#map, #admin-map {
  flex: 1;
  width: 100%;
  background: #0a0a0a;
  z-index: 1;
}

/* ---- search pill ---- */
#search-form {
  position: absolute;
  top: 4.2rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(92%, 460px);
  z-index: 1100;
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  overflow: visible;
}
#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
}
#search-input::placeholder { color: var(--muted); }
#search-form button {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 1.2rem;
  padding: 0 1rem;
  cursor: pointer;
}
#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.search-row {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.search-row:last-child { border-bottom: none; }
.search-row:hover { background: var(--panel-2); }

/* ---- floating action buttons ---- */
.fab-stack {
  position: absolute;
  right: 0.9rem;
  bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 1100;
}
.fab {
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, border-color .15s;
}
.fab:hover { transform: scale(1.06); }
.fab.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240,165,0,0.35); }

/* ---- verdict bottom sheet ---- */
.verdict {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 110%);
  width: min(96%, 560px);
  margin-bottom: 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.6);
  z-index: 1150;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.verdict.shown { transform: translate(-50%, 0); }
.verdict.yes { border-color: var(--yes); }
.verdict.no { border-color: var(--no); }
.verdict-main { display: flex; align-items: center; gap: 0.9rem; flex: 1; min-width: 0; }
.verdict-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: bold;
  flex-shrink: 0;
  color: #0a0a0a;
}
.verdict.yes .verdict-icon { background: var(--yes); }
.verdict.no .verdict-icon { background: var(--no); }
.verdict-text { display: flex; flex-direction: column; min-width: 0; }
.verdict-text strong { font-size: 1.05rem; color: #fff; }
.verdict-text span { font-size: 0.82rem; color: var(--muted); }
.verdict-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.share-btn {
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.dismiss-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
}

/* ---- toast ---- */
.toast {
  position: absolute;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.96);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 1300;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- modal ---- */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1400;
  padding: 1rem;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
}
.modal-card h2 { color: #fff; margin-bottom: 0.8rem; }
.modal-card p { color: var(--text); font-size: 0.9rem; margin-bottom: 0.7rem; line-height: 1.5; }
.modal-card ul { list-style: none; margin: 0.5rem 0 1rem; }
.modal-card li { font-size: 0.88rem; color: var(--muted); padding: 0.25rem 0; }
.modal-card li strong { color: var(--text); }

button.primary {
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.hidden { display: none !important; }

/* ===================== ADMIN ===================== */
body.admin { overflow: hidden; }
.admin #editor { height: 100dvh; display: flex; flex-direction: column; }

.login-screen {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.login-card h1 { color: #fff; font-size: 1.4rem; }
.login-card p { color: var(--muted); font-size: 0.85rem; }
.login-card input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-error { color: var(--no); font-size: 0.85rem; }

.admin-panel {
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 0.9rem 1rem;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1rem;
  align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; min-width: 160px; }
.field label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.field input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.field input:focus { border-color: var(--accent); }
.toggle-field {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}
.toggle-field input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.admin-hint { flex-basis: 100%; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.admin-hint strong { color: var(--text); }
.admin-actions { display: flex; align-items: center; gap: 0.7rem; flex-basis: 100%; flex-wrap: wrap; }
.admin-actions button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  cursor: pointer;
  width: auto;
}
.admin-actions button.primary { background: var(--accent); color: #0a0a0a; border: none; font-weight: 600; }
.save-status { font-size: 0.85rem; color: var(--yes); }
.save-status.error { color: var(--no); }

@media (max-width: 600px) {
  .topbar h1 { font-size: 1.05rem; }
  .verdict-text strong { font-size: 0.98rem; }
}
