@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans-var.woff') format('woff');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}
:root {
  --bg: #0b1a20;
  --glass: rgb(12 30 37 / 82%);
  --glass-2: rgb(255 255 255 / 6%);
  --line: rgb(255 255 255 / 11%);
  --ink: #eaf4f3;
  --ink-2: #9db6b8;
  --accent: #5fe3d0;
  --accent-ink: #062a2c;
  --hot: #ff7f6e;
  --ramp: linear-gradient(90deg, #103844, #126c7b 25%, #1fa3a0 45%, #59d4b4 62%, #f3c45a 78%, #ff8a4c 90%, #ff5a5f);
  --r: 12px;
  --font: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); overflow: hidden; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sf-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.sf-map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl-group { background: var(--glass) !important; border: 1px solid var(--line); box-shadow: none !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
.maplibregl-ctrl-attrib.maplibregl-compact { background: rgb(12 30 37 / 85%); color: var(--ink-2); }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }

/* Loading */
.sf-loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: radial-gradient(ellipse at center, #10303a, var(--bg) 70%); z-index: 20; transition: opacity .8s ease, visibility .8s; color: var(--ink-2); letter-spacing: .02em; }
.sf-loading.is-done { opacity: 0; visibility: hidden; }
.sf-loading__ring { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Panel */
.sf-panel {
  position: fixed; z-index: 10; top: 16px; left: 16px; bottom: 16px; width: 360px;
  display: flex; flex-direction: column; padding: 18px 18px 16px;
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px -20px rgb(0 0 0 / 60%);
  overflow: hidden;
  animation: rise .8s .2s both cubic-bezier(.2,.7,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.sf-body { overflow-y: auto; margin: 0 -18px; padding: 0 18px 4px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sf-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sf-logo img { height: 30px; width: auto; display: block; }
.sf-pill { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; text-decoration: none; color: var(--accent); padding: 4px 10px; border: 1px solid rgb(95 227 208 / 35%); border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; }
.sf-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgb(95 227 208 / 60%); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgb(95 227 208 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(95 227 208 / 0%); } }
h1 { font-size: 30px; line-height: 1.05; margin: 0 0 6px; font-stretch: 82%; font-weight: 650; letter-spacing: -.01em; }
.sf-question { margin: 0 0 14px; color: var(--ink-2); }
.sf-h { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 600; margin: 18px 0 10px; }
.sf-h-row { display: flex; justify-content: space-between; align-items: baseline; }
.sf-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.sf-sheet { display: none; }

.sf-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sf-types button {
  display: grid; justify-items: center; gap: 5px; padding: 10px 2px 8px; cursor: pointer;
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--ink-2);
  transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.sf-types button:hover { color: var(--ink); transform: translateY(-1px); }
.sf-types button[aria-pressed="true"] { background: rgb(95 227 208 / 14%); border-color: rgb(95 227 208 / 55%); color: var(--ink); }
.sf-types svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sf-types button[aria-pressed="true"] svg { stroke: var(--accent); }

.sf-range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; margin-bottom: 9px; }
.sf-range label { font-size: 14px; }
.sf-range output { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sf-range input { grid-column: 1 / -1; width: 100%; margin: 4px 0 0; accent-color: var(--accent); height: 18px; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgb(255 255 255 / 14%); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: rgb(255 255 255 / 14%); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 3px solid #0f2a31; box-shadow: 0 0 0 1px var(--accent); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid #0f2a31; }

.sf-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sf-top button { width: 100%; display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 9px 10px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .2s, background .2s; }
.sf-top button:hover { border-color: rgb(95 227 208 / 50%); background: rgb(95 227 208 / 8%); }
.sf-top__n { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #ffb35c, #ff5a5f); color: #2a0c0c; font-weight: 700; font-size: 13px; }
.sf-top__name { font-weight: 600; line-height: 1.25; }
.sf-top__name small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.sf-top__s { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }

.sf-detail { margin-top: 16px; padding: 14px; border-radius: var(--r); background: linear-gradient(160deg, rgb(95 227 208 / 12%), rgb(255 255 255 / 3%)); border: 1px solid rgb(95 227 208 / 30%); animation: rise .35s both; }
.sf-detail__head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sf-detail h2 { margin: 0; font-size: 19px; line-height: 1.2; }
.sf-eyebrow { margin: 0 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.sf-score { text-align: right; line-height: 1; }
.sf-score b { font-size: 30px; font-stretch: 82%; }
.sf-score small { color: var(--ink-2); }
.sf-rank { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: rgb(255 138 76 / 18%); color: #ffb389; }
.sf-bars { list-style: none; padding: 0; margin: 12px 0 10px; display: grid; gap: 6px; }
.sf-bars li { display: grid; grid-template-columns: 112px 1fr 26px; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.sf-bars i { height: 6px; border-radius: 6px; background: rgb(255 255 255 / 10%); overflow: hidden; }
.sf-bars b { display: block; height: 100%; border-radius: 6px; background: var(--ramp); background-size: 300px 100%; transition: width .5s; }
.sf-bars em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.sf-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 8px; }
.sf-facts div { background: rgb(0 0 0 / 18%); border-radius: 8px; padding: 8px 10px; }
.sf-facts dt { font-size: 12px; color: var(--ink-2); }
.sf-facts dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; }
.sf-why { margin: 0; font-size: 13px; color: var(--ink-2); }

.sf-about { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13.5px; color: var(--ink-2); }
.sf-about summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.sf-about p { margin: 8px 0; }
.sf-about strong { color: var(--ink); }
.sf-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-stack span { font-size: 12px; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); }
.sf-cta { display: block; text-align: center; margin: 16px 0 2px; padding: 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; transition: filter .2s, transform .15s; }
.sf-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* Map furniture */
.sf-tools { position: fixed; z-index: 9; top: 16px; right: 60px; display: flex; gap: 8px; }
.sf-tools button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; cursor: pointer; background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.sf-tools button[aria-pressed="false"] { color: var(--ink-2); }
.sf-tools svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.sf-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--hot); }
.sf-tools button[aria-pressed="false"] .sf-dot { border-color: var(--ink-2); }
.sf-legend { position: fixed; z-index: 9; right: 16px; bottom: 40px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--glass); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.sf-legend i { width: 120px; height: 8px; border-radius: 8px; background: var(--ramp); }
.sf-tip { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgb(8 20 25 / 92%); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }

.sf-pin { width: 34px; height: 46px; padding: 0; border: 0; background: none; cursor: pointer; }
.sf-pin__head, .sf-pin__n, .sf-pin__pulse { position: absolute; pointer-events: none; transition: transform .2s ease; transform-origin: 50% 46px; }
.sf-pin__head { left: 0; top: 0; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); transform-origin: 50% 50%; background: linear-gradient(135deg, #ffb35c, #ff5a5f); box-shadow: 0 6px 18px rgb(255 90 95 / 45%), 0 0 0 2px #fff; }
.sf-pin__n { left: 0; top: 0; width: 34px; height: 34px; display: grid; place-items: center; color: #2a0c0c; font-weight: 800; font-size: 14px; }
.sf-pin__pulse { left: 50%; bottom: 0; width: 14px; height: 6px; margin-left: -7px; transform-origin: 50% 50%; border-radius: 50%; background: rgb(255 90 95 / 50%); animation: pulse 2.2s infinite; }
.sf-pin.is-hot .sf-pin__head { transform: rotate(-45deg) scale(1.18); box-shadow: 0 8px 24px rgb(255 90 95 / 70%), 0 0 0 3px #fff; }
.sf-pin.is-hot .sf-pin__n { transform: scale(1.18); }
.sf-pin.is-hot { z-index: 3; }
.sf-top button.is-hot { border-color: rgb(255 138 76 / 70%); background: rgb(255 138 76 / 12%); box-shadow: inset 3px 0 0 #ff8a4c; }

/* Popup */
.sf-popup .maplibregl-popup-content { background: rgb(10 26 32 / 96%); color: var(--ink); border: 1px solid rgb(95 227 208 / 30%); border-radius: 12px; padding: 14px 14px 12px; box-shadow: 0 18px 50px -12px rgb(0 0 0 / 70%); font: 14px/1.4 var(--font); width: 280px; }
.sf-popup .maplibregl-popup-tip { border-top-color: rgb(10 26 32 / 96%) !important; border-bottom-color: rgb(10 26 32 / 96%) !important; }
.sf-popup .maplibregl-popup-close-button { color: var(--ink-2); font-size: 20px; padding: 2px 8px; right: 2px; top: 2px; }
.sf-popup h2 { margin: 0 0 4px; font-size: 17px; line-height: 1.2; padding-right: 18px; }
.sf-popup .sf-score b { font-size: 26px; }
.sf-popup .sf-rank { margin-top: 2px; }
.sf-popup .sf-bars li { grid-template-columns: 104px 1fr 24px; font-size: 12.5px; }
.sf-popup .sf-facts dd { font-size: 16px; }
@keyframes pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(3.2); opacity: 0; } }
.sf-noscript { position: fixed; inset: auto 16px 16px; padding: 12px; background: var(--glass); border-radius: 10px; }

@media (max-width: 760px) {
  .sf-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 34vh; border-radius: 18px 18px 0 0; padding: 14px 16px calc(12px + env(safe-area-inset-bottom)); transition: max-height .35s cubic-bezier(.2,.7,.2,1); }
  .sf-panel.is-open { max-height: 86vh; }
  .sf-brand { margin-bottom: 8px; }
  .sf-logo img { height: 24px; }
  h1 { font-size: 24px; }
  .sf-question { font-size: 14px; margin-bottom: 10px; }
  .sf-sheet { display: block; width: 100%; padding: 10px; margin-bottom: 8px; border-radius: 10px; border: 1px solid rgb(95 227 208 / 40%); background: rgb(95 227 208 / 10%); color: var(--ink); font-weight: 600; cursor: pointer; }
  .sf-body { padding-bottom: 8px; }
  .sf-tools { top: 12px; left: 12px; right: auto; }
  .sf-tools #sf-compbtn span { display: none; }
  .sf-legend { top: 56px; bottom: auto; left: 12px; right: auto; }
  .maplibregl-ctrl-top-right { top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
