/* ===========================================================================
   Mittendrin — Material 3 styling
   Light + dark via [data-theme]; responsive: side panel (desktop) / sheet (mobile)
   =========================================================================== */

:root {
  /* Monolog greige ink + one orange accent, on liquid-glass surfaces.
     The map is the background; slabs are translucent (.glass), so all
     inner surfaces are rgba tints rather than solid fills. */
  --primary:        #080807; /* ink: buttons, badges, active states */
  --on-primary:     #e8e8e3;
  --primary-container: rgba(255,255,255,.55);
  --on-primary-container: #080807;

  --secondary:      #524d47;
  --secondary-container: rgba(255,255,255,.50);
  --on-secondary-container: #080807;

  --tertiary:       #FF7F11; /* midpoint marker */
  --tertiary-container: #ffdbc2;
  --accent:         #FF7F11; /* the one color: routes, zone, highlights */

  --surface:        #d1d1c7; /* page fallback behind the map */
  --surface-1:      rgba(255,255,255,.42);
  --surface-2:      rgba(255,255,255,.60);
  --surface-3:      rgba(255,255,255,.78);
  --surface-container: rgba(255,255,255,.58);
  --on-surface:     #080807;
  --on-surface-var: #524d47;
  --outline:        rgba(8,8,7,.38);
  --outline-var:    rgba(8,8,7,.13);

  --error:          #a83214;
  --scrim:          rgba(8,8,7,.4);

  --shadow-1: 0 1px 2px rgba(8,8,7,.07);
  --shadow-2: 0 2px 10px rgba(8,8,7,.09);
  --shadow-3: 0 12px 34px rgba(8,8,7,.16);

  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 6px;

  --panel-w: 420px;
  --bar-h: 84px; /* fits the 5-line ASCII wordmark + tagline */

  --ease: cubic-bezier(.2,0,0,1);
  --ease-emph: cubic-bezier(.2,0,0,1);
}

[data-theme="dark"] {
  --primary:        #e8e8e3; /* inverted ink */
  --on-primary:     #080807;
  --primary-container: rgba(255,255,255,.16);
  --on-primary-container: #e8e8e3;

  --secondary:      #bfbfb1;
  --secondary-container: rgba(255,255,255,.10);
  --on-secondary-container: #e8e8e3;

  --tertiary:       #FF7F11;
  --tertiary-container: #5c2f06;
  --accent:         #FF7F11;

  --surface:        #080807;
  --surface-1:      rgba(255,255,255,.08);
  --surface-2:      rgba(255,255,255,.13);
  --surface-3:      rgba(255,255,255,.20);
  --surface-container: rgba(30,28,26,.62);
  --on-surface:     #e8e8e3;
  --on-surface-var: #b5b0a8;
  --outline:        rgba(255,255,255,.42);
  --outline-var:    rgba(255,255,255,.15);

  --error:          #ff9f7d;
  --scrim:          rgba(0,0,0,.55);

  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 2px 10px rgba(0,0,0,.5);
  --shadow-3: 0 12px 34px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* beat element display:flex etc. */
html, body { height: 100%; margin: 0; }
body {
  font-family: "Space Grotesk", system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--on-surface);
  background: var(--surface);
  letter-spacing: -.01em; /* tight grotesk tracking, monolog-style */
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
h1, h2 { font-family: "Space Grotesk", sans-serif; font-weight: 500; letter-spacing: -.02em; }
button { font-family: inherit; }

/* Liquid-glass layout: the map IS the page; everything else floats on it. */
#app { position: fixed; inset: 0; }

/* ----------------------------- App bar --------------------------------- */
.app-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 22px;
  z-index: 30;
}
.app-bar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-bar__titles { line-height: 1.1; min-width: 0; }
/* ASCII wordmark — a 5-row pixel font, scales fluidly with the viewport */
.ascii-logo {
  margin: 0;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: clamp(2.6px, .78vw, 7px);
  line-height: 1.15;
  letter-spacing: 0;
  white-space: pre;
  color: var(--on-surface);
  user-select: none;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.app-bar__subtitle { font-size: 12.5px; margin: 6px 0 0 2px; color: var(--on-surface-var); }
.app-bar__actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--on-surface-var);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--on-surface); }
.icon-btn:active { background: var(--surface-3); }
.icon-btn--text { font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ----------------------------- Map ------------------------------------- */
.map-wrap { position: fixed; inset: 0; } /* the background layer */
#map { position: absolute; inset: 0; background: var(--surface); }
.maplibregl-ctrl-bottom-right { margin-bottom: 6px; }
.maplibregl-ctrl-attrib { font-size: 10px; border-radius: 8px 0 0 0; }

/* Solving indicator (equal-time calculation) */
.map-calc {
  position: fixed; top: calc(var(--bar-h) + 14px); left: 50%; transform: translateX(-50%);
  z-index: 16;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  font-size: 13px; font-weight: 600; color: var(--on-surface);
  animation: pop .2s var(--ease);
}
.map-calc .search__spinner { width: 16px; height: 16px; border-top-color: var(--accent); }

.marker--pulse { animation: markerpulse 1s ease-in-out infinite; }
@keyframes markerpulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* Map tools (style switcher) */
.map-tools { position: fixed; top: calc(var(--bar-h) + 14px); right: 12px; z-index: 15; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.map-fab {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border: none;
  color: var(--on-surface);
  cursor: pointer;
  transition: color .15s var(--ease), transform .12s var(--ease);
}
.map-fab:hover { color: var(--accent); }
.map-fab:active { transform: scale(.94); }
.style-menu {
  padding: 8px;
  min-width: 176px;
  display: flex; flex-direction: column; gap: 2px;
  animation: pop .16s var(--ease);
}
.style-menu__title {
  margin: 2px 4px 6px; font-size: 13px; font-weight: 500;
  letter-spacing: -.005em; color: var(--on-surface-var);
}
.style-opt {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; cursor: pointer;
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--on-surface);
  text-align: left;
  transition: background .14s var(--ease);
}
.style-opt:hover { background: var(--surface-2); }
.style-opt.is-active { background: var(--primary-container); color: var(--on-primary-container); }
.style-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--outline-var); }

/* Markers */
.marker {
  width: 30px; height: 30px;
  transform: translateY(-4px);
  cursor: pointer;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
.marker--midpoint { width: 40px; height: 40px; }
.marker__pin { width: 100%; height: 100%; color: var(--primary); }
.marker--midpoint .marker__pin { color: var(--tertiary); }
.marker__num {
  position: absolute; top: 5px; left: 0; right: 0;
  text-align: center; font-size: 12px; font-weight: 700;
  color: var(--on-primary);
}

/* --------------------------- Control panel ----------------------------- */
.panel {
  position: fixed;
  left: 0;
  top: var(--bar-h);
  bottom: 0;
  width: var(--panel-w);
  display: flex; flex-direction: column;
  min-height: 0;
  z-index: 20;
}
.panel__grabber { display: none; }
.panel__scroll {
  flex: 1;
  min-height: 0; /* required so the flex child actually scrolls */
  overflow-y: auto;
  padding: 18px 18px 28px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.panel__scroll::-webkit-scrollbar { width: 8px; }
.panel__scroll::-webkit-scrollbar-thumb { background: var(--outline-var); border-radius: 4px; }
.panel__scroll::-webkit-scrollbar-track { background: transparent; }
.panel__heading {
  font-size: 15px; font-weight: 500;
  letter-spacing: -.01em;
  color: var(--on-surface-var);
  margin: 2px 0;
}

/* First-run hint */
.hint {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--primary-container);
  color: var(--on-primary-container);
  padding: 14px 16px;
  border-radius: var(--radius-md);
}
.hint__icon { flex: none; opacity: .9; }
.hint p { margin: 0; font-size: 14px; line-height: 1.4; }

/* Participants list */
.participants { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.participant {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; /* mode picker expands onto its own full-width row */
  background: var(--surface-1);
  border: 1px solid var(--outline-var);
  border-radius: var(--radius-md);
  padding: 10px 8px 10px 12px;
  animation: pop .22s var(--ease);
}
.participant__body { cursor: pointer; }
.participant__modes {
  display: none;
  width: 100%;
  gap: 6px;
  padding: 8px 4px 2px;
  border-top: 1px solid var(--outline-var);
  margin-top: 2px;
}
.participant.is-expanded .participant__modes { display: flex; animation: pop .18s var(--ease); }
.participant__extra { display: none; width: 100%; padding: 6px 4px 2px; }
.participant.is-expanded .participant__extra { display: flex; }
.refine-inline {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px dashed var(--outline); border-radius: 999px;
  background: transparent; color: var(--on-surface-var);
  padding: 7px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.refine-inline:hover { color: var(--primary); background: var(--surface-2); }
.refine-inline.is-active { background: var(--primary-container); color: var(--on-primary-container); border-style: solid; border-color: var(--primary); }
.mode-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--outline-var); border-radius: 999px;
  background: transparent; color: var(--on-surface-var);
  padding: 7px 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.mode-btn:hover { color: var(--on-surface); background: var(--surface-2); }
.mode-btn.is-active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.participant__badge {
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  font-weight: 700; font-size: 14px;
}
.participant__body { min-width: 0; flex: 1; }
.participant__name { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant__sub { font-size: 12px; color: var(--on-surface-var); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant__sub.is-error { color: var(--error); }
.participant__km {
  flex: none;
  font-size: 11.5px; font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  text-align: right;
}
.participant__km:empty { display: none; }
.participant__route, .participant__center, .participant__remove {
  flex: none; border: none; background: transparent; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--on-surface-var);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.participant__center:hover { background: var(--surface-3); color: var(--primary); }
.participant__remove:hover { background: var(--surface-3); color: var(--error); }
.participant__route:hover { background: var(--surface-3); color: var(--accent); }
.participant__route.is-active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

/* Delete confirmation state */
.participant.is-deleting {
  background: color-mix(in srgb, var(--error) 14%, var(--surface-1));
  border-color: var(--error);
}
.btn--danger {
  flex: none; background: var(--error); color: #fff;
  padding: 9px 18px; box-shadow: var(--shadow-1);
}
[data-theme="dark"] .btn--danger { color: #3b0907; }
.btn--nope {
  flex: none; background: transparent; color: var(--error);
  border: 1.5px solid var(--error);
  padding: 8px 16px;
}

/* Search field */
.search { position: relative; }
.search__field {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-1);
  border: 1.5px solid var(--outline-var);
  border-radius: var(--radius-md);
  padding: 0 12px;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.search__field:focus-within { border-color: var(--primary); background: var(--surface-container); }
.search__icon { color: var(--on-surface-var); flex: none; }
.search__field:focus-within .search__icon { color: var(--primary); }
#place-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 15px; color: var(--on-surface);
  padding: 14px 0;
}
#place-input::placeholder { color: var(--on-surface-var); }
.search__spinner {
  width: 18px; height: 18px; flex: none;
  border: 2.5px solid var(--outline-var); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* In-flow (not absolute) so the panel's overflow:auto never clips it. */
.suggestions {
  list-style: none; margin: 8px 0 0; padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--outline-var);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  max-height: 340px; overflow-y: auto;
  animation: pop .16s var(--ease);
}
.suggestion {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14.5px; line-height: 1.3;
}
.suggestion:hover, .suggestion.is-active { background: var(--surface-3); }
.suggestion__icon { color: var(--on-surface-var); flex: none; }
.suggestion__main { font-weight: 500; }
.suggestion__sub { color: var(--on-surface-var); font-size: 12.5px; }
.suggestion--empty { color: var(--on-surface-var); cursor: default; }
.suggestion--empty:hover { background: transparent; }

.search__pinhint { margin: -6px 2px 0; font-size: 12.5px; color: var(--primary); font-weight: 500; }

/* Radius */
.radius { display: flex; flex-direction: column; gap: 12px; }
.radius__head { display: flex; align-items: center; justify-content: space-between; }
.radius__value { display: flex; align-items: baseline; gap: 4px; color: var(--on-surface); font-weight: 600; }
#radius-input {
  width: 56px; text-align: right;
  border: 1.5px solid var(--outline-var); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--on-surface);
  font-size: 15px; font-weight: 700; padding: 6px 8px; outline: none;
}
#radius-input:focus { border-color: var(--primary); }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--outline-var); outline: none; margin: 8px 0; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface-container); box-shadow: var(--shadow-1); cursor: pointer; transition: transform .12s var(--ease); }
.slider::-webkit-slider-thumb:active { transform: scale(1.25); }
.slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface-container); cursor: pointer; }

/* Calculation method (segmented control) */
.method { display: flex; flex-direction: column; gap: 10px; }
.segmented {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-1);
  border: 1px solid var(--outline-var);
  border-radius: 999px;
}
.seg {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: none; cursor: pointer;
  padding: 9px 6px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
  color: var(--on-surface-var); background: transparent;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.seg svg { flex: none; }
.seg:hover { color: var(--on-surface); }
.seg.is-active { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-1); }
.seg svg { opacity: .9; }
.method__desc { margin: 0 2px; font-size: 12.5px; line-height: 1.4; color: var(--on-surface-var); }

/* Result card */
.result-card {
  background: var(--secondary-container); color: var(--on-secondary-container);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  animation: pop .26s var(--ease);
}
.result-card__top { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; border-radius: var(--radius-sm); }
.result-card__top:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.result-card__dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--tertiary); margin-top: 4px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--tertiary) 25%, transparent); }
.result-card__label { margin: 0; font-size: 12.5px; font-weight: 500; letter-spacing: -.005em; opacity: .75; }
.result-card__place { margin: 2px 0 0; font-size: 18px; font-weight: 500; letter-spacing: -.02em; }
.result-card__coords { margin: 0; font-size: 13px; font-family: "Space Mono", ui-monospace, monospace; letter-spacing: -.02em; opacity: .85; }
.result-card__note { margin: 0; font-size: 12.5px; line-height: 1.4; background: color-mix(in srgb, var(--tertiary) 18%, transparent); padding: 8px 10px; border-radius: var(--radius-sm); }
.result-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.result-card__actions .btn { min-width: 120px; }

.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  padding: 11px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  transition: filter .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.btn--filled { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-1); }
.btn--filled:hover { filter: brightness(1.05); box-shadow: var(--shadow-2); }
.btn--tonal { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.btn--tonal:hover { background: color-mix(in srgb, var(--primary) 24%, transparent); }
.btn:active { transform: translateY(1px); }

/* Info overlay */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 20px;
}
.modal__scrim { position: absolute; inset: 0; background: var(--scrim); animation: fadein .2s var(--ease); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal__card {
  position: relative;
  width: 100%; max-width: 430px;
  background: var(--surface-container);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  animation: pop .25s var(--ease);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal__head h2 { margin: 0; font-size: 21px; font-weight: 500; letter-spacing: -.02em; }
.modal__steps {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 12px;
  counter-reset: step;
}
.modal__steps li {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 14.5px; line-height: 1.45;
  counter-increment: step;
}
.modal__steps li::before {
  content: counter(step);
  flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-container); color: var(--on-primary-container);
  font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.modal__note {
  margin: 0; font-size: 13px; line-height: 1.45;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 10px 12px; border-radius: var(--radius-sm);
}
.modal__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px);
  background: #181715; color: #e8e8e3;
  padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: 14px; box-shadow: var(--shadow-3);
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast__action {
  border: none; background: none; cursor: pointer;
  color: var(--accent); font-weight: 600; font-size: 14px;
  padding: 4px 2px 4px 14px;
  letter-spacing: -.005em;
}

/* ----------------------------- Mobile ---------------------------------- */
@media (max-width: 860px) {
  :root { --bar-h: 64px; } /* ASCII logo is small here, no tagline */
  .app-bar__subtitle { display: none; }

  .panel {
    left: 0; right: 0; bottom: 0;
    top: auto;
    width: auto;
    height: auto;
    max-height: 58vh;
    transform: translateY(calc(100% - var(--sheet-peek, 132px)));
    transition: transform .34s var(--ease-emph);
  }
  /* overflow visible so the grab-tab poking above the sheet edge isn't
     clipped by the glass recipe's overflow:hidden */
  .panel.glass { border-radius: var(--radius-xl) var(--radius-xl) 0 0; overflow: visible; }
  .panel.is-open { transform: translateY(0); }
  /* Full-width drag strip: the whole 44px band accepts the pull gesture,
     not just the visible handle. touch-action:none lives HERE (not on the
     panel) so the content below stays touch-scrollable. */
  .panel__grabber {
    display: block; position: relative;
    height: 44px; cursor: grab;
    touch-action: none;
  }
  .panel__grabber:active { cursor: grabbing; }
  /* Round tab, centered, poking out above the sheet edge.
     Not .glass (its ::before is the enlarged hit area), so it gets its own
     frosted treatment. */
  .grab-tab {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
    display: grid; place-items: center;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--surface-container);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255,255,255,.45);
    box-shadow: var(--shadow-2);
    color: var(--on-surface-var);
  }
  .grab-tab svg { transition: transform .25s var(--ease); }
  .panel.is-open .grab-tab svg { transform: rotate(180deg); }
  /* invisible enlarged hit area around the tab */
  .grab-tab::before { content: ""; position: absolute; inset: -16px; border-radius: 50%; }
  .panel__scroll { padding-top: 0; }
  .suggestions { max-height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===========================================================================
   Liquid Glass — 2025–26 translucent UI recipe.
   Applied to the floating slabs (app bar, panel/sheet, style menu, map fab,
   solving pill, info dialog); the map underneath is the background.
   Declared last so its background/radius win over component rules.
   =========================================================================== */
.glass {
  position: relative;
  background: radial-gradient(ellipse 130% 90% at 50% 0%, rgba(255, 255, 255, 0.180) 0%, rgba(255, 255, 255, 0.100) 45%, rgba(255, 255, 255, 0.050) 100%);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-radius: 24px;
  border: none;
  box-shadow: 0 15px 45px -11px rgba(0, 0, 0, 0.283), 0 1px 2px rgba(0, 0, 0, 0.141), inset 0 0 8px rgba(255, 255, 255, 0.098), inset 0 4px 8px -4px rgba(0, 0, 0, 0.060), inset 0 -1px 1px rgba(255, 255, 255, 0.154), inset 0 1px 1px rgba(255, 255, 255, 0.700), inset 0 0 0 1px rgba(255, 255, 255, 0.380);
  overflow: hidden;
  isolation: isolate;
}

/* Specular sheen — radial arc catching the top curve of the slab. */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse 110% 65% at 50% -15%, rgba(255, 255, 255, 0.550) 0%, rgba(255, 255, 255, 0) 70%);
  opacity: 1.00;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
}

/* Inner rim — composes with the outer rim on the same edge for a
   brighter "lensing" line. */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.530), inset 0 1px 0 rgba(255, 255, 255, 0.800), inset 0 -1px 0 rgba(255, 255, 255, 0.175);
  pointer-events: none;
  z-index: 1;
}

.glass > * { position: relative; z-index: 2; }

/* Shape overrides: keep round/pill elements round; the docked bar and
   desktop panel stay square, as in the pre-glass structure. */
.map-fab.glass { border-radius: 50%; }
.map-calc.glass { border-radius: 999px; }
.app-bar.glass { border-radius: 0; }
@media (min-width: 861px) {
  .panel.glass { border-radius: 0; }
}

/* The recipe's position:relative must not undo the slabs' fixed layout
   (bar top, panel left/sheet bottom, solving pill). Pseudo-layers work the
   same on fixed elements. */
.app-bar.glass, .panel.glass, .map-calc.glass { position: fixed; }

/* Dark theme: same glass, but tinted from the dark side so light text
   keeps contrast over bright map areas. */
[data-theme="dark"] .glass {
  background: radial-gradient(ellipse 130% 90% at 50% 0%, rgba(20, 19, 17, 0.520) 0%, rgba(20, 19, 17, 0.600) 45%, rgba(20, 19, 17, 0.660) 100%);
  box-shadow: 0 15px 45px -11px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 0 8px rgba(255, 255, 255, 0.05), inset 0 -1px 1px rgba(255, 255, 255, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
[data-theme="dark"] .glass::before { opacity: .25; }
[data-theme="dark"] .glass::after {
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

/* Graceful fallback for browsers without backdrop-filter. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 255, 255, 0.550); }
  [data-theme="dark"] .glass { background: rgba(24, 23, 21, 0.880); }
}

/* Impressum / Datenschutz links at the bottom of the panel */
.legal-links { display: flex; gap: 16px; justify-content: center; margin-top: auto; padding-top: 6px; font-size: 12.5px; }
.legal-links a, .legal-links button { color: var(--on-surface-var); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.legal-links a:hover, .legal-links button:hover { color: var(--on-surface); text-decoration: underline; }
