:root {
  --bg: #f8fafc;
  --fg: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --line: #cbd5e1;
  --focus: #facc15;
  --sos: #dc2626;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --fg: #f8fafc;
    --muted: #cbd5e1;
    --card: #111c31;
    --line: #334155;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --fg: #f8fafc;
  --muted: #cbd5e1;
  --card: #111c31;
  --line: #334155;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 1.15rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
a { color: inherit; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

.bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.3rem; }

main { padding: 16px; max-width: 640px; margin: 0 auto; padding-bottom: calc(env(safe-area-inset-bottom) + 32px); }

.intro { font-size: 1.2rem; margin: 4px 0 16px; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: #b91c1c; font-weight: 600; }
.sub { color: var(--muted); margin-top: -8px; }

/* Големи плочки: 2 в ред на телефон */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  --c: #1d4ed8;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 16px 10px; text-align: center; text-decoration: none;
  background: var(--c); color: #fff; border-radius: var(--radius);
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.15);
}
.tile:active { transform: scale(0.98); }
.tile .ico { font-size: 3rem; line-height: 1; }
.tile .lbl { font-weight: 800; font-size: 1.3rem; }
.tile .hint { font-size: 0.95rem; opacity: 0.95; }

.back { display: inline-block; font-size: 1.2rem; font-weight: 700; padding: 10px 0; text-decoration: none; }
h1 { font-size: 1.9rem; margin: 6px 0 4px; line-height: 1.2; }
h2 { font-size: 1.4rem; margin: 18px 0 8px; }

/* Големи бутони: минимум 56px височина */
.big {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 60px; margin: 10px 0; padding: 14px 16px;
  border: 0; border-radius: var(--radius); font: inherit; font-size: 1.25rem; font-weight: 800;
  text-decoration: none; text-align: center; cursor: pointer;
  background: #1d4ed8; color: #fff;
}
.big:disabled { opacity: 0.6; cursor: wait; }
.big.call { background: #15803d; }
.big.route { background: #1d4ed8; }
.big.sos { background: var(--sos); font-size: 1.5rem; min-height: 80px; }
.big.primary { background: #7c3aed; }
.big.ghost { background: transparent; color: var(--fg); border: 2px solid var(--line); }

button.ghost { background: transparent; color: var(--fg); border: 2px solid var(--line); border-radius: 12px; font: inherit; cursor: pointer; }
button.small { padding: 8px 12px; min-height: 44px; font-size: 1rem; font-weight: 700; }
button.ghost.small { min-width: 44px; }

.gps-help {
  background: #fff7ed; color: #431407; border: 2px solid #fb923c;
  border-radius: var(--radius); padding: 14px 16px; margin: 12px 0;
}
.gps-help h2 { margin-top: 0; }
.gps-help ol { padding-left: 22px; margin: 8px 0; }
.gps-help li { margin: 6px 0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gps-help { background: #3b1e0b; color: #ffedd5; }
}

.place {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}
.place h2 { margin: 0 0 6px; font-size: 1.35rem; }
.place p { margin: 4px 0; }
.place .hours { font-weight: 600; }
.place .note { color: var(--muted); }
.place .dist { font-weight: 700; color: #15803d; }
.place .btns { display: flex; flex-direction: column; gap: 4px; }

@media (min-width: 600px) {
  .btns { flex-direction: row; }
  .btns .big { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tile:active { transform: none; }
}
