/* ==========================================================================
   Touchstone Atlas — Consolidated Editorial Stylesheet (v4.0)
   Display: Cormorant Garamond | Body & UI: Source Sans 3
   ========================================================================== */

:root {
  --bg: #F4EEE1;
  --surface: #F9F5EB;
  --surface-2: #ECE4D4;
  --ink: #1F1A14;
  --muted: #5A4F43;
  --line: #CBBFA9;
  --rule: #1F1A14;
  --accent: #7A2E22;
  --accent-hover: #5E2219;
  --accent-ink: #5E2219;
  --accent-soft: #EADCC8;
  --fig: #2F4A5E;
  --fiction: #5E3A62;
  --hist: #7A4A1E;
  --display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 2px 10px rgba(28, 24, 20, 0.05);
  --shadow-lg: 0 12px 32px rgba(28, 24, 20, 0.16);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #17130F;
  --surface: #1F1A15;
  --surface-2: #2A231C;
  --ink: #ECE3D2;
  --muted: #A99C87;
  --line: #3D342A;
  --rule: #8C7F6B;
  --accent: #D08A6E;
  --accent-hover: #E6AE95;
  --accent-ink: #E6AE95;
  --accent-soft: #3A2620;
  --fig: #9DB8CC;
  --fiction: #C8A3CB;
  --hist: #D9AE7E;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130F;
    --surface: #1F1A15;
    --surface-2: #2A231C;
    --ink: #ECE3D2;
    --muted: #A99C87;
    --line: #3D342A;
    --rule: #8C7F6B;
    --accent: #D08A6E;
    --accent-hover: #E6AE95;
    --accent-ink: #E6AE95;
    --accent-soft: #3A2620;
    --fig: #9DB8CC;
    --fiction: #C8A3CB;
    --hist: #D9AE7E;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

/* ---------- Base & Typography ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.12;
  text-wrap: balance;
  margin: 0;
  color: var(--ink);
}
h1 { font-size: clamp(36px, 5vw, 50px); letter-spacing: -0.01em; }
h2 { font-size: clamp(26px, 3.2vw, 32px); }
h3 { font-size: 22px; }

p { margin: 0; max-width: 65ch; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.lead {
  font-family: var(--display);
  font-size: clamp(22px, 2.8vw, 27px);
  line-height: 1.32;
  color: var(--ink);
  font-weight: 500;
}
.note, .mut { font-size: 15px; color: var(--muted); }

/* ---------- Top Navigation Bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-brand {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.topbar-brand svg { flex-shrink: 0; }
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-nav::-webkit-scrollbar { display: none; }
.topbar-nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.topbar-nav a:hover { color: var(--ink); background: var(--surface-2); }
.topbar-nav a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-weight: 600;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#themebtn {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s;
}
#themebtn:hover { border-color: var(--accent); }

/* ---------- Layout & Desktop Left Rail ---------- */
.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 24px 72px;
  display: grid;
  gap: 32px;
}

header, section, .view { display: grid; gap: 16px; }
.view { gap: 36px; }

header {
  gap: 6px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
body.home header { display: none; }

/* Mobile module strip */
.modnav {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  margin-top: 8px;
  padding-bottom: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.modnav::-webkit-scrollbar { display: none; }
.modnav a {
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
  white-space: nowrap;
  flex: none;
}
.modnav a[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  font-weight: 600;
}
.modnav .nl { display: none; }

/* Left Sidebar Rail (Desktop) */
#side { display: none; }

@media (min-width: 1120px) {
  body:not(.home) { padding-left: 290px; }
  body:not(.home) .topbar { padding-left: 314px; }
  body:not(.home) #modnav { display: none !important; }
  body:not(.home) #side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 290px;
    z-index: 45;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--surface);
    padding: 20px 0 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  #side .rail-head {
    display: block;
    padding: 4px 24px 16px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
  }
  #side .rail-head b {
    display: block;
    font-family: var(--display);
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.05;
  }
  #side .rail-head span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
  }
  #side .rail-cats {
    display: grid;
    gap: 4px;
    padding: 0 12px;
  }
  #side .rail-cat summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-sm);
    font-style: normal;
  }
  #side .rail-cat summary::-webkit-details-marker { display: none; }
  #side .rail-cat summary:hover { background: var(--surface-2); color: var(--ink); }
  #side .rail-cat summary::after { content: "+"; font-size: 15px; color: var(--muted); }
  #side .rail-cat[open] summary::after { content: "−"; }
  #side .rail-mods { display: grid; gap: 2px; padding: 2px 0 8px; }
  #side .rail-mods a {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 1px 8px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    text-decoration: none;
    color: var(--ink);
    transition: background 0.15s;
  }
  #side .rail-mods a:hover { background: var(--bg); }
  #side .rail-mods a[aria-current="page"] {
    border-left-color: var(--accent);
    background: var(--bg);
  }
  #side .rail-mods i {
    grid-row: span 2;
    font-family: var(--display);
    font-style: normal;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.05;
    color: var(--muted);
  }
  #side .rail-mods a[aria-current="page"] i { color: var(--accent); }
  #side .rail-mods strong {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
  }
  #side .rail-mods em {
    font-style: normal;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.3;
  }
  #side .rail-mods em.t { color: var(--accent-ink); font-weight: 600; }
  #side .rail-mods .pb {
    grid-column: 2;
    height: 3px;
    background: var(--line);
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
  }
  #side .rail-mods .pb i {
    display: block;
    height: 100%;
    background: var(--accent);
  }
  #side .rail-foot {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding: 16px 24px 0;
    display: grid;
    gap: 6px;
  }
  #side .rail-foot a {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
  }
  #side .rail-foot a:hover, #side .rail-foot a[aria-current="page"] { color: var(--accent); }
  #side .rail-foot p { font-size: 13px; color: var(--muted); margin-top: 6px; }
}

/* ---------- Cards, Buttons & Inputs ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  display: grid;
  gap: 20px;
  min-width: 0;
  box-shadow: var(--shadow);
}

.btn {
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #FCF9F2;
}
:root[data-theme="dark"] .btn.primary { color: #17130F; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { color: #17130F; }
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #FCF9F2; }
:root[data-theme="dark"] .btn.primary:hover { color: #17130F; }
.btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

.link, .linkbtn {
  font-family: var(--body);
  font-size: 15px;
  border: none;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px;
}
.link:hover, .linkbtn:hover { color: var(--accent-ink); }
.linkbtn { color: var(--accent-ink); padding: 0; }

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type=text], input[type=search], select {
  font-family: var(--body);
  font-size: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  max-width: 400px;
}
input[type=text]:focus, input[type=search]:focus, select:focus {
  border-color: var(--accent);
}
.field { display: grid; gap: 6px; }
.field label, .field > span:first-child { font-weight: 600; font-size: 16px; }
.row { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
[data-armed] { color: var(--accent) !important; font-weight: 700; }

/* ---------- Landing Page (Home) ---------- */
#view-home { gap: 48px; }

.home-hero {
  display: grid;
  gap: 20px;
  padding: 12px 0 8px;
}
.home-hero h1 {
  font-size: clamp(40px, 6vw, 58px);
  color: var(--ink);
  line-height: 1.04;
}
.home-hero h1 span { color: var(--accent); }
.home-intro {
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 60ch;
}
.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

/* Featured Start-Here Spotlight */
.spotlight {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 26px 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 28px;
  align-items: center;
  box-shadow: var(--shadow);
}
.spotlight-body { display: grid; gap: 8px; }
.spotlight-badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.spotlight h2 { font-size: 32px; }
.spotlight p { color: var(--muted); font-size: 17px; }
.spotlight-meta { font-size: 14px; color: var(--muted); font-weight: 500; }

/* How it works strip */
.hm-how {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  counter-reset: hm;
}
.hm-how li {
  counter-increment: hm;
  border-top: 2px solid var(--line);
  padding-top: 14px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}
.hm-how li::before {
  content: "0" counter(hm);
  display: block;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}
.hm-how b { color: var(--ink); font-weight: 600; }

/* Topic Hub Filter Tabs */
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-tabs button {
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.cat-tabs button:hover { border-color: var(--accent); color: var(--ink); }
.cat-tabs button[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.cat-tabs button small { opacity: 0.7; font-weight: 500; margin-left: 4px; }

/* Module Cards Grid */
.hm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.hm-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 6px 14px;
  align-content: start;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.hm-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.hm-n {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  line-height: 0.95;
  color: var(--accent);
}
.hm-b { display: grid; gap: 4px; }
.hm-b strong {
  font-family: var(--display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}
.hm-cat-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.hm-q { font-size: 16px; line-height: 1.5; color: var(--muted); margin-top: 4px; }
.hm-foot {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.hm-st { color: var(--muted); font-weight: 500; }
.hm-st.done { color: var(--accent-ink); font-weight: 700; }
.hm-go { font-weight: 600; color: var(--accent); white-space: nowrap; }

/* Ecosystem Strip (Kylix Podcast, Reading List, Friends & Family) */
.eco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.eco-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.eco-card .eyebrow { color: var(--accent-ink); }
.eco-card h3 { font-size: 24px; }
.eco-card p { font-size: 15px; color: var(--muted); line-height: 1.55; }
.eco-card a { font-weight: 600; font-size: 15px; margin-top: 4px; justify-self: start; }

/* ---------- Quiz View ---------- */
.intro { display: grid; gap: 14px; }
.intro .scope {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.intro .scope::before {
  content: "Before you start";
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 4px;
}
.fitline { display: block; margin-top: 8px; color: var(--ink); }
.fitlink { color: var(--accent-ink); font-weight: 600; white-space: nowrap; }

.progress {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.bar { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s ease; }

.qgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "a b" "s s";
  gap: 14px;
}
.stmt {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--bg);
  display: grid;
  gap: 8px;
  align-content: start;
}
.stmt b {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--accent-ink);
  font-weight: 700;
}
.stmt span { font-size: 18px; line-height: 1.5; color: var(--ink); }
#sa { grid-area: a; }
#sb { grid-area: b; }

.scale {
  grid-area: s;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.scale button {
  font-family: var(--body);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 8px;
  min-height: 54px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: all 0.12s;
}
.scale button:hover { border-color: var(--accent); background: var(--accent-soft); }
.scale button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #FCF9F2;
  font-weight: 600;
}
:root[data-theme="dark"] .scale button[aria-pressed="true"] { color: #17130F; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .scale button[aria-pressed="true"] { color: #17130F; }
}
.scale button small { font-size: inherit; }

.nofit-row { text-align: center; margin-top: -6px; }
#nofit.on, #flagq.on { color: var(--accent-ink); text-decoration: none; font-weight: 600; }
#flagq { font-size: 14px; padding: 0 4px; }

#flagbox {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 16px;
  display: grid;
  gap: 12px;
}
#flagbox .fb-h { font-size: 15px; color: var(--muted); }
.fb-reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-reasons button {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.fb-reasons button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #FCF9F2;
}
.fb-act { display: flex; justify-content: flex-end; gap: 12px; align-items: center; }

.qnav { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* Axes intro cards */
.axes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.axis {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  gap: 6px;
  align-content: start;
}
.axis .poles { font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.axis p { font-size: 15px; color: var(--muted); }

/* ---------- Results View ---------- */
.hero { gap: 18px; }
.hero h1 { font-size: clamp(38px, 5vw, 54px); color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 14px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tag .ast {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #FCF9F2;
  cursor: pointer;
}
:root[data-theme="dark"] .tag .ast { color: #17130F; }
.ast {
  border: 0;
  background: none;
  padding: 0 0 0 4px;
  font: inherit;
  font-weight: 700;
  color: var(--accent-ink);
  cursor: pointer;
}
.conf { font-size: 14px; color: var(--accent-ink); font-weight: 600; }

.scores { display: grid; gap: 22px; margin-top: 4px; }
.score { display: grid; gap: 6px; }
.score .head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}
.score .head strong { font-family: var(--display); font-size: 22px; font-weight: 600; }
.score .head span { font-size: 15px; color: var(--accent-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.score p { font-size: 16px; color: var(--muted); }
.ends { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; }

.track {
  position: relative;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 6px 0;
}
.track::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  bottom: -5px;
  width: 2px;
  background: var(--muted);
}
.track i {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--accent);
  border: 2px solid var(--surface);
  transform: rotate(45deg);
}

/* Conflicted splits */
.splits { display: grid; gap: 16px; }
.split {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 22px;
  display: grid;
  gap: 14px;
}
.split-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; align-items: baseline; }
.split-h strong { font-family: var(--display); font-size: 24px; }
.split-h span { font-size: 14px; color: var(--muted); font-weight: 500; }
.split-bar { display: flex; height: 8px; gap: 3px; border-radius: 4px; overflow: hidden; }
.split-bar i { background: var(--accent); display: block; }
.split-bar b { background: var(--ink); opacity: 0.45; display: block; }
.split-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.split-cols .side { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 8px; }
.split-cols div:last-child .side { color: var(--ink); }
.split-cols ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.split-cols li { font-size: 15px; line-height: 1.45; }
.split-cols li small { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* Company & Term Cards */
.company { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cgroup {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.cgroup h3 { font-family: var(--body); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cgroup .row1 strong { display: block; font-family: var(--display); font-size: 24px; font-weight: 600; margin: 2px 0; }
.cgroup .row1 span, .cgroup .row2 span { font-size: 14px; color: var(--muted); }
.cgroup .row2 { border-top: 1px solid var(--line); padding-top: 12px; }
.cgroup .row2 strong { display: block; font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--accent-ink); margin: 2px 0; }

.cardlist { display: grid; gap: 14px; }
.term {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: grid;
  gap: 10px;
}
.term h3 { font-size: 28px; color: var(--ink); }
.term dl { margin: 0; display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 16px; }
.term dt { color: var(--muted); font-size: 14px; font-weight: 600; padding-top: 2px; }
.term dd { margin: 0; }
.gl-link { display: inline-block; margin-top: 6px; font-size: 15px; font-weight: 600; }

/* ---------- Maps & 3D Flip Bar ---------- */
.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.tabs button {
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }

.flipbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.flipbar-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.flip-btns {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.flip-btns button {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
}
.flip-btns button:hover { color: var(--ink); }
.flip-btns button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.mapcard { padding: 20px; gap: 14px; }
.map { width: 100%; height: auto; display: block; touch-action: manipulation; }
.map text { font-family: var(--body); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-linejoin: round; }
.map .axislabel { fill: var(--muted); font-family: var(--display); font-style: italic; font-weight: 600; }
.map .grid { stroke: var(--line); }
.map .hit { cursor: pointer; }
/* Story arcs hidden by default; revealed on hover/tap */
.map .arc-group { opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
.map .arc-group.show { opacity: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.legend svg { vertical-align: -2px; margin-right: 6px; }
.picked { font-size: 14px; color: var(--muted); min-height: 1.4em; }
.picked.has-card { min-height: 0; }
.pick-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
.pick-card h4 { font-family: var(--display); font-size: 21px; font-weight: 600; margin: 0 0 4px; color: var(--ink); }
.pick-card p { margin: 4px 0 0; max-width: none; }
.pick-card .mut { color: var(--muted); font-size: 14px; }


.maplist { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: ml; display: grid; }
.maplist li {
  counter-increment: ml;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  cursor: pointer;
}
.maplist li::before { content: counter(ml); color: var(--muted); font-size: 14px; }
.maplist li em { font-style: normal; font-size: 14px; color: var(--muted); white-space: nowrap; }

/* Rating buttons */
.rate { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rate button {
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  line-height: 1.25;
}
.rate button:hover { border-color: var(--accent); }
.rate button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #FCF9F2; }
.rate button small { font-size: 12px; font-weight: 400; opacity: 0.85; }

/* ---------- Tooltips ---------- */
[data-tip] { cursor: help; }
.tipped {
  text-decoration: underline dotted;
  text-decoration-color: var(--muted);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
#tip {
  position: fixed;
  z-index: 60;
  width: min(380px, calc(100vw - 16px));
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px 40px 16px 18px;
  font-size: 15px;
  line-height: 1.5;
}
#tip[hidden] { display: none; }
#tip .x {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
#tip .x:hover { background: var(--surface-2); }
#tip h4 { font-family: var(--display); font-size: 22px; font-weight: 600; margin: 0 0 6px; }
#tip p { margin: 6px 0 0; max-width: none; }
#tip .mut { color: var(--muted); font-size: 14px; }
#tip ul { margin: 6px 0 0; padding-left: 18px; }
#tip li { margin: 3px 0; }
#tip .side { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-top: 10px; }
#tip .c-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
#tip .c-list { list-style: none; padding: 0; margin: 8px 0 0; }
#tip .c-list li { margin: 0 0 10px; padding-left: 10px; border-left: 2px solid var(--line); }
#tip .c-list .c-str { display: block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
#tip .c-list .c-q { display: block; font-size: 15px; line-height: 1.45; }
#tip .c-note { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px !important; }
@media (hover: hover) and (pointer: fine) {
  #tip { max-height: calc(100vh - 16px); overflow: auto; }
  #tip:has(.ctip) { width: min(620px, calc(100vw - 16px)); }
}
@media (hover: none), (pointer: coarse) {
  #tip { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-height: 65vh; overflow: auto; }
}

/* Map Hover Tip (Profile & Groups) */
.tfplot .tp { cursor: pointer; outline: none; }
.tfplot .tp:focus circle:last-child, .tfplot .tp:focus rect { stroke: var(--accent); }
#tf-tip {
  position: absolute;
  z-index: 60;
  max-width: 320px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  pointer-events: none;
}
#tf-tip strong { display: block; font-size: 16px; }
#tf-tip em { display: block; color: var(--accent-ink); font-style: italic; margin: 2px 0 6px; }
#tf-tip p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
#tf-tip .tt-ax { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13px; }
#tf-tip .tt-ax i { font-style: normal; color: var(--muted); }
#tf-tip .tt-ax b { font-weight: 600; text-align: right; }

/* ---------- Glossary, Profile, Groups, Method ---------- */
.method li { margin-bottom: 8px; max-width: 65ch; }
.methodbox summary { list-style: none; cursor: pointer; }
.methodbox summary::-webkit-details-marker { display: none; }
.methodbox summary h2 { display: inline; }
.methodbox summary::after { content: " +"; font-family: var(--display); font-size: 28px; color: var(--accent); }
.methodbox[open] summary::after { content: " −"; }
.methodbox ul { margin-top: 14px; }

table { border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; width: 100%; }
td, th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; }
td:first-child, th:first-child { text-align: left; }
.tablewrap, .gr-tw { overflow-x: auto; }

/* Glossary */
#view-glossary { gap: 36px; }
.gl-top { display: grid; gap: 14px; }
#gl-q { max-width: 520px; font-size: 17px; }
#view-glossary h2 { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.gl-item { padding: 20px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; scroll-margin-top: 76px; }
.gl-item h3 { font-size: 26px; }
.gl-item h3 small { font-family: var(--body); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-left: 8px; }
.gl-item dl { display: grid; grid-template-columns: 180px 1fr; gap: 6px 18px; margin: 0; }
.gl-item dt { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.gl-item dd { margin: 0; font-size: 16px; line-height: 1.55; }
.gl-tab th, .gl-tab td { text-align: left; vertical-align: top; }
.gl-ax { display: block; }
.gl-hit { background: var(--accent-soft); padding: 14px; border-radius: var(--radius); }

/* Profile */
#view-profile { gap: 36px; }
#view-profile > section { display: grid; gap: 14px; }
.pm-mod { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pm-mod + .pm-mod { margin-top: -4px; }
.pm-sum {
  display: grid;
  grid-template-columns: minmax(0, 190px) 1fr auto 20px;
  gap: 6px 16px;
  align-items: baseline;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
}
.pm-empty .pm-sum { cursor: default; grid-template-columns: minmax(0, 190px) 1fr auto; }
.pm-sum::-webkit-details-marker { display: none; }
.pm-n { font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pm-t { font-family: var(--display); font-size: 23px; font-weight: 600; color: var(--ink); }
.pm-c { font-family: var(--body); font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.pm-d { font-size: 14px; }
.pm-go { color: var(--accent-ink); font-size: 15px; font-weight: 600; }
.pm-none { font-size: 15px; color: var(--muted); font-style: italic; }
.pm-empty { background: transparent; }
.pm-arrow::before { content: "+"; font-family: var(--display); font-size: 24px; color: var(--accent); }
details[open] > .pm-sum .pm-arrow::before { content: "−"; }
.pm-sum:hover .pm-t { color: var(--accent); }
.pm-body { padding: 16px 20px 20px; display: grid; gap: 16px; border-top: 1px solid var(--line); }
.pm-ax { display: grid; gap: 4px; }
.pm-old { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.pm-say { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.pm-say strong { color: var(--ink); font-weight: 600; }
.pm-ax.isconf .pm-say strong { color: var(--accent-ink); }
.pm-foot { margin: 0; font-size: 15px; }
.pm-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 22px; display: grid; gap: 14px; }

/* 6-axis comparison bars */
#c6 { display: grid; gap: 14px; }
.c6-cap, .c6-intro { margin: 0; font-size: 16px; color: var(--muted); }
.c6-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
#c6-sel { max-width: 380px; }
.c6-row { display: grid; gap: 6px; }
.c6-lab { display: grid; grid-template-columns: 1fr auto 1fr; font-size: 14px; color: var(--muted); align-items: baseline; }
.c6-lab span:last-child { text-align: right; }
.c6-lab b { font-weight: 600; color: var(--ink); font-size: 15px; }
.c6-track { position: relative; height: 18px; }
.c6-track::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--line); }
.c6-mid { position: absolute; left: 50%; top: 3px; width: 1px; height: 12px; background: var(--muted); }
.c6-gap { position: absolute; top: 7px; height: 4px; background: var(--muted); opacity: 0.5; }
.c6-you, .c6-them { position: absolute; top: 2px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; display: inline-block; }
.c6-you { background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.c6-them { background: var(--fig); box-shadow: 0 0 0 2px var(--surface); }
.c6-key { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; color: var(--muted); align-items: center; }
.c6-key span { display: inline-flex; align-items: center; gap: 6px; }
.c6-key i { position: static; margin: 0; }

/* Groups */
#view-group, #gr-out { display: grid; gap: 32px; }
#view-group > section, #gr-out > section { display: grid; gap: 14px; }
.gr-form { display: grid; gap: 14px; max-width: 440px; }
.gr-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.gr-form .btn { justify-self: start; }
.gr-row { display: flex; gap: 8px; }
.gr-row input { flex: 1; min-width: 0; max-width: none; }
.gr-acts { margin: 0; font-size: 15px; }
.gr-mine { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 8px; font-size: 18px; }
.gr-near { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.gr-near li span { display: block; color: var(--muted); font-size: 15px; }
.gr-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.gr-tabs button {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.gr-tabs button.none { color: var(--muted); }
.gr-tabs button small { color: var(--muted); margin-left: 4px; }
.gr-tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.gr-tabs button[aria-selected="true"] small { color: inherit; opacity: 0.75; }
.gr-stats { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 16px; }
.gr-stats b { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.gr-tab tr.me td { color: var(--accent-ink); font-weight: 600; }
.gr-nf { display: block; font-size: 13px; font-weight: 400; font-style: italic; color: var(--muted); }

footer {
  font-size: 14px;
  color: var(--muted);
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ---------- Mobile & Tablet Adjustments ---------- */
@media (max-width: 720px) {
  .topbar { padding: 0 14px; height: 56px; }
  .topbar-brand { font-size: 20px; }
  .wrap { padding: 20px 16px 56px; gap: 26px; }
  .spotlight { grid-template-columns: 1fr; padding: 20px; }
  .hm-how { grid-template-columns: 1fr; gap: 14px; }
  .hm-grid { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; gap: 16px; }
  .qgrid { grid-template-columns: 1fr; grid-template-areas: "a" "s" "b"; gap: 10px; }
  .stmt { padding: 14px 16px; }
  .stmt span { font-size: 17px; }
  .scale { grid-template-columns: 1fr; gap: 6px; }
  .scale button { flex-direction: row; gap: 6px; min-height: 46px; padding: 8px 14px; }
  .company { grid-template-columns: 1fr; }
  .split-cols { grid-template-columns: 1fr; }
  .term dl, .gl-item dl { grid-template-columns: 1fr; gap: 2px; }
  .term dd, .gl-item dd { margin-bottom: 10px; }
  .rate button small { display: none; }
  .pm-sum { grid-template-columns: 1fr 20px; padding: 14px; }
  .pm-empty .pm-sum { grid-template-columns: 1fr auto; }
  .pm-n { grid-column: 1 / -1; }
  .pm-d { display: none; }
  #tip .c-cols { grid-template-columns: 1fr; gap: 6px; }
  .gl-tab thead { display: none; }
  .gl-tab tr { display: grid; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .gl-tab td { border: 0; padding: 3px 0; }
  .gr-tab thead { display: table-header-group; }
  .gr-tab tr { display: table-row; }
  .gr-tab td { border-bottom: 1px solid var(--line); padding: 8px 10px 8px 0; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar > i, .hm-card { transition: none; }
}
