/* YugMap.com */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --border: #e4ddd2;
  --text: #2a2521;
  --muted: #6f665d;
  --accent: #c2410c;
  --accent-soft: #fde8dc;
  --link: #9a3412;
  --ok: #15803d;
  --err: #b91c1c;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 4px 16px rgba(40, 30, 20, .06);
  --radius: 10px;
  --header-h: 56px;
  /* System fonts only — no web-font downloads. */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", Georgia, serif;
  --sea: #dbe7ee;
  --land: #f4efe6;
  --land-far: #e7e2da;
  --land-stroke: #b9ad9b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412;
    --surface: #211d1a;
    --surface-2: #2a2521;
    --border: #3a332d;
    --text: #efe8df;
    --muted: #a89d91;
    --accent: #f97316;
    --accent-soft: #3b2415;
    --link: #fdba74;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
    --sea: #16222b;
    --land: #2b2621;
    --land-far: #221e1b;
    --land-stroke: #5a5047;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tabular { font-variant-numeric: tabular-nums; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 1000; height: var(--header-h);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { font-size: 1.15rem; letter-spacing: -.01em; }
.brand-text b { color: var(--accent); font-weight: 800; }
.brand-text small { font-size: .72em; font-weight: 500; color: var(--muted); }
.brand-text em { font-style: normal; font-weight: 500; font-size: .8rem; color: var(--muted); margin-left: 6px; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav > a { padding: 6px 12px; border-radius: 8px; color: var(--text); font-weight: 500; }
.site-nav > a:hover { background: var(--surface-2); text-decoration: none; }
.site-nav > a.active { background: var(--accent-soft); color: var(--accent); }
.nav-search input { width: 220px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 8px; font-size: 18px; padding: 4px 10px; color: var(--text); }
@media (max-width: 1440px) {
  .brand-text em { display: none; }
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  body.nav-open .site-nav { display: flex; }
  .nav-search input { width: 100%; }
}

.container { max-width: 1180px; margin: 0 auto; padding: 28px 16px 48px; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 16px; text-align: center; color: var(--muted); font-size: .85rem; }
.site-footer p { margin: .3em 0; }

.flash { max-width: 1180px; margin: 12px auto 0; padding: 10px 14px; border-radius: 8px; }
.flash-success { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }

/* Generic components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-major { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; flex: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--err); }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 16px 0; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
input[type=text], input[type=search], input[type=number], input[type=password], select, textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 100px; width: 100%; }
.pager { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.pager .current { background: var(--accent); color: #fff; border-color: var(--accent); }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* ===================================================================
   Explorer
   =================================================================== */
body.full-bleed { height: 100vh; overflow: hidden; }
.main-bleed { height: calc(100vh - var(--header-h)); }
/* minmax(0, …) + min-width: 0 let the map column shrink; a plain 1fr grows to fit the
   slider row and pushed the Layers box and the side panel off-screen. */
.explorer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: minmax(0, 1fr) auto; height: 100%; }
.explorer-map { position: relative; grid-column: 1; grid-row: 1; min-height: 0; min-width: 0; overflow: hidden; }
#map { position: absolute; inset: 0; }
.explorer-panel { grid-column: 2; grid-row: 1 / span 2; border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; display: flex; flex-direction: column; }
.explorer-controls { grid-column: 1; grid-row: 2; min-width: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 16px 12px; }

.year-overlay {
  position: absolute; top: 14px; left: 14px; z-index: 500; pointer-events: none;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: 12px; padding: 8px 16px; box-shadow: var(--shadow);
}
.year-overlay .region-kicker { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); cursor: help; }
.year-overlay .y { font: 700 2rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.year-overlay .p { color: var(--muted); font-size: .85rem; max-width: 420px; }
.map-toggles { position: absolute; top: 14px; right: 14px; z-index: 500; max-width: calc(100% - 28px); max-height: calc(100% - 28px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; box-shadow: var(--shadow); font-size: .85rem; display: flex; flex-direction: column; gap: 3px; }
.map-toggles summary { cursor: pointer; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.map-toggles[open] summary { margin-bottom: 4px; }
.map-toggles label { display: flex; gap: 6px; align-items: center; cursor: pointer; white-space: nowrap; }
.map-note { position: absolute; left: 12px; bottom: 22px; z-index: 500; font-size: .72rem; color: var(--muted); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 3px 8px; border-radius: 6px; }

.control-row { display: flex; align-items: center; gap: 10px; }
.year-input { display: flex; gap: 4px; align-items: center; }
.year-input input { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.play-btn { width: 38px; height: 38px; justify-content: center; padding: 0; border-radius: 50%; font-size: 14px; }
.presets { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: thin; }
.presets button { flex: none; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .8rem; cursor: pointer; }
.presets button:hover { border-color: var(--accent); color: var(--accent); }

.track { position: relative; flex: 1; min-width: 0; }
.bands { position: relative; height: 44px; margin-bottom: 4px; }
.band { position: absolute; height: 12px; border-radius: 3px; opacity: .55; cursor: pointer; overflow: hidden; font-size: 9px; line-height: 12px; color: #fff; padding: 0 3px; white-space: nowrap; transition: opacity .15s; }
.band:hover, .band.on { opacity: 1; }
.event-rail { position: relative; height: 16px; margin: 2px 0 0; border-top: 1px solid var(--border); }
.rail-tick { position: absolute; top: 3px; width: 2px; height: 7px; margin-left: -1px; padding: 0; border: 0; border-radius: 1px; background: var(--muted); opacity: .45; cursor: pointer; }
.rail-tick.major { top: 0; height: 13px; background: var(--accent); opacity: .8; }
.rail-tick.near { opacity: 1; box-shadow: 0 0 0 1px var(--surface); }
.rail-tick:hover, .rail-tick:focus-visible { opacity: 1; transform: scaleX(2); outline: none; }
.rail-legend { margin-top: 4px; }
.rail-key { display: inline-block; width: 3px; height: 9px; background: var(--muted); vertical-align: -1px; margin: 0 3px 0 8px; }
.rail-key.major { background: var(--accent); height: 12px; margin-left: 0; }
.panel-subhead { margin: 18px 18px 6px; font: 600 .72rem/1 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.slider { width: 100%; margin: 0; accent-color: var(--accent); height: 22px; cursor: pointer; }
.ticks { position: relative; height: 16px; font-size: .68rem; color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }

.panel-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.panel-head h2 { margin: 0; font-size: 1.25rem; }
.period-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.period-chip { font-size: .75rem; padding: 2px 8px; border-radius: 999px; color: #fff; font-weight: 600; }
.panel-filter { margin-top: 10px; width: 100%; }
.panel-body { padding: 6px 0 20px; }
.region-group h3 { font: 600 .72rem/1 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 18px 6px; }
.pol { display: flex; gap: 10px; padding: 8px 18px; cursor: pointer; border-left: 3px solid transparent; }
.pol:hover, .pol.hl { background: var(--surface-2); border-left-color: var(--accent); }
.pol .swatch { margin-top: 5px; }
.pol-name { font-weight: 600; }
.pol-name a { color: var(--text); }
.pol-meta { font-size: .8rem; color: var(--muted); }
.pol-phase { font-size: .8rem; color: var(--accent); font-weight: 500; }
.pol.minor .pol-name { font-weight: 500; font-size: .92rem; }
.ev-list { list-style: none; margin: 0; padding: 0 18px; }
.ev-list li { padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: .88rem; cursor: pointer; }
.ev-list .when { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 6px; }
.ev-list .major { color: var(--accent); }

.loading-bar { position: absolute; top: 0; left: 0; height: 3px; background: var(--accent); z-index: 600; width: 0; transition: width .3s; }
.loading-bar.on { width: 70%; }

@media (max-width: 900px) {
  body.full-bleed { height: auto; overflow: auto; }
  .main-bleed { height: auto; }
  .explorer { display: flex; flex-direction: column; }
  .explorer-controls { order: 1; border-top: 0; border-bottom: 1px solid var(--border); }
  .control-row { flex-wrap: wrap; justify-content: space-between; }
  .control-row .track { order: 3; flex-basis: 100%; }
  .explorer-map { order: 2; height: 58vh; }
  .explorer-panel { order: 3; border-left: 0; overflow: visible; }
  .panel-head { position: static; }
  .year-overlay { left: 10px; top: 10px; padding: 6px 12px; }
  .year-overlay .region-kicker { font-size: .65rem; }
  .year-overlay .y { font-size: 1.4rem; }
  .year-overlay .p { display: none; }
  .map-toggles { top: auto; bottom: 26px; right: 10px; }
}

/* ===================================================================
   Timeline (swimlane chart)
   =================================================================== */
.tl { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.tl-inner { min-width: 960px; position: relative; padding: 0 0 10px; }
.tl-axis { position: sticky; top: 0; height: 28px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 3; margin-left: 200px; }
.tl-axis span { position: absolute; top: 7px; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.tl-grid { position: absolute; top: 0; bottom: 0; left: 200px; right: 0; pointer-events: none; }
.tl-grid i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); opacity: .6; }
.tl-group { padding: 10px 12px 2px; font: 600 .72rem/1 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); position: relative; z-index: 1; }
.tl-row { display: flex; align-items: center; height: 22px; position: relative; z-index: 1; }
.tl-row:hover { background: var(--surface-2); }
.tl-label { width: 200px; flex: none; padding: 0 12px; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-label a { color: var(--text); }
.tl-lane { position: relative; flex: 1; height: 100%; }
.tl-bar { position: absolute; top: 4px; height: 14px; border-radius: 4px; min-width: 3px; opacity: .85; }
.tl-bar:hover { opacity: 1; outline: 2px solid var(--text); }
.tl-bar.circa { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.25) 0 4px, transparent 4px 8px); }
.tl-periods { margin-left: 200px; position: relative; height: 26px; margin-top: 6px; }
.tl-periods a { position: absolute; top: 2px; height: 20px; border-radius: 4px; color: #fff; font-size: .68rem; line-height: 20px; padding: 0 5px; overflow: hidden; white-space: nowrap; opacity: .9; }

/* Polity page */
.polity-hero { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.polity-hero .swatch { width: 18px; height: 56px; border-radius: 5px; }
.polity-hero h1 { margin-bottom: 6px; }
.mini-map { height: 320px; border-radius: var(--radius); border: 1px solid var(--border); }
.ruler-list { list-style: none; padding: 0; margin: 0; }
.ruler-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ruler-list .years { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .88rem; }
.ruler-list .notes { font-size: .82rem; color: var(--muted); }
.phase-head { margin: 14px 0 2px; font-weight: 700; color: var(--accent); font-size: .9rem; }

/* Period timeline on home of timeline page */
.era-strip { display: flex; flex-direction: column; gap: 10px; }
.era { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: start; padding: 12px 16px; border-left: 5px solid; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow); }
.era .when { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .era { grid-template-columns: 1fr; } }

.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0; }
.prose { max-width: 760px; }
.prose p, .prose li { line-height: 1.7; }

/* Admin */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-nav a { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.admin-nav a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.field.error input, .field.error select { border-color: var(--err); }
.field .err { color: var(--err); font-size: .8rem; }
.auth-box { max-width: 380px; margin: 60px auto; }
.stat { font: 700 2rem/1 var(--serif); }

/* ===================================================================
   SVG map engine (assets/js/svgmap.js)
   =================================================================== */
.map-canvas { position: relative; overflow: hidden; background: var(--sea); touch-action: none; outline: none; }
.svgmap svg { display: block; width: 100%; height: 100%; cursor: grab; user-select: none; -webkit-user-select: none; }
.svgmap svg.sm-dragging { cursor: grabbing; }
.sm-sea { fill: var(--sea); }
.sm-country { stroke: var(--land-stroke); stroke-width: .6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.sm-neighbour { fill: var(--land-far); }
.sm-saarc { fill: var(--land); }
.sm-border { fill: none; stroke: var(--text); stroke-opacity: .35; stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.sm-country-label { fill: var(--text); fill-opacity: .28; font-family: var(--font); font-weight: 700; letter-spacing: .15em; text-anchor: middle; pointer-events: none; }
.sm-capital { fill: var(--text); fill-opacity: .45; pointer-events: none; }
.sm-capital-label { fill: var(--text); fill-opacity: .45; font-family: var(--font); pointer-events: none; }
.sm-polity { stroke-linejoin: round; transition: fill-opacity .12s; }
.sm-polity:hover { fill-opacity: .4; }
.sm-label { font-family: var(--font); font-weight: 600; fill: #2a2521; text-anchor: middle; dominant-baseline: middle; pointer-events: none;
  paint-order: stroke; stroke: #fff; stroke-width: calc(3px * var(--sm-unit, 1)); stroke-linejoin: round; }
.sm-label.major { font-weight: 800; }
.sm-label.hl { fill: var(--accent); }
.sm-event { fill: #c2410c; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.sm-event.minor { fill: #f59e0b; }
.sm-site { fill: #2a2521; stroke: #fff; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.sm-dot { stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sm-tip { position: absolute; z-index: 20; pointer-events: none; opacity: 0; background: var(--text); color: var(--surface); font-size: .75rem; padding: 3px 8px; border-radius: 5px; white-space: nowrap; transition: opacity .1s; }
.sm-tip.on { opacity: .92; }
.sm-popup { position: absolute; z-index: 30; display: none; width: 280px; max-width: calc(100% - 16px); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; font-size: 13px; line-height: 1.45; }
.sm-popup.on { display: block; }
.sm-popup h4 { margin: 0 22px 4px 0; font: 700 15px/1.2 var(--serif); }
.sm-popup p { margin: 6px 0; }
.sm-popup-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; }
.sm-controls { position: absolute; left: 12px; bottom: 44px; z-index: 10; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.sm-controls button { width: 34px; height: 32px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 17px; cursor: pointer; }
.sm-controls button:last-child { border-bottom: 0; }
.sm-controls button:hover { background: var(--surface-2); }
.mini-map .sm-controls { bottom: 12px; }
@media (prefers-color-scheme: dark) {
  .sm-label { fill: #f5efe6; stroke: #1b1714; }
}

/* ===================================================================
   Quiz
   =================================================================== */
.quiz-wrap { max-width: 820px; margin: 0 auto; }
.quiz-card { padding: 26px 28px; }
.quiz-hero h1 { margin-bottom: 6px; }
.quiz-field { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.quiz-field legend { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.quiz-field select { width: 100%; }
.quiz-row { display: flex; gap: 24px; flex-wrap: wrap; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.chip span { color: var(--muted); font-size: .78rem; margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on span { color: rgba(255,255,255,.8); }
.quiz-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.btn-lg { padding: 12px 26px; font-size: 1.05rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.quiz-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.quiz-count { margin-left: auto; color: var(--muted); font-size: .88rem; }
.quiz-score { font-weight: 700; font-size: .88rem; }
.badge.diff-easy { color: var(--ok); }
.badge.diff-hard { color: var(--err); }
.quiz-bar { height: 5px; background: var(--surface-2); border-radius: 3px; margin: 12px 0 18px; overflow: hidden; }
.quiz-bar div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.quiz-question { font-size: 1.35rem; line-height: 1.35; margin: 0 0 18px; outline: none; }
.quiz-options { display: grid; gap: 10px; }
.quiz-opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .12s, background .12s; }
.quiz-opt:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-soft); }
.quiz-opt[disabled] { cursor: default; }
.quiz-letter { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--surface-2); }
.quiz-opt.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.quiz-opt.correct .quiz-letter { background: var(--ok); color: #fff; }
.quiz-opt.wrong { border-color: var(--err); background: color-mix(in srgb, var(--err) 10%, var(--surface)); }
.quiz-opt.wrong .quiz-letter { background: var(--err); color: #fff; }
.quiz-feedback { margin-top: 16px; padding: 12px 16px; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; font-size: .94rem; }
.quiz-feedback.ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.quiz-feedback.bad { background: color-mix(in srgb, var(--err) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); }
.quiz-keys { margin: 14px 0 0; }
.quiz-bigscore { font: 700 2.6rem/1.1 var(--serif); color: var(--accent); margin: 6px 0; }
.quiz-review { padding-left: 20px; }
.quiz-review li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.quiz-review .rq { font-weight: 600; margin-bottom: 4px; }
.quiz-review .ra.bad { color: var(--err); }
.quiz-review .ra.ok { color: var(--ok); }
@media (max-width: 640px) { .quiz-card { padding: 18px 16px; } .quiz-question { font-size: 1.15rem; } }

/* Personalities */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.person-card { display: block; color: inherit; padding: 14px 16px; }
.person-card:hover { text-decoration: none; border-color: var(--accent); }
.person-card .life { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.person-card .kf { font-size: .9rem; margin-top: 4px; }
.people-list { list-style: none; margin: 0; padding: 0 18px; }
.people-list li { padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: .88rem; }
.people-list .kf { color: var(--muted); font-size: .8rem; }
.outcome { margin-top: 4px; font-size: .85rem; }
.outcome::before { content: "Result: "; font-weight: 700; color: var(--accent); }

/* Books */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.book-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.book-kind { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.book-title { font-size: 1.02rem; margin: 0; }
.book-author { font-size: .88rem; }
.book-note { font-size: .88rem; margin: 2px 0; color: var(--text); flex: 1; }
.book-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.book-buy { display: flex; gap: 8px; margin-top: 6px; }
.book-buy .btn { flex: 1; justify-content: center; }
.books-box { margin-top: 28px; }
.affiliate-note { margin-top: 8px; }
.affiliate-banner { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--muted); }
.book-filters { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 8px; }
.filter-label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
a.chip:hover { text-decoration: none; }

/* Report a problem */
.report-wrap { margin-top: 8px; }
.report-link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.report-link:hover { color: var(--err); }
.report-done { font-size: .82rem; color: var(--ok); }
.report-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.report-form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; }
.report-form select, .report-form textarea { font-weight: 400; min-height: 0; }
.report-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-msg { font-size: .8rem; color: var(--muted); }
.report-card { margin-bottom: 14px; }
.report-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.report-options { margin: 0 0 8px; padding-left: 22px; }
.report-options .is-answer { color: var(--ok); font-weight: 600; }
.report-list { margin: 8px 0; padding-left: 18px; font-size: .9rem; }
.report-list li { margin: 4px 0; }

/* Accounts */
.nav-account { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
.nav-account > a:not(.btn) { padding: 6px 10px; border-radius: 8px; color: var(--text); font-weight: 500; white-space: nowrap; }
.nav-account > a:not(.btn):hover { background: var(--surface-2); text-decoration: none; }
.nav-account > a.active { background: var(--accent-soft); color: var(--accent); }
.badge-pro { background: linear-gradient(135deg, #f59e0b, #c2410c); color: #fff; border: 0; font-size: .65rem; }
@media (max-width: 1440px) { .nav-account { margin: 6px 0; } }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-stack .field input { width: 100%; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9rem; margin-top: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font: 700 1.6rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .s { font-size: .78rem; color: var(--muted); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 18px 0; }
.plan { text-align: center; padding: 22px 18px; position: relative; }
.plan.best { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.plan .price { font: 700 2.2rem/1 var(--serif); margin: 10px 0 4px; }
.plan .per { color: var(--muted); font-size: .85rem; }
.plan .ribbon { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.benefits { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 20px; }
.benefits li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.quota-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .9rem; margin-top: 16px; }
.quota-bar.empty { background: var(--accent-soft); border-color: var(--accent); }
.lb-table td:first-child { width: 48px; font-weight: 700; }
.lb-me { background: var(--accent-soft); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grid { stroke: var(--border); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
pre.trace { white-space: pre-wrap; font-size: .75rem; background: var(--surface-2); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; }
.quiz-opt.pending { border-color: var(--accent); opacity: .7; }
.admin-nav-content { margin-top: -12px; padding-top: 8px; border-top: 1px dashed var(--border); align-items: center; }
.admin-nav-content a { font-size: .85rem; padding: 4px 10px; }
a.kpi:hover { border-color: var(--accent); text-decoration: none; }

/* Hindi / Devanagari */
.lang-hi, .lang-hi input, .lang-hi select, .lang-hi textarea, .lang-hi button {
  font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", "Mangal", var(--font);
}
.lang-hi h1, .lang-hi h2, .lang-hi h3, .lang-hi .stat, .lang-hi .year-overlay .y, .lang-hi .quiz-bigscore, .lang-hi .kpi .v, .lang-hi .plan .price {
  font-family: "Noto Serif Devanagari", "Kohinoor Devanagari", "Nirmala UI", "Mangal", var(--serif);
}
.lang-hi { line-height: 1.65; }
.lang-hi .outcome::before { content: "परिणाम: "; }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-left: 6px; flex: none; }
.lang-switch a { padding: 5px 9px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.lang-switch a:hover { text-decoration: none; background: var(--surface-2); }
.lang-switch a.on { background: var(--accent); color: #fff; }
@media (max-width: 1440px) { .lang-switch { margin: 6px 0; align-self: flex-start; } }

/* Captcha */
.captcha-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.captcha-img { height: 52px; width: auto; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #f7f3ec; }
.captcha-text { font: 700 1.3rem/1 var(--serif); letter-spacing: .08em; padding: 10px 14px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface-2); }
.captcha-refresh { font-size: 1.1rem; line-height: 1; }
.captcha input { max-width: 180px; letter-spacing: .1em; }

/* Contact page */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 32px; align-items: start; }
.contact-box { max-width: none; margin: 0; }
.contact-box h2 { margin-top: 0; }
.contact-box textarea { width: 100%; }
@media (max-width: 800px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.quiz-captcha .captcha { margin: 14px 0 0; }


/* ===================================================================
   Admin → Settings: one row (and one Save) per setting
   =================================================================== */
.settings-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.set-search { width: min(360px, 100%); }
.set-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; position: sticky; top: var(--header-h); z-index: 5; background: var(--bg); padding: 8px 0; }
.set-jump a { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .82rem; color: var(--text); }
.set-jump a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.set-section { margin-bottom: 16px; padding: 0; overflow: hidden; scroll-margin-top: calc(var(--header-h) + 56px); }
.set-section h2 { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 1.15rem; }
.set-intro { margin: 0; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.set-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px 24px; padding: 14px 18px; border-bottom: 1px solid var(--border); border-left: 4px solid transparent; transition: background .2s, border-color .2s; scroll-margin-top: calc(var(--header-h) + 64px); }
.set-row:last-child { border-bottom: 0; }
.set-row:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.set-row.dirty { border-left-color: #d97706; background: color-mix(in srgb, #f59e0b 9%, var(--surface)); }
.set-row.has-error { border-left-color: var(--err); background: color-mix(in srgb, var(--err) 6%, var(--surface)); }
.set-row.just-saved { animation: set-saved 2.4s ease-out; border-left-color: var(--ok); }
@keyframes set-saved { 0% { background: color-mix(in srgb, var(--ok) 22%, var(--surface)); } 100% { background: transparent; } }
.set-label { font-weight: 700; font-size: .95rem; display: block; }
.set-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; font-size: .75rem; }
.set-meta code { font-size: .72rem; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.set-info .help { margin-top: 2px; }
.set-error { margin: 8px 0 0; }
.set-control { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.set-control input:not([type=checkbox]), .set-control select, .set-control textarea { width: 100%; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.set-save:disabled { opacity: .45; cursor: default; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill-changed { color: #1d4ed8; border-color: color-mix(in srgb, #1d4ed8 35%, transparent); background: color-mix(in srgb, #1d4ed8 8%, var(--surface)); cursor: help; }
.pill-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill-warn { color: #b45309; border-color: color-mix(in srgb, #b45309 35%, transparent); }
.pill-dirty { color: #fff; background: #d97706; border-color: #d97706; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 42px; height: 24px; border-radius: 999px; background: var(--border); position: relative; transition: background .2s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--ok); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) { .set-row { grid-template-columns: minmax(0, 1fr); } }

/* ===================================================================
   Admin panel interactions (assets/js/admin.js)
   =================================================================== */
.just-saved { animation: set-saved 2.4s ease-out; box-shadow: inset 4px 0 0 var(--ok); }
tr.just-saved td { animation: set-saved 2.4s ease-out; }
/* Tables */
.table-tools { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.table-filter { width: min(320px, 100%); }
table.data th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.data th.sortable::after { content: " ↕"; color: var(--muted); opacity: .45; font-size: .8em; }
table.data th.sortable[data-dir="asc"]::after { content: " ↑"; opacity: 1; color: var(--accent); }
table.data th.sortable[data-dir="desc"]::after { content: " ↓"; opacity: 1; color: var(--accent); }
table.data tr.row-link { cursor: pointer; }
table.data tr.row-link:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
/* Edit forms */
.edit-form .field.changed { position: relative; }
.edit-form .field.changed::before { content: ""; position: absolute; left: -10px; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; background: #d97706; }
.edit-form .field.changed input, .edit-form .field.changed select, .edit-form .field.changed textarea { border-color: #d97706; background: color-mix(in srgb, #f59e0b 7%, var(--surface)); }
.field-hi { background: color-mix(in srgb, var(--accent) 4%, transparent); border-radius: 8px; padding: 4px 8px 6px; margin: -4px -8px 0; }
.lang-tag { display: inline-block; font-size: .65rem; font-weight: 800; letter-spacing: .05em; padding: 0 5px; border-radius: 4px; background: var(--accent); color: #fff; vertical-align: 1px; }
.lang-tag-en { background: var(--muted); }
.hi-missing { color: #b45309; }
.dirty-bar { position: sticky; bottom: 12px; z-index: 20; margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px;
  background: #fffbeb; border: 1px solid #f59e0b; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.dirty-count { font-weight: 700; color: #92400e; }
.dirty-actions { margin-left: auto; display: flex; gap: 8px; }
.char-count { font-size: .72rem; color: var(--muted); text-align: right; margin-top: 2px; }
.char-count.near { color: #b45309; font-weight: 600; }
.danger-zone { margin-top: 20px; padding: 12px 14px; border: 1px dashed color-mix(in srgb, var(--err) 45%, transparent); border-radius: 10px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.danger-zone.form-stack { display: flex; flex-direction: column; align-items: stretch; }
button:disabled { cursor: not-allowed; }
kbd { font: 600 .72rem/1 var(--font); padding: 2px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); }
/* Flash close / fade */
.flash { position: relative; padding-right: 36px; transition: opacity .5s; }
.flash.fade { opacity: 0; }
.flash-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.flash-close:hover { opacity: 1; }
/* Copy */
.copyable { cursor: copy; border-bottom: 1px dotted var(--muted); }
.copyable.copied { color: var(--ok); border-bottom-color: var(--ok); }
.copyable.copied::after { content: " ✓ copied"; font-size: .75em; }
time[title] { cursor: help; border-bottom: 1px dotted transparent; }
time[title]:hover { border-bottom-color: var(--muted); }
/* Nav counts */
.nav-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 999px; background: var(--err); color: #fff; font-size: .7rem; font-weight: 700; text-align: center; line-height: 18px; }
.admin-nav a.active .nav-count { background: #fff; color: var(--accent); }
/* Dashboard */
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.att-tile { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: transform .12s, box-shadow .12s; }
.att-tile:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.att-icon { font-size: 1.4rem; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.att-n { font: 700 1.3rem/1 var(--serif); }
.att-hot { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.att-hot .att-icon { background: var(--accent); color: #fff; }
.setup-list { margin-bottom: 16px; border-color: #f59e0b; background: #fffbeb; }
.setup-list ul { margin: 6px 0 0; padding-left: 18px; }
.kpi { transition: transform .12s, box-shadow .12s; }
a.kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
/* Friendly empty states (admin_empty()) */
.empty-state { text-align: center; padding: 36px 20px; margin: 14px 0; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state h3 { margin: 8px 0 6px; font-size: 1.2rem; }
.empty-state p { max-width: 560px; margin: 0 auto; }
.empty-icon { font-size: 2.2rem; line-height: 1; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.empty-actions [data-copy].copied::after { content: " ✓"; }


/* ===================================================================
   Public-site interactions (assets/js/public.js)
   =================================================================== */
/* Search suggestions */
.nav-search.has-suggest { position: relative; }
.suggest { position: absolute; top: calc(100% + 6px); right: 0; width: min(440px, 92vw); max-height: 70vh; overflow-y: auto; z-index: 1000;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px; }
.sg-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.sg-item:hover, .sg-item.on { background: var(--surface-2); text-decoration: none; }
.sg-item.on { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.sg-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.sg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sg-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-label mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sg-sub { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-kind { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); flex: none; }
.sg-empty { padding: 10px; color: var(--muted); font-size: .88rem; }
.sg-all { display: block; padding: 8px 10px; margin-top: 4px; border-top: 1px solid var(--border); font-weight: 600; font-size: .88rem; }
@media (max-width: 1320px) { .site-nav .suggest { left: 0; right: auto; width: 100%; } }
/* Filters that auto-apply */
.filters.is-updating { opacity: .6; pointer-events: none; }
/* Find on this page + jump chips */
.find-bar { position: sticky; top: var(--header-h); z-index: 30; background: var(--bg); padding: 8px 0; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.find-bar input[type=search] { width: min(340px, 100%); }
.jump-chips { display: flex; gap: 6px; overflow-x: auto; flex-basis: 100%; scrollbar-width: thin; padding-bottom: 2px; }
.jump-chips a { flex: none; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .78rem; color: var(--text); white-space: nowrap; }
.jump-chips a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.jump-chips a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-find-heading] { scroll-margin-top: calc(var(--header-h) + 90px); }
/* Password show/hide + match hint */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; font-size: 1rem; padding: 6px; opacity: .7; }
.pw-toggle:hover { opacity: 1; }
.match-hint { margin-top: 4px; min-height: 1em; }
.match-hint.ok { color: var(--ok); }
.match-hint.bad { color: #b45309; }
/* Toast + back to top */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: opacity .25s, transform .25s; z-index: 2000;
  background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: .9rem; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.to-top { position: fixed; right: 18px; bottom: 18px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow); font-size: 1.1rem; cursor: pointer; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none; z-index: 900; }
.to-top.on { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { border-color: var(--accent); color: var(--accent); }
/* Clickable cards feel clickable */
.person-card, a.card { transition: transform .12s, box-shadow .12s, border-color .12s; }
.person-card:hover, a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); text-decoration: none; }
tr.lb-me td { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-weight: 600; }
.search-empty p { margin: 6px 0; }
@media (prefers-reduced-motion: reduce) { .person-card, a.card, .to-top, .toast { transition: none; } .person-card:hover, a.card:hover { transform: none; } }

/* ===================================================================
   Home map extras (explorer.js)
   =================================================================== */
.sm-tip.rich { white-space: normal; width: max-content; max-width: 260px; padding: 8px 10px; font-size: .78rem; line-height: 1.35; border-radius: 8px; opacity: 0; }
.sm-tip.rich.on { opacity: .96; }
.sm-tip b { font-size: .85rem; }
.tip-phase { color: #fdba74; }
.tip-hint { margin-top: 4px; opacity: .7; font-size: .7rem; }
.tip-new, .badge-new { display: inline-block; padding: 0 6px; border-radius: 999px; background: #16a34a; color: #fff; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; vertical-align: 1px; }
.badge-new { border: 0; }
@keyframes sm-pulse { 0% { fill-opacity: .55; stroke-width: 4; } 100% { } }
.sm-pulse { animation: sm-pulse 2.2s ease-out; }
.change-strip { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; line-height: 1.5; }
.change-strip .rose { color: #15803d; }
.change-strip .fell { color: #b45309; }
.change-strip button { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline dotted; cursor: pointer; font: inherit; }
.explorer-tools { display: flex; gap: 4px; }
.explorer-tools .btn { min-width: 34px; justify-content: center; }
.track-bubble { position: absolute; top: -26px; transform: translateX(-50%); background: var(--text); color: var(--surface); font-size: .72rem; padding: 3px 8px; border-radius: 6px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 5; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.track-bubble.on { opacity: .95; }
.kbd-help { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.35); display: grid; place-items: center; padding: 16px; }
.kbd-card { background: var(--surface); border-radius: 14px; padding: 18px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.3); width: min(420px, 100%); }
.kbd-card h3 { margin: 0 0 10px; }
.kbd-card table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: .9rem; }
.kbd-card td { padding: 5px 0; border-bottom: 1px solid var(--border); }
.kbd-card td:first-child { white-space: nowrap; padding-right: 14px; }
.coach { position: absolute; right: 14px; bottom: 44px; z-index: 600; width: min(320px, calc(100% - 28px)); background: var(--surface); border: 1px solid var(--accent);
  border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.18); font-size: .85rem; }
.coach ul { margin: 6px 0 10px; padding-left: 18px; }
@media (max-width: 900px) { .coach { bottom: 12px; right: 10px; } .explorer-tools { order: 2; } }
