/* ==========================================================================
   GET-LOCATIONS.CSS — Mobile-first, production-ready UI
   Notes:
   - Touch-friendly sizes, refined spacing, accessible focus states
   - Safe-area insets, reduced-motion support, light/dark themes
   - Subtle elevation/shadows, improved legibility and contrast
   ========================================================================== */

/* --------- CSS Reset (enhanced) --------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light dark;
  scroll-behavior: smooth;
}

html, body { margin: 0; padding: 0; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: #0f172a; /* fallback */
  background: linear-gradient(180deg, var(--bg), color-mix(in oklab, var(--bg), #000 8%));
  color: var(--text);
}

img, svg { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
input, button, select, textarea { color: inherit; background: transparent; }
a { color: inherit; text-decoration-thickness: .08em; text-underline-offset: 2px; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--brand), #fff 10%);
  outline-offset: 2px;
}
::selection {
  background: color-mix(in oklab, var(--brand), transparent 70%);
}

/* Remove tap highlight and improve tap latency on mobile */
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* --------- Theme --------- */
:root {
  /* Colors */
  --bg: #0f172a;          /* slate-900 */
  --panel: #111827;       /* gray-900 */
  --card: #0b1224;
  --text: #e5e7eb;        /* gray-200 */
  --muted: #9ca3af;       /* gray-400 */
  --brand: #60a5fa;       /* blue-400 */
  --brand-2: #8b5cf6;     /* violet-500 */
  --accent: #22c55e;      /* green-500 */
  --warning: #f59e0b;     /* amber-500 */
  --danger: #ef4444;      /* red-500 */
  --border: #1f2937;      /* gray-800 */
  --chip: #111827;

  /* Elevation */
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-press: 0 6px 18px rgba(0,0,0,.35);

  /* Radius & spacing scale */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 16px;
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 10px;
  --space-5: 12px;
  --space-6: 14px;
  --space-7: 16px;
  --space-8: 18px;
  --space-9: 20px;
  --space-10: 24px;

  /* Safe areas (for notches) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  /* Typography */
  --leading: 1.6;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --panel: #ffffff;
    --card: #f8fafc;
    --text: #0f172a;
    --muted: #475569;
    --brand: #2563eb;
    --brand-2: #7c3aed;
    --accent: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --border: #e5e7eb;
    --chip: #f1f5f9;
    --shadow: 0 10px 24px rgba(2,6,23,.08);
    --shadow-press: 0 6px 16px rgba(2,6,23,.12);
  }
}

/* Fallbacks when color-mix is unsupported */
@supports not (color: color-mix(in oklab, black, white)) {
  .btn { background: var(--brand); }
  .feature-icon, .tool-icon { background: rgba(96,165,250,.15); border-color: rgba(96,165,250,.35); }
}

/* --------- Containers & Layout --------- */
.container {
  max-width: 1200px;
  padding-inline: clamp(16px, 4vw, 24px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
  background: rgba(17,24,39,.75); /* fallback */
  background: color-mix(in oklab, var(--panel), transparent 15%);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-6) 0;
}

.brand { display: flex; align-items: center; gap: var(--space-5); }
.brand-mark { font-size: 28px; filter: saturate(1.1); }
.brand-text h1 { margin: 0; font-size: clamp(20px, 5vw, 26px); letter-spacing: .2px; line-height: 1.2; }
.brand-text .sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.top-actions { display: flex; gap: var(--space-3); }

/* Progress bar */
.progress-wrap { height: 4px; background: linear-gradient(90deg, transparent, transparent); }
.progress { height: 4px; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); box-shadow: var(--shadow); border-radius: 999px; }

/* Main layout — mobile-first (single column) */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 3.2vw, 28px);
  padding: 16px 0 72px;
}

@media (min-width: 980px) {
  .layout {
    grid-template-columns: 280px 1fr;
    padding: 24px 0 80px;
  }
}

/* --------- Sidebar --------- */
.sidebar {
  position: static;
  align-self: start;
  display: grid;
  gap: var(--space-6);
  height: max-content;
  order: 2;
}

@media (min-width: 980px) {
  .sidebar {
    position: sticky;
    top: calc(64px + var(--safe-top));
    order: unset;
  }
}

.sidebar-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-6);
  box-shadow: var(--shadow);
}

.sidebar-title {
  font-weight: 700;
  margin-bottom: var(--space-4);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .3px;
  text-transform: uppercase;
}

#toc a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  font-size: 15px;
  line-height: 1.4;
}
#toc a:hover { background: color-mix(in oklab, var(--brand), transparent 90%); border-color: color-mix(in oklab, var(--brand), transparent 75%); }
#toc a:focus-visible { border-color: color-mix(in oklab, var(--brand), transparent 55%); }
#toc .toc-h3 { padding-left: 18px; font-size: 14px; color: var(--muted); }

/* Make anchors land with breathing room below sticky header */
[id] { scroll-margin-top: calc(88px + var(--safe-top)); }

.util-card .btn { margin-top: var(--space-4); }

/* --------- Content --------- */
.content .guide {
  display: grid;
  gap: clamp(16px, 3vw, 24px);
}

h2 { font-size: clamp(22px, 5.6vw, 28px); margin: 0 0 8px; line-height: 1.25; }
h3 { font-size: clamp(18px, 4.8vw, 22px); margin: 8px 0; line-height: 1.3; }
h4 { font-size: 16px; margin: 6px 0 8px; color: var(--muted); }

p { margin: 8px 0; }

.divider {
  border: 0;
  border-top: 1px dashed var(--border);
  margin: 16px 0;
}

/* --------- Cards & Callouts --------- */
.card, .callout {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(14px, 3.4vw, 16px);
  box-shadow: var(--shadow);
}

.callout.success { border-left: 4px solid var(--accent); }
.callout.highlight { border-left: 4px solid var(--brand); }

.card-inline {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}
@media (min-width: 700px) { .card-inline { grid-template-columns: repeat(2, 1fr); } }

/* --------- Lists --------- */
.check-list li { margin: 8px 0; }
.icon-list { list-style: none; padding-left: 0; }
.icon-list li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; margin: 8px 0; align-items: start; }
.icon { opacity: .9; }

.todo { list-style: none; padding-left: 0; display: grid; gap: 8px; }
.todo label { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: center; }

/* --------- Keyword chips --------- */
.keyword-block { margin: 12px 0 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip {
  background: var(--chip);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}
.copy-btn { margin-top: 8px; }

/* --------- Scorer --------- */
.scorer .score-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) { .scorer .score-grid { grid-template-columns: repeat(2, 1fr); } }

.scorer label {
  display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 10px;
}
.badge {
  background: rgba(96,165,250,.15); /* fallback */
  background: color-mix(in oklab, var(--brand), transparent 85%);
  border: 1px solid color-mix(in oklab, var(--brand), transparent 70%);
  padding: 2px 8px; border-radius: 999px; font-size: 12px; justify-self: end;
}
.score-total { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin-top: 8px; }
.meter { height: 10px; background: #0b0b12; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.meter #scoreBar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.score-out { font-weight: 700; }

.score-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.score-actions input {
  flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); min-height: 44px;
}

/* --------- Estimator --------- */
.estimator .est-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 680px) { .estimator .est-grid { grid-template-columns: repeat(3, 1fr); } }

.estimator input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); min-height: 44px;
}
.est-out { display: grid; justify-items: center; align-items: center; padding-top: 10px; }
.est-out .big { font-size: clamp(28px, 7vw, 44px); font-weight: 800; letter-spacing: .5px; }

/* --------- Timer / Notes --------- */
.timer { display: grid; gap: 10px; justify-items: center; }
#timerDisplay { font-size: 32px; font-weight: 800; letter-spacing: 1px; }
.note-area {
  width: 100%; min-height: 100px; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--text);
}

/* --------- Tiers --------- */
.tiers { display: grid; gap: 16px; }
.tier { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 16px; }
.tier h3 { margin-top: 0; }
.tier-alt { border-left: 4px solid var(--warning); }

/* --------- Utility / Buttons --------- */
.btn {
  background: var(--brand); /* fallback */
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand), #fff 5%), var(--brand));
  color: #fff;
  border: 1px solid color-mix(in oklab, var(--brand), #000 30%);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow: var(--shadow);
  min-height: 44px;       /* touch target */
  line-height: 1.2;
  font-weight: 600;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-press); }
.btn:focus-visible { outline: 2px solid color-mix(in oklab, var(--brand), #fff 14%); outline-offset: 2px; }

.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: color-mix(in oklab, var(--brand), transparent 92%); }

.btn-small { padding: 8px 10px; font-size: 14px; min-height: 36px; }
.btn-block { width: 100%; }

.scroll-box {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--card);
  overflow: auto;
  max-height: 60vh;
}

.note {
  background: rgba(34,197,94,.10); /* fallback */
  background: color-mix(in oklab, var(--accent), transparent 90%);
  border: 1px solid color-mix(in oklab, var(--accent), transparent 70%);
  border-radius: 12px; padding: 12px;
}

.muted { color: var(--muted); font-size: 13px; }

/* --------- Floating Action Button --------- */
.fab {
  position: fixed;
  right: calc(18px + var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  height: 48px;
  width: 48px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid; place-items: center;
}

/* --------- Footer --------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 calc(24px + var(--safe-bottom));
  background: color-mix(in oklab, var(--panel), transparent 10%);
}

/* --------- Accessibility --------- */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus-visible {
  position: fixed; left: 16px; top: calc(8px + var(--safe-top));
  width: auto; height: auto; padding: 8px 12px; background: var(--brand); color: #fff; border-radius: 8px; z-index: 60;
}

/* Visually hidden (screen-reader only) */
.sr-only {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Improve default form controls */
input[type="text"], input[type="number"], input[type="email"], input[type="search"], textarea {
  appearance: none;
  border-radius: 10px;
}
input, textarea { accent-color: var(--brand); }

/* --------- Print --------- */
@media print {
  .site-header, .sidebar, .fab, .site-footer { display: none !important; }
  .divider { border-top: 1px solid #ddd; }
  body { background: #fff; color: #000; }
  .content { padding-top: 0; }
  .card, .callout, .checklist-hud, .ck { box-shadow: none !important; }
}

/* --------- Reduced motion --------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn:active { transform: none; }
}

/* --------- High contrast / forced colors --------- */
@media (forced-colors: active) {
  .btn, .btn-ghost, .card, .callout, .sidebar-card, .ck { border: 1px solid CanvasText; }
  .btn { background: ButtonFace; color: ButtonText; }
  .btn:focus-visible { outline: 2px solid Highlight; }
}

/* ===== Pre-qualify feature grid (Maps) ===== */
.feature-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.feature {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.feature::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  opacity: .9;
}
.feature:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--brand), transparent 55%);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}

.feature-icon {
  height: 40px; width: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(96,165,250,.15); /* fallback */
  background: color-mix(in oklab, var(--brand), transparent 85%);
  border: 1px solid color-mix(in oklab, var(--brand), transparent 50%);
  font-size: 20px; line-height: 1; filter: saturate(1.05);
}

.feature-body h4 {
  margin: 0; font-size: 16px; letter-spacing: .2px;
}
.feature-body .sub {
  margin: 2px 0 8px; color: var(--muted); font-size: 14px;
}

.feature-bullets {
  list-style: none;
  margin: 6px 0 8px;
  padding-left: 0;
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.feature-bullets .tick { font-weight: 700; opacity: .9; margin-right: 6px; }

.badges {
  list-style: none; padding-left: 0; margin: 4px 0 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.badge-pill {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.feature-more {
  margin-top: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.feature-more > summary {
  cursor: pointer; user-select: none; font-size: 13px; color: var(--brand); outline: none;
}
.feature-more > summary::marker { content: ""; }
.feature-more[open] > summary { color: var(--brand-2); }
.mini-steps {
  margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px;
}

@media (max-width: 520px) {
  .feature { grid-template-columns: 36px 1fr; }
  .feature-icon { height: 36px; width: 36px; font-size: 18px; border-radius: 10px; }
}

/* Motion preference */
@media (prefers-reduced-motion: reduce) {
  .feature { transition: none; }
  .feature:hover { transform: none; }
}

/* ===== Field Checklist (polished, upgraded) ===== */
.checklist-hud {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  box-shadow: var(--shadow);
}
@media (min-width: 560px) {
  .checklist-hud { grid-template-columns: 1fr auto; }
}

.kpis { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.kpi { font-size: 14px; color: var(--muted); }
.kpi strong { color: var(--text); font-size: 16px; }

.meter.small { height: 8px; margin-top: 6px; }
.meter.small #checkBar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--accent)); }

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

.checklist-wrap { display: grid; gap: 10px; }

.todo-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.todo-item { margin: 0; }

.ck {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.ck:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--brand), transparent 55%);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}
.ck:has(input:checked) {
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand), transparent 92%), var(--panel));
  border-color: color-mix(in oklab, var(--brand), transparent 45%);
}

.ck input[type="checkbox"] {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
}

.ck-box {
  height: 28px; width: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.ck-check { width: 18px; height: 18px; opacity: 0; transform: scale(.9); transition: transform .15s ease, opacity .15s ease; }

.ck input:checked + .ck-box {
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand), #fff 6%), var(--brand));
  color: #fff;
  border-color: color-mix(in oklab, var(--brand), #000 30%);
}
.ck input:checked + .ck-box .ck-check { opacity: 1; transform: scale(1); }

.ck-text {
  display: grid; gap: 4px; align-content: center; line-height: 1.4;
}
.ck-text strong { font-weight: 700; }
.ck-text .hint { color: var(--muted); font-size: 13px; }
.ck:has(input:checked) .ck-text { color: color-mix(in oklab, var(--text), #fff 8%); }
.ck:has(input:checked) .ck-text .hint { color: color-mix(in oklab, var(--muted), #fff 8%); }

/* small pill tags */
.pill {
  display: inline-block; margin-top: 2px; padding: 2px 8px; border-radius: 999px; font-size: 12px; line-height: 1;
  color: var(--muted); background: var(--chip); border: 1px solid var(--border); white-space: nowrap;
}

/* focus visibility for keyboard users */
.ck:focus-within {
  outline: 2px solid color-mix(in oklab, var(--brand), #fff 10%);
  outline-offset: 2px;
}

/* compact on small screens */
@media (max-width: 520px) {
  .ck { grid-template-columns: 34px 1fr; padding: 10px; }
  .ck-box { height: 24px; width: 24px; border-radius: 7px; }
}

/* motion preference */
@media (prefers-reduced-motion: reduce) {
  .ck, .ck-box, .ck-check { transition: none; }
  .ck:hover { transform: none; }
}

/* ===== Tools & Habits grid ===== */
.tools-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.tool-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.tool-card::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  opacity: .9;
}
.tool-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in oklab, var(--brand), transparent 55%);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}

.tool-icon {
  height: 40px; width: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(96,165,250,.15); /* fallback */
  background: color-mix(in oklab, var(--brand), transparent 85%);
  border: 1px solid color-mix(in oklab, var(--brand), transparent 50%);
  font-size: 20px; line-height: 1;
}

.tool-body h4 {
  margin: 0; font-size: 16px; letter-spacing: .2px;
}
.tool-body .sub { margin: 2px 0 8px; color: var(--muted); font-size: 14px; }

.tool-bullets {
  list-style: none;
  padding-left: 0;
  margin: 6px 0 8px;
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.tool-bullets .tick { font-weight: 700; opacity: .9; margin-right: 6px; }

.tool-quick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tool-quick .muted { font-size: 12px; }

.legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }
.legend-chip {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--muted);
}
.legend-chip.t1 { background: color-mix(in oklab, var(--accent), transparent 85%); color: var(--text); }
.legend-chip.t2 { background: color-mix(in oklab, var(--brand), transparent 85%); color: var(--text); }
.legend-chip.t3 { background: color-mix(in oklab, var(--brand-2), transparent 88%); color: var(--text); }
.legend-chip.t4 { background: color-mix(in oklab, var(--warning), transparent 88%); color: var(--text); }
.legend-chip.hold { background: color-mix(in oklab, var(--muted), transparent 75%); color: var(--text); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--chip); border: 1px solid var(--border); color: var(--muted);
}

@media (max-width: 520px) {
  .tool-card { grid-template-columns: 36px 1fr; }
  .tool-icon { height: 36px; width: 36px; font-size: 18px; border-radius: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-card { transition: none; }
  .tool-card:hover { transform: none; }
}

/* --------- Mobile polish (coarse pointers) --------- */
@media (pointer: coarse) {
  #toc a { padding: 10px 12px; }
  .btn { filter: none; } /* reduce hover dependency */
}

/* --------- Subtle performance boosters --------- */
.card, .callout, .feature, .tool-card, .sidebar-card, .ck, .checklist-hud {
  content-visibility: auto; contain-intrinsic-size: 300px 200px;
}

/* --------- Scrollbar (WebKit only) --------- */
@media (hover: hover) {
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-thumb { background: color-mix(in oklab, var(--brand), transparent 75%); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
  *::-webkit-scrollbar-track { background: transparent; }
}


/* === Edge Gutters & Safe-Area Padding (append) =========================== */
:root {
  /* Global page padding for small screens */
  --page-pad: clamp(8px, 5vw, 8px);
}

@media (max-width: 1024px) {
  /* 1) Global gutters + notch-safe padding */
  body {
    padding-left:  max(var(--page-pad), env(safe-area-inset-left));
    padding-right: max(var(--page-pad), env(safe-area-inset-right));
    padding-bottom: max(24px,        env(safe-area-inset-bottom));
  }

  /* 2) Avoid double padding when body now provides gutters */
  .container { padding-inline: 0; }

  /* 3) Full-bleed sections: keep backgrounds edge-to-edge,
        but add matching internal padding so content never hugs the edges */
  .site-header,
  .site-footer,
  .progress-wrap {
    margin-left:  calc(-1 * max(var(--page-pad), env(safe-area-inset-left)));
    margin-right: calc(-1 * max(var(--page-pad), env(safe-area-inset-right)));
    padding-left:  max(var(--page-pad), env(safe-area-inset-left));
    padding-right: max(var(--page-pad), env(safe-area-inset-right));
  }

  /* 4) Extra safety for common top-level blocks that may appear outside .container */
  .layout,
  .content,
  .content .guide,
  .feature-grid,
  .tools-grid,
  .todo-grid,
  .checklist-wrap {
    padding-inline: var(--page-pad);
  }

  /* 5) Panels/cards already have padding; ensure nice rounding when near edges */
  .card,
  .callout,
  .sidebar-card,
  .tier,
  .checklist-hud,
  .ck,
  .feature,
  .tool-card {
    border-radius: 16px;
  }

  /* 6) Keep floating button off the glass */
  .fab {
    right:  calc(18px + var(--page-pad));
    bottom: calc(18px + var(--page-pad));
  }

  /* 7) Optional utility: make any section full-bleed but with aligned inner padding */
  .bleed {
    margin-left:  calc(-1 * max(var(--page-pad), env(safe-area-inset-left)));
    margin-right: calc(-1 * max(var(--page-pad), env(safe-area-inset-right)));
  }
  .bleed > * {
    padding-left:  max(var(--page-pad), env(safe-area-inset-left));
    padding-right: max(var(--page-pad), env(safe-area-inset-right));
  }
}
