:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --accent: #0072b2;
  --accent-text: #ffffff;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius: 10px;
  --topbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1e293b;
    --border: #273449;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #56b4e9;
    --accent-text: #0b1120;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
.home-link { font-size: 0.78rem; text-decoration: none; white-space: nowrap; display: inline-block; margin-bottom: 0.1rem; }
.home-link:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar h1 { font-size: 1.15rem; letter-spacing: -0.01em; }
.tagline { font-size: 0.85rem; color: var(--muted); }

.check { font-size: 0.85rem; color: var(--muted); display: flex; gap: 0.35rem; align-items: center; }
.btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.big { font-size: 0.92rem; padding: 0.6rem 1.05rem; border-radius: 9px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.badge { font-size: 0.7rem; padding: 0.05rem 0.4rem; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.extra { font-size: 0.78rem; margin-top: 0.45rem; }

/* Problem landscape */
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.btn.subtle { border-color: transparent; color: var(--muted); padding-left: 0.3rem; padding-right: 0.3rem; }
.btn.subtle:hover { color: var(--text); }
.pb-group-n { font-size: 0.72rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 0.45rem; }
.pb-foot { font-size: 0.75rem; color: var(--muted); padding: 1rem 1.25rem 1.5rem; border-top: 1px solid var(--border); text-align: center; }
.pb-foot p { max-width: 760px; margin: 0 auto; }
.pb-foot p + p { margin-top: 0.3rem; }

.ls-layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.ls-main { padding: 1.5rem 1.5rem 2rem; min-width: 0; }
.ls-intro h2 { font-size: 1.45rem; line-height: 1.2; letter-spacing: -0.02em; }
.ls-intro p { font-size: 0.9rem; color: var(--muted); margin-top: 0.35rem; max-width: 72ch; }
.ls-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.78rem; color: var(--muted); margin: 0.9rem 0 0.8rem; }
.ls-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.ls-key { display: inline-block; width: 11px; height: 11px; background: var(--muted); }
.ls-key.org { border-radius: 50%; }
.ls-key.fund { border-radius: 3px; }
.ls-key.line { width: 22px; height: 0; border-top: 2px solid var(--muted); border-radius: 0; background: none; }

.ls-map { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.ls-links { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: visible; }
.ls-links path { fill: none; stroke-width: 2; opacity: 0.75; stroke-dasharray: 5 4; }
.ls-zone {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0.85rem; border-radius: 16px;
  background: color-mix(in srgb, var(--z) 9%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--z) 35%, transparent);
}
.ls-zone-title { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: color-mix(in srgb, var(--z) 80%, var(--text)); padding: 0 0.15rem; }
.ls-region { flex: 1; border-radius: 12px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--z) 22%, var(--border)); padding: 0.25rem 0.55rem 0.6rem; transition: box-shadow .15s, border-color .15s, opacity .15s; }
.ls-region-head { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.5rem 0.15rem 0.45rem; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.ls-region-name { font-size: 0.92rem; font-weight: 700; }
.ls-region-head:hover .ls-region-name { color: color-mix(in srgb, var(--z) 75%, var(--text)); }
.ls-region-head:focus-visible { outline: 2px solid var(--z); outline-offset: 2px; border-radius: 6px; }
.ls-region-count { font-size: 0.75rem; font-weight: 700; min-width: 1.6rem; text-align: center; padding: 0.05rem 0.4rem; border-radius: 999px; background: color-mix(in srgb, var(--z) 14%, transparent); color: color-mix(in srgb, var(--z) 75%, var(--text)); font-variant-numeric: tabular-nums; }
.ls-nodes { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ls-node { display: inline-flex; align-items: center; gap: 0.4rem; font: inherit; font-size: 0.8rem; color: var(--text); padding: 0.28rem 0.6rem 0.28rem 0.4rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: opacity .15s, transform .15s, border-color .15s; }
.ls-node.fund { border-radius: 6px; }
.ls-node i { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px var(--surface); }
.ls-node.fund i { border-radius: 3px; }
.ls-node:hover { border-color: var(--z); transform: translateY(-1px); }
.ls-node:focus-visible { outline: 2px solid var(--z); outline-offset: 2px; }
.ls-empty { font-size: 0.78rem; color: var(--muted); font-style: italic; }

.ls-map.has-sel .ls-region:not(.on) { opacity: 0.75; }
.ls-map.has-sel .ls-node:not(.on) { opacity: 0.5; }
.ls-map .ls-region.on { opacity: 1; border-color: var(--z); box-shadow: 0 0 0 2px color-mix(in srgb, var(--z) 45%, transparent); }
.ls-map .ls-node.on { opacity: 1; border-color: color-mix(in srgb, var(--z) 60%, var(--border)); }
.ls-map .ls-region:not(.on) .ls-node.on { opacity: 1; background: var(--surface); }
.ls-node[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.ls-note { font-size: 0.75rem; color: var(--muted); margin-top: 1rem; max-width: 80ch; }


.ls-detail { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 1.5rem 1.25rem 2rem; border-left: 1px solid var(--border); background: var(--surface); align-self: stretch; outline: none; }
.ls-detail h2 { font-size: 1.4rem; line-height: 1.2; letter-spacing: -0.02em; margin-top: 0.2rem; }
.ls-detail h3 { font-size: 0.85rem; margin: 1.3rem 0 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.ls-problem { font-size: 1rem; margin-top: 0.5rem; }
.ls-buys, .ls-desc { font-size: 0.86rem; color: var(--muted); margin-top: 0.6rem; }
.ls-buys strong { color: var(--text); }
.ls-rows { list-style: none; display: grid; gap: 0.25rem; }
.ls-row { text-decoration: none; width: 100%; display: flex; gap: 0.6rem; align-items: flex-start; text-align: left; font: inherit; color: var(--text); padding: 0.5rem 0.55rem; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; }
.ls-row:hover, .ls-row:focus-visible { background: var(--surface-2); border-color: var(--border); outline: none; }
.ls-row i { width: 11px; height: 11px; border-radius: 50%; margin-top: 0.3rem; flex-shrink: 0; }
.ls-row i.fund { border-radius: 3px; }
.ls-row strong { display: block; font-size: 0.86rem; line-height: 1.3; }
.ls-row small { display: block; font-size: 0.78rem; color: var(--muted); line-height: 1.4; margin-top: 0.1rem; }
.ls-funds { margin-top: 1.3rem; padding: 0.2rem 0.6rem 0.6rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.ls-funds h3 { margin-top: 0.7rem; }
.ls-funds > p { font-size: 0.78rem; color: var(--muted); margin: -0.3rem 0 0.4rem; }
.ls-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ls-chip { font-size: 0.78rem; font-weight: 600; text-decoration: none; padding: 0.2rem 0.6rem; border-radius: 999px; color: color-mix(in srgb, var(--z) 80%, var(--text)); background: color-mix(in srgb, var(--z) 12%, transparent); border: 1px solid color-mix(in srgb, var(--z) 35%, transparent); }
.ls-chip:hover { background: color-mix(in srgb, var(--z) 22%, transparent); }
.ls-detail .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1.1rem; }
.ls-back { font-size: 0.82rem; margin-top: 1.2rem; }
.ls-back a { text-decoration: none; }

@media (max-width: 1250px) { .ls-map { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .ls-layout { grid-template-columns: 1fr; }
  .ls-detail { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--border); scroll-margin-top: 0.5rem; }
}
@media (max-width: 640px) {
  .ls-main { padding: 1.1rem 1rem 1.5rem; }
  .ls-map { grid-template-columns: 1fr; }
  .ls-links { display: none; }
  .ls-intro h2 { font-size: 1.25rem; }
  .ls-detail { padding: 1.25rem 1rem 1.75rem; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .tagline { display: none; }
  .topbar { padding: 0 1rem; }
  .topbar h1 { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { .ls-node, .ls-region { transition: none; } }

/* Quiz */
.topbar .quiz-open { flex-shrink: 0; }
.quiz-cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; padding: 0.9rem 1rem; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.quiz-cta strong { display: block; font-size: 0.95rem; }
.quiz-cta span { font-size: 0.86rem; color: var(--muted); }
.quiz { width: min(560px, calc(100% - 32px)); max-height: min(720px, calc(100dvh - 32px)); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,0.25); }
.quiz::backdrop { background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(3px); }
.quiz form { padding: 1.25rem 1.4rem 1.3rem; display: flex; flex-direction: column; gap: 0.8rem; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; }
.quiz-close { font-size: 1.5rem; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0.1rem 0.4rem; border-radius: 6px; }
.quiz-close:hover { color: var(--text); background: var(--surface-2); }
.quiz-progress { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.quiz-progress i { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }
.quiz fieldset { border: 0; min-width: 0; }
.quiz legend { font-size: 1.25rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; padding: 0; }
.quiz-hint { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; min-height: 0.5rem; }
.quiz-options { display: grid; gap: 0.45rem; margin-top: 0.8rem; }
.quiz-opt { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.7rem 0.8rem; border-radius: 9px; border: 1px solid var(--border); cursor: pointer; font-size: 0.92rem; line-height: 1.4; }
.quiz-opt:hover { background: var(--surface-2); }
.quiz-opt input { margin-top: 0.2rem; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.quiz-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.quiz-opt:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.quiz-opt:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.quiz-nav { display: flex; justify-content: space-between; gap: 0.75rem; padding-top: 0.4rem; }
.quiz-nav .btn { font-size: 0.9rem; padding: 0.55rem 1rem; }

/* Quiz results */
.qr-top { margin-top: 0.8rem; }
.qr-picks { list-style: none; display: grid; gap: 0.6rem; }
.qr-pick { display: flex; gap: 0.7rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.qr-rank { flex-shrink: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; background: var(--accent); color: var(--accent-text); }
.qr-pick > div { min-width: 0; }
.qr-name { font: inherit; font-weight: 700; font-size: 0.92rem; text-align: left; color: var(--text); background: none; border: 0; padding: 0; cursor: pointer; line-height: 1.3; }
.qr-name:hover { color: var(--accent); }
.qr-pick p { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }
.qr-pick .qr-why { color: var(--text); font-size: 0.78rem; }
.qr-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.qr-meta:empty { display: none; }
.qr-pick .actions { margin-top: 0.55rem; }
.qr-lead { border-style: solid; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.qr-caveat { font-size: 0.76rem; color: var(--muted); margin-top: 1rem; }
@media (max-width: 760px) { .topbar .quiz-open { font-size: 0.78rem; padding: 0.35rem 0.6rem; } }
.qr-worries { font-size: 0.86rem; margin: 0.3rem 0 0 1.1rem; display: grid; gap: 0.15rem; }
