:root {
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --bg: #f1f5f4;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #d5dedc;
  --error: #b91c1c;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #14b8a6;
    --brand-ink: #042f2e;
    --bg: #0b1211;
    --card: #131c1b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #253331;
    --error: #f87171;
  }
}

* { box-sizing: border-box; }
/* Class rules that set display (grid/flex) would otherwise un-hide [hidden] elements */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--brand); color: var(--brand-ink);
}
.bar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.logo { border-radius: 8px; background: #fff; }

main { max-width: 720px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input {
  width: 100%; padding: 12px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: transparent; color: inherit;
}
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
input[aria-invalid="true"] { border-color: var(--error); }

.hint { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
.error { color: var(--error); font-size: .9rem; margin: 8px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
button, .secondary, .primary {
  font: inherit; cursor: pointer; border-radius: 10px; padding: 11px 16px;
  border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center;
}
.primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; flex: 1; justify-content: center; }
.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.chip { background: var(--brand-ink); color: var(--brand); padding: 6px 12px; font-size: .85rem; font-weight: 600; border-radius: 999px; }
.link { background: none; border: 0; color: var(--brand); padding: 4px; }
button:disabled { opacity: .6; cursor: progress; }

.map-card { padding: 0; overflow: hidden; }
.map-wrap { position: relative; aspect-ratio: 4 / 3; background: var(--border); }
.map-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.offline {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 24px; background: var(--card); color: var(--muted);
}
.map-meta { padding: 12px 16px 16px; }
.map-meta code { font-size: .95rem; }
.map-meta .actions { margin-top: 8px; }

.fix { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  border: 1px solid var(--border); color: var(--text);
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.good { --dot: #16a34a; }
.badge.fair { --dot: #d97706; }
.badge.poor { --dot: #dc2626; }
.badge.good::before, .badge.fair::before, .badge.poor::before { background: var(--dot); }
.badge.info { font-weight: 500; color: var(--muted); }
.badge.info::before { display: none; }

.history-head { display: flex; justify-content: space-between; align-items: center; }
.history-head h2 { font-size: 1rem; margin: 0; }
#history { list-style: none; margin: 8px 0 0; padding: 0; }
#history button {
  width: 100%; text-align: left; background: none; color: inherit;
  border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 10px 2px;
  font-family: ui-monospace, monospace; font-size: .9rem;
}

.credit {
  display: block; width: 100%; max-width: 720px; margin: 0 auto;
  text-align: center; font-size: .8rem; color: var(--muted); padding: 8px 16px 20px;
}
.credit a { color: var(--brand); font-weight: 600; text-decoration: none; }
.credit a:hover { text-decoration: underline; }

@media (max-width: 380px) { .row { grid-template-columns: 1fr; } }
