/* ============================================================= *
 *  kweb wikify — editorial dark UI
 *  Layout + typography led. Hairlines, not boxes.
 * ============================================================= */

@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 300 620;
  font-display: swap;
  font-style: normal;
}

:root {
  --bg:        #0b0b14;
  --bg-lift:   #12121e;
  --ink:       #ece9e4;   /* warm off-white for reading */
  --ink-dim:   #9997a6;
  --ink-faint: #5f5d6e;
  --line:      rgba(236, 233, 228, .09);
  --line-soft: rgba(236, 233, 228, .05);
  --cyan:      #63e6d3;
  --purple:    #b39dfb;
  --amber:     #e6b17e;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans:  system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:  'JetBrains Mono', 'Fira Mono', ui-monospace, Menlo, monospace;

  --pad: clamp(18px, 5vw, 30px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
  padding-bottom: 92px;
  overflow-x: hidden; /* nothing should scroll the page sideways on a phone */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle top-of-page glow — depth without a box */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 320px;
  background: radial-gradient(120% 100% at 50% -40%, rgba(99, 230, 211, .07), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- type helpers ---------- */
.serif { font-family: var(--serif); font-optical-sizing: auto; }
.quiet { color: var(--ink-dim); }
.label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* section header: a quiet label with a hairline reaching across */
.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 12px;
}
.section-head .label { flex: none; }
.section-head .rule { flex: 1; height: 1px; background: var(--line-soft); }
.section-head .acts { display: flex; gap: 12px; flex: none; }
.section-head .act {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
}
.section-head .act:hover { color: var(--cyan); }
.section-head .act + .act { margin-left: 10px; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px var(--pad) 14px;
  background: linear-gradient(var(--bg) 62%, rgba(11, 11, 20, 0));
}
#back {
  appearance: none;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px 4px 0;
  transition: color .15s, transform .15s;
}
#back:hover { color: var(--ink); transform: translateX(-2px); }
#brand {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--ink-dim);
}
#brand b { color: var(--ink); font-weight: 600; letter-spacing: .01em; }
#brand .brand-sub { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin-left: 4px; }
.star { color: var(--amber); }
#topbar-sub {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

button { font-family: var(--mono); }

.view {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 4px var(--pad) 40px;
  animation: viewIn .4s cubic-bezier(.2, .7, .3, 1);
}
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.intro {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(19px, 5.2vw, 24px);
  font-weight: 380;
  line-height: 1.34;
  color: var(--ink);
  letter-spacing: -.01em;
  margin: 14px 0 30px;
  max-width: 30ch;
}
.intro em { font-style: italic; color: var(--cyan); }

/* ---------- feeds index ---------- */
.list { display: flex; flex-direction: column; }

.feed-card {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  transition: opacity .15s;
}
.feed-card:first-child { border-top: none; }
.feed-card:hover { opacity: .72; }
.feed-card img {
  width: 58px; height: 58px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-lift);
}
.feed-card h3 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 19px;
  font-weight: 480;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.feed-card .author {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 3px 0 4px;
}
.feed-card .tagline { font-size: 13px; color: var(--ink-dim); line-height: 1.4; }

/* star + follow actions on a show card */
.fc-actions { display: flex; align-items: center; gap: 8px; }
.fav-btn {
  flex: none; background: none; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--ink-dim); padding: 2px;
  transition: color .15s, transform .1s;
}
.fav-btn:hover { color: var(--ink); }
.fav-btn.on { color: var(--amber); }
.fav-btn:active { transform: scale(1.25); }

/* follow toggle on a show */
.sub-btn {
  flex: none; align-self: center; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-dim); background: none; border: 1px solid var(--line-soft);
  padding: 6px 11px; border-radius: 999px; cursor: pointer; transition: color .15s, border-color .15s;
}
.sub-btn:hover { color: var(--ink); }
.sub-btn.on { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 45%, transparent); }

/* can't-afford wikify button */
.wikify-btn.cant { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); opacity: .8; }

/* admin panel */
#admin-panel { padding-top: 4px; }
.admin-new { display: flex; gap: 8px; margin: 12px 0; }
.admin-new input[type=text] { flex: 1; min-width: 0; }
.admin-new input[type=number] { width: 62px; }
.admin-new input {
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--bg-lift); border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px;
}
.admin-new input:focus { outline: none; border-color: var(--cyan); }
.admin-new .act, #admin-invite .act {
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--cyan);
  background: none; border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; white-space: nowrap;
}
#admin-invite { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
#admin-invite b { color: var(--ink); }
.admin-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.au-btn.rm { color: var(--ink-faint); border-color: var(--line-soft); }
.au-btn.rm:hover { color: var(--coral, #e0736a); border-color: var(--coral, #e0736a); }
.au-name { font-size: 14px; }
.au-cr { font-family: var(--mono); font-size: 11px; color: var(--purple); font-variant-numeric: tabular-nums; }
.au-btn {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim);
  background: none; border: 1px solid var(--line-soft); border-radius: 999px; padding: 5px 10px; cursor: pointer;
}
.au-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ---------- feed header + episode index ---------- */
#feed-head {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 16px;
  align-items: center;
  margin: 10px 0 8px;
}
#feed-refresh {
  flex: none; align-self: start; margin-top: 4px;
  font-size: 16px; line-height: 1; color: var(--ink-dim); background: none;
  border: 1px solid var(--line-soft); border-radius: 999px; width: 34px; height: 34px;
  cursor: pointer; transition: color .15s, border-color .15s;
}
#feed-refresh:hover { color: var(--cyan); border-color: var(--cyan); }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#feed-head img { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: var(--bg-lift); }
#feed-head h2 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 24px; font-weight: 480; letter-spacing: -.015em; line-height: 1.15;
}
#feed-head .author {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--cyan); margin-top: 5px;
}

.ep-card {
  display: block;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}
.ep-card:hover .ep-title { color: var(--cyan); }
.ep-card .ep-title {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 20px; font-weight: 460; letter-spacing: -.012em; line-height: 1.22;
  transition: color .15s;
}
.ep-card .ep-title .badge { color: var(--amber); margin-right: 8px; font-size: .85em; vertical-align: 1px; }
.ep-card .ep-meta {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  color: var(--ink-faint); display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 6px;
}
.ep-card .ep-meta .badge { color: var(--purple); }
.ep-card .ep-desc {
  font-size: 13.5px; color: var(--ink-dim); line-height: 1.5;
  max-height: 3em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.ep-card.has-layer .ep-title .badge { color: var(--cyan); }

/* on-demand wikify: button + live progress on an episode row */
.wikify-btn {
  display: inline-block; white-space: nowrap;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyan); background: none; border: 1px solid var(--line-soft);
  padding: 5px 11px; border-radius: 999px; cursor: pointer; margin-top: 4px;
  transition: border-color .15s, color .15s;
}
.wikify-btn:hover { border-color: var(--cyan); }
.wikify-btn:disabled { opacity: .5; cursor: default; }
.wikify-job { margin-top: 10px; }
/* in the icon-grid layout (Latest), appended controls must span both columns —
   otherwise they land in the 52px icon column and wrap into a mangled stack */
.ep-card.has-art .wikify-btn, .ep-card.has-art .wikify-job { grid-column: 1 / -1; }
.ep-card.has-art .wikify-btn { justify-self: start; }
.wikify-job .wj-bar {
  height: 2px; background: var(--line-soft); border-radius: 2px; overflow: hidden;
}
.wikify-job .wj-bar > span {
  display: block; height: 100%; width: 3%; background: var(--cyan);
  transition: width .5s ease;
}
.wikify-job.done .wj-bar > span { background: var(--green, #7fd88f); }
.wikify-job.err .wj-bar { display: none; }
.wikify-job .wj-line {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em;
  color: var(--ink-dim); margin-top: 7px;
}
.wikify-job.done .wj-line { color: var(--cyan); }
.wikify-job.err .wj-line { color: var(--amber); }

/* glanceable credits + model picker */
.credits-line {
  display: block; width: 100%; text-align: right;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  color: var(--ink-faint); background: none; border: none; cursor: pointer;
  padding: 4px 0 2px;
}
.credits-line:empty { display: none; }
.credits-line.low { color: var(--amber); }
.mpick { display: flex; gap: 6px; flex: none; }
.mpick button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em;
  color: var(--ink-dim); background: none; border: 1px solid var(--line-soft);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: color .15s, border-color .15s;
}
.mpick button.on { color: var(--cyan); border-color: var(--cyan); }
.setting .act {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em;
  color: var(--ink-dim); background: none; border: 1px solid var(--line-soft);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; flex: none;
  transition: color .15s, border-color .15s;
}
.setting .act:hover { color: var(--cyan); border-color: var(--cyan); }

/* latest view + home entry */
.latest-link {
  display: flex; align-items: baseline; gap: 12px; width: 100%;
  background: none; border: none; border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft); padding: 16px 0; margin: 4px 0 20px;
  cursor: pointer; text-align: left;
  font-family: var(--serif); font-size: 19px; font-weight: 460; color: var(--ink);
  transition: color .15s;
}
.latest-link:hover { color: var(--cyan); }
.latest-link .sub {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint);
}
#latest-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 0 6px;
}
#latest-head h2 {
  font-family: var(--serif); font-size: 26px; font-weight: 480; letter-spacing: -.015em;
}
#latest-head .act {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--ink-dim);
  background: none; border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 6px 13px; cursor: pointer; transition: color .15s, border-color .15s;
}
#latest-head .act:hover { color: var(--cyan); border-color: var(--cyan); }
.ep-card .ep-meta .ep-feed { color: var(--cyan); }
.ep-card .ep-meta .ep-note { color: var(--amber); }
/* listened / in-progress state */
.ep-card.heard { opacity: .45; }
.ep-card.heard:hover { opacity: .72; }
.ep-card .ep-meta .ep-listened { color: var(--green, #7fd88f); }
.ep-card .ep-meta .ep-progress { color: var(--cyan); }
#library-count { align-self: center; }

/* add-a-podcast form */
#add-feed-form { padding: 4px 0 20px; display: flex; flex-direction: column; gap: 12px; }
#add-feed-url {
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--bg-lift); border: 1px solid var(--line-soft); border-radius: 9px; padding: 11px 13px;
}
#add-feed-url:focus { outline: none; border-color: var(--cyan); }
.af-priv { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-dim); cursor: pointer; }
.af-priv input { width: 17px; height: 17px; accent-color: var(--cyan); }
.af-row { display: flex; align-items: center; gap: 14px; }
#add-feed-go {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--cyan);
  background: none; border: 1px solid color-mix(in srgb, var(--cyan) 45%, transparent);
  border-radius: 9px; padding: 9px 16px; cursor: pointer;
}
#add-feed-go:disabled { opacity: .5; }
.af-status { font-family: var(--mono); font-size: 11px; color: var(--amber); }
.priv-tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--amber); margin-left: 9px; vertical-align: 2px; white-space: nowrap; }

/* transient toast */
#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(8px);
  background: var(--bg-lift); color: var(--ink); border: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 12px; letter-spacing: .03em;
  padding: 9px 16px; border-radius: 999px; z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- now playing ---------- */
#np-head { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; margin: 6px 0 16px; }
#np-desc { margin: 0 0 24px; }
#np-desc[hidden] { display: none; }
#np-desc-text {
  font-size: 13.5px; line-height: 1.6; color: var(--ink-dim); white-space: pre-line;
  max-height: 4.8em; overflow: hidden; cursor: pointer;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
  mask-image: linear-gradient(180deg, #000 60%, transparent);
  transition: max-height .25s ease;
}
#np-desc-text.open { max-height: 1600px; -webkit-mask-image: none; mask-image: none; cursor: default; }
#np-desc-more {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--cyan);
  background: none; border: none; padding: 6px 0 0; cursor: pointer;
}
#np-desc-more[hidden] { display: none; }
#np-art { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--bg-lift); }
#np-feed {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 3px;
}
#np-title {
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: 22px; font-weight: 480; letter-spacing: -.015em; line-height: 1.15;
}

/* transcript — a lit rule, no box */
#cap-row { display: flex; align-items: baseline; gap: 8px 12px; margin-bottom: 8px; flex-wrap: wrap; }
#cap-row .label { flex: none; }
#sync-ctl { display: inline-flex; gap: 4px; margin-left: auto; }
#sync-ctl button, #karaoke-toggle {
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); padding: 2px 3px;
}
#sync-ctl button:hover, #karaoke-toggle:hover { color: var(--cyan); }
#sync-label.active { color: var(--purple); }
#karaoke-toggle.on { color: var(--cyan); }
/* skip-intro: a real one-tap action (jump past the ads), so give it a tappable
   outlined pill rather than the bare-text look of the fine sync nudges */
#skip-intro {
  background: none; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--cyan) 42%, transparent); border-radius: 3px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyan); padding: 3px 8px; white-space: nowrap;
}
#skip-intro:disabled { opacity: .7; cursor: default; }
#skip-status {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  color: var(--ink-dim); white-space: nowrap;
}
#skip-status:empty { display: none; }
#skip-intro:hover { background: color-mix(in srgb, var(--cyan) 14%, transparent); }
#skip-intro:active { transform: translateY(1px); }
#skip-intro:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

#caption {
  height: 3.4em;
  overflow: hidden;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink-faint);
  padding-left: 16px;
  border-left: 2px solid var(--line);
  margin-bottom: 26px;
  transition: border-color .4s;
}
#caption.live { border-color: var(--cyan); }
#caption span { color: var(--ink-faint); transition: color .18s; }
#caption span.sung { color: var(--ink); }
#caption span.now { color: var(--cyan); }
@media (max-width: 460px) { #caption { height: 4.8em; font-size: 16px; } }

/* ---------- knowledge ---------- */
#knowledge { position: relative; min-height: 90px; }
#k-empty {
  text-align: center; color: var(--ink-faint);
  font-size: 13px; padding: 30px 10px;
}
#k-empty .star { display: block; font-size: 20px; margin-bottom: 8px; opacity: .7; }
#k-empty p { max-width: 26ch; margin: 0 auto; }

/* related / cross-episode line under the card */
/* named connections: how this node relates to the rest of the story, in words */
#k-connections { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 6px 7px; align-items: baseline; }
#k-connections .conn-lead {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); width: 100%; margin-bottom: 1px;
}
#k-connections .conn {
  font: inherit; font-size: 12.5px; color: var(--ink-dim); cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid transparent; padding: 0; text-align: left;
}
#k-connections .conn:hover { color: var(--cyan); border-bottom-color: var(--cyan); }
#k-connections .conn .rel {
  font-family: var(--mono); font-size: 10.5px; color: var(--purple); font-style: normal;
}
#k-connections .conn.in .rel { color: var(--amber, #e6b17e); }
#k-connections .conn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

#k-related { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
#k-related .rel-line { font-size: 12px; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
#k-related .rel-line .lead { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
#k-related a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px solid transparent; cursor: pointer; }
#k-related a:hover { color: var(--cyan); border-bottom-color: var(--cyan); }
#k-related .heard a { color: var(--purple); }
#k-jump {
  align-self: flex-start;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  color: var(--cyan); background: none; border: none; cursor: pointer; padding: 2px 0;
}
#k-jump:hover { text-decoration: underline; }

/* continue listening */
#continue { margin-bottom: 26px; }
.cont-card {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 13px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line-soft); cursor: pointer;
  touch-action: pan-y; transition: transform .18s ease, opacity .18s ease;
}
.cont-card.heard { opacity: .5; }
.cont-card.swiping { transition: none; }
.cont-card.dismiss { transform: translateX(-110%); opacity: 0; }
.cont-card:first-of-type { border-top: none; }
.cont-card:hover .cont-title { color: var(--cyan); }
.cont-card img { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: var(--bg-lift); }
.cont-title { font-family: var(--serif); font-optical-sizing: auto; font-size: 15px; font-weight: 480; }
.cont-sub { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }
.cont-prog { width: 34px; height: 34px; }
.cont-x { background: none; border: none; color: var(--ink-faint); font-size: 15px; cursor: pointer; padding: 4px; }
.cont-x:hover { color: var(--ink); }

/* swipe-between-articles affordance */
#k-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 16px;
}
#k-nav button {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .02em;
  color: var(--ink-faint); padding: 2px 0; max-width: 46%;
  transition: color .15s;
}
#k-nav button:hover { color: var(--cyan); }
#k-nav button[disabled] { display: none; }
#k-nav .chev { font-size: 15px; line-height: 1; color: var(--ink-dim); }
#k-nav .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#k-next { margin-left: auto; text-align: right; }

/* main knowledge card — layout, not a box */
#k-card {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  padding: 4px 0 2px;
  animation: kIn .4s cubic-bezier(.2, .7, .3, 1);
  touch-action: pan-y;
  will-change: transform;
}
#k-card.swipe-left { animation: swipeL .28s ease; }
#k-card.swipe-right { animation: swipeR .28s ease; }
@keyframes swipeL { from { opacity: .3; transform: translateX(34px); } to { opacity: 1; transform: none; } }
@keyframes swipeR { from { opacity: .3; transform: translateX(-34px); } to { opacity: 1; transform: none; } }
@keyframes kIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#k-thumb {
  width: 84px; height: 84px; border-radius: 12px; object-fit: cover;
  background: var(--bg-lift);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
}
#k-card:not(:has(#k-thumb:not([hidden]))) { grid-template-columns: 1fr; }
.k-kicker {
  display: flex; gap: 12px; align-items: baseline;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 4px;
}
#k-type { color: var(--purple); }
#k-rel { color: var(--ink-faint); }
#k-card.hi #k-rel { color: var(--cyan); }
/* "jump to now" — appears when you're viewing an older node while playback moved on */
#k-live {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: color-mix(in srgb, var(--cyan) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 38%, transparent);
  border-radius: 999px; padding: 9px 15px; margin: 0 0 14px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; color: var(--cyan);
  transition: background .15s;
}
#k-live[hidden] { display: none; }
#k-live:hover { background: color-mix(in srgb, var(--cyan) 15%, transparent); }
#k-live .kl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); flex: none; animation: livepulse 1.5s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { #k-live .kl-dot { animation: none; } }
#k-live .kl-lead { text-transform: uppercase; letter-spacing: .12em; font-size: 10px; color: var(--ink-dim); }
#k-live .kl-name { flex: 1; min-width: 0; color: var(--ink); font-family: var(--sans); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#k-live .kl-arrow { color: var(--cyan); font-size: 14px; }

#k-title {
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: 22px; font-weight: 500; letter-spacing: -.015em; line-height: 1.15; margin-bottom: 4px;
}
#k-facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 11px; margin: 0 0 9px; }
#k-facts[hidden] { display: none; }
#k-dates { font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: var(--amber); font-variant-numeric: tabular-nums; }
#k-dates:empty { display: none; }
#k-role { font-size: 13.5px; color: var(--ink-dim); font-style: italic; }
#k-role:empty { display: none; }
#k-extract { font-size: 13.5px; color: var(--ink-dim); line-height: 1.55; max-height: 7.8em; overflow: hidden; }
#k-gloss {
  font-family: var(--serif); font-optical-sizing: auto; font-style: italic;
  font-size: 14.5px; line-height: 1.45; color: var(--cyan); margin-top: 8px;
}
#k-gloss:empty { display: none; }

/* meta strip — host / sources, transient & quiet */
#k-meta {
  display: flex; gap: 12px; align-items: center;
  text-decoration: none; color: inherit;
  padding: 8px 0; margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  opacity: .85;
  animation: kIn .35s ease;
}
#k-meta-thumb { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; filter: grayscale(.4); }
#k-meta .k-kicker { margin: 0; }
#k-meta .k-kicker span { color: var(--ink-faint); }
#k-meta-title { font-family: var(--serif); font-size: 15px; }
#k-meta-gloss { font-size: 11.5px; color: var(--ink-faint); }

/* rail — quiet inline tags, no pills */
#k-rail { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 22px; }
.chip {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em;
  color: var(--ink-faint); cursor: pointer;
  background: none; border: none; padding: 2px 0;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.chip:hover { color: var(--ink-dim); }
.chip.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.chip.hi-rel { color: var(--ink-dim); }
.chip.hi-rel.active { color: var(--cyan); }

/* ---------- always-on "when & where" strip ---------- */
#nowstrip {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}
#nowtime {
  flex: 1;
  height: 46px;
  min-width: 0;
  cursor: pointer;
}
#nowglobe {
  flex: none;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 40% 35%, #16233a, #05060f 75%);
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, .35);
  transition: box-shadow .2s, transform .1s;
}
#nowglobe:hover { box-shadow: 0 0 0 1px var(--cyan), 0 6px 22px rgba(99, 230, 211, .2); }
#nowglobe:active { transform: scale(.96); }

/* connections (web) — opt-in */
#web-open {
  display: block;
  margin: 22px 0 0;
  padding: 4px 0;
}

/* version row + changelog */
#set-version { width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line-soft); color: inherit; font: inherit; }
#version-line { font-family: var(--mono); font-size: 11px; letter-spacing: .03em; color: var(--ink-faint); }
#changelog-modal {
  position: fixed; inset: 0; z-index: 80; background: rgba(5, 6, 15, .72);
  display: flex; align-items: flex-end; justify-content: center;
}
#changelog-sheet {
  width: 100%; max-width: 620px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--bg-lift, #12121e); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; overflow: hidden;
}
#changelog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 12px; border-bottom: 1px solid var(--line-soft); flex: none;
}
#changelog-head h2 { font-family: var(--serif); font-size: 20px; font-weight: 500; }
#changelog-close { background: none; border: none; color: var(--ink-dim); font-size: 20px; cursor: pointer; }
#changelog-body { overflow-y: auto; padding: 8px 20px calc(28px + env(safe-area-inset-bottom)); }
#changelog-body h1 { display: none; } /* the sheet header already says it */
#changelog-body h2 {
  font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--ink);
  margin: 22px 0 4px; letter-spacing: -.01em;
}
#changelog-body h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); margin: 16px 0 4px; }
#changelog-body p { font-size: 13.5px; line-height: 1.55; color: var(--ink-dim); margin: 6px 0; }
#changelog-body ul { margin: 6px 0 10px; padding: 0; list-style: none; }
#changelog-body li { font-size: 13.5px; line-height: 1.5; color: var(--ink-dim); margin: 5px 0; padding-left: 16px; position: relative; }
#changelog-body li::before { content: '·'; position: absolute; left: 4px; color: var(--ink-faint); }
#changelog-body b { color: var(--ink); font-weight: 600; }
#changelog-body hr { border: none; border-top: 1px solid var(--line-soft); margin: 18px 0 4px; }
#changelog-body a { color: var(--cyan); }
#changelog-body .cl-img { width: 100%; border-radius: 10px; border: 1px solid var(--line-soft); margin: 10px 0; display: block; }

/* first-visit welcome */
#welcome-modal {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
#welcome-modal[hidden] { display: none; }
#welcome-sheet { max-width: 400px; text-align: center; }
#welcome-sheet .w-star { color: var(--amber); font-size: 34px; margin-bottom: 10px; }
#welcome-sheet h2 { font-family: var(--serif); font-size: 40px; font-weight: 500; letter-spacing: -.02em; }
#welcome-sheet .w-tag { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin: 6px 0 22px; }
#welcome-sheet .w-body { font-size: 15.5px; line-height: 1.6; color: var(--ink-dim); margin: 0 0 26px; }
#welcome-sheet .w-body b { color: var(--ink); }
#welcome-sheet .w-body em { font-style: italic; color: var(--cyan); }
#welcome-go {
  font-family: var(--mono); font-size: 13px; letter-spacing: .04em; color: var(--bg);
  background: var(--cyan); border: none; border-radius: 999px; padding: 12px 26px; cursor: pointer;
}

/* feedback row (a link styled like a setting) */
#set-feedback { text-decoration: none; }
#set-feedback .act:hover { color: var(--cyan); }

/* sign in */
#signin-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--cyan);
  background: none; border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent);
  border-radius: 999px; padding: 6px 13px; cursor: pointer; margin-left: auto; margin-right: 4px;
}
#signin-btn[hidden] { display: none; }
#signin-modal {
  position: fixed; inset: 0; z-index: 90; background: rgba(5, 6, 15, .72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#signin-modal[hidden] { display: none; }
#signin-sheet {
  width: 100%; max-width: 440px; padding: 22px;
  background: var(--bg-lift, #12121e); border: 1px solid var(--line); border-radius: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
#signin-head { display: flex; align-items: center; justify-content: space-between; }
#signin-head h2 { font-family: var(--serif); font-size: 21px; font-weight: 500; }
#signin-close { background: none; border: none; color: var(--ink-dim); font-size: 20px; cursor: pointer; }
.signin-lead { font-size: 13.5px; color: var(--ink-dim); line-height: 1.5; margin: 0; }
#signin-input {
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--bg-lift); border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 13px;
}
#signin-input:focus { outline: none; border-color: var(--cyan); }
.signin-row { display: flex; align-items: center; gap: 14px; }
#signin-go {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--cyan);
  background: none; border: 1px solid color-mix(in srgb, var(--cyan) 45%, transparent);
  border-radius: 10px; padding: 10px 18px; cursor: pointer;
}
#signin-status { font-family: var(--mono); font-size: 11px; color: var(--amber); }
.signin-note { font-size: 12px; color: var(--ink-faint); margin: 2px 0 0; }
#set-signout { width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line-soft); color: inherit; font: inherit; }
#set-signout[hidden] { display: none; }
#set-signout .act:hover { color: var(--coral, #e0736a); }

/* speed picker */
#speed-pop {
  position: fixed; right: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 70;
  width: 196px; padding: 12px;
  background: var(--bg-lift, #12121e); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; gap: 10px;
}
#speed-pop[hidden] { display: none; }
.sp-dial { display: flex; align-items: center; justify-content: space-between; }
.sp-dial button {
  width: 42px; height: 42px; border-radius: 11px; font-size: 24px; line-height: 1;
  background: none; border: 1px solid var(--line-soft); color: var(--ink); cursor: pointer;
  transition: background .12s, border-color .12s;
}
.sp-dial button:hover { border-color: var(--cyan); }
.sp-dial button:active { background: color-mix(in srgb, var(--cyan) 14%, transparent); }
#sp-val { font-family: var(--mono); font-size: 19px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.sp-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sp-presets button {
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim);
  background: none; border: 1px solid var(--line-soft); border-radius: 8px; padding: 7px 0; cursor: pointer;
  transition: color .12s, border-color .12s;
}
.sp-presets button.on { color: var(--cyan); border-color: var(--cyan); }
.sp-foot { display: flex; align-items: center; justify-content: space-between; }
#sp-step {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim);
  background: none; border: 1px solid var(--line-soft); border-radius: 999px; padding: 5px 11px; cursor: pointer;
}
#sp-step:hover { color: var(--ink); }
#sp-default { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--green, #7fd88f); }

/* full globe modal */
#globe-modal {
  position: fixed; inset: 0; z-index: 60;
  background: #05060f; /* fully opaque — nothing from the page bleeds through */
  display: flex;
}
#globe-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 16px; z-index: 4;
  background: rgba(11,11,20,.55); backdrop-filter: blur(6px); width: 36px; height: 36px; border-radius: 50%;
  border: none; color: var(--ink); font-size: 20px; cursor: pointer;
}
#globe-close:hover { color: var(--ink); }
/* the globe fills the whole modal — all available space */
#globe-modal #globe-box { position: relative; flex: 1; width: 100%; height: 100%; }
#globe-modal #globe { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; max-height: none; border-radius: 0; overflow: hidden; }

/* ---------- viz sections (no boxes) ---------- */
#tl-wrap, #web-wrap, #globe-wrap { margin-top: 8px; }

#timeline { touch-action: none; overflow: hidden; padding: 4px 0 2px; }
.tl-row { position: relative; height: 27px; cursor: pointer; border-radius: 5px; animation: tlin .4s ease; }
@keyframes tlin { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.tl-row.unseen { display: none; }
.tl-row:hover { background: rgba(236, 233, 228, .03); }
.tl-row.active { background: rgba(99, 230, 211, .06); }
.tl-track { position: absolute; inset: 0; }
.tl-name {
  position: absolute; top: 1px; right: 0;
  font-family: var(--mono); font-size: 9.5px; line-height: 13px;
  color: var(--ink-faint); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; pointer-events: none;
}
.tl-row.active .tl-name { color: var(--ink); }
.tl-row.sel .tl-name { color: var(--cyan); }
.tl-bar { position: absolute; top: 16px; height: 5px; border-radius: 3px; background: var(--cyan); opacity: .7; min-width: 2px; }
.tl-bar.span { background: var(--purple); }
.tl-bar.open { background: linear-gradient(90deg, var(--cyan) 70%, transparent); }
.tl-point { position: absolute; top: 15px; width: 7px; height: 7px; background: var(--purple); transform: rotate(45deg) translateX(-4px); border-radius: 1px; }
.tl-row.sel .tl-bar, .tl-row.sel .tl-point { background: var(--cyan); opacity: 1; }
.tl-axis { position: relative; height: 16px; border-top: 1px solid var(--line-soft); margin-top: 3px; }
.tl-tick { position: absolute; top: 3px; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); transform: translateX(-50%); }

/* wrap the canvas in a sized box so it always gets real pixel dimensions
   (aspect-ratio on a bare <canvas> collapses to 0 height in some mobile browsers) */
#web-box { position: relative; width: 100%; aspect-ratio: 4 / 3; }
#web-box.fs {
  position: fixed; inset: 0; z-index: 300; width: auto; height: auto;
  aspect-ratio: auto; background: var(--bg); padding: env(safe-area-inset-top) 4px 4px;
}
#web-box.fs #web { border-radius: 0; }
#web {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: grab; touch-action: none;
  border-radius: 14px; background: rgba(236, 233, 228, .02);
}

#globe-box { position: relative; }
#globe {
  width: 100%; aspect-ratio: 1 / 1; max-height: 56vh;
  border-radius: 14px; overflow: hidden; background: #05060f;
}
/* just a hint — must NOT capture pointer events, or drags never reach the Cesium
   canvas beneath it and the globe looks like a dead static map */
#globe-lock {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 16px;
  background: linear-gradient(transparent 60%, rgba(5, 6, 15, .35));
}
#globe-lock span {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: rgba(11, 11, 20, .7); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px;
}
#globe-done {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: rgba(11, 11, 20, .72); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; cursor: pointer;
}
#globe .cesium-widget-credits, #globe .cesium-viewer-bottom { display: none !important; }
#globe canvas { border-radius: 14px; }
#globe-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-faint); font-family: var(--mono); font-size: 12px; }
#globe-crumb {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(12px + env(safe-area-inset-top)); z-index: 3;
  display: flex; gap: 7px; align-items: center;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-dim);
  background: rgba(11, 11, 20, .66);
  backdrop-filter: blur(8px);
  border-radius: 999px; padding: 6px 14px;
  pointer-events: none; max-width: calc(100% - 84px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .35s;
}
#globe-crumb.show { opacity: 1; }
#globe-crumb .sep { color: var(--ink-faint); opacity: .6; }
#globe-crumb .cur { color: var(--cyan); }

#no-layer { text-align: center; color: var(--ink-faint); font-size: 13px; padding: 36px 16px; }
#no-layer .badge { color: var(--cyan); }

/* ---------- episode fingerprint ---------- */
.fp {
  display: block; width: 100%; max-width: 360px; margin-top: 12px;
  border-radius: 8px; cursor: zoom-in; opacity: .95;
}
.fp:hover { opacity: 1; }

#fp-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(7, 7, 14, .9); backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 20px 16px 48px;
}
#fp-sheet { width: 100%; max-width: 720px; animation: kIn .35s ease; }
#fp-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
#fp-modal-title { font-family: var(--serif); font-optical-sizing: auto; font-size: 22px; font-weight: 500; letter-spacing: -.015em; }
#fp-modal-sub { font-size: 12px; margin-top: 2px; }
#fp-close { background: none; border: none; color: var(--ink-dim); font-size: 20px; cursor: pointer; padding: 0 4px; }
#fp-close:hover { color: var(--ink); }
.fp-section-label { margin: 22px 0 8px; }
#fp-big-time, #fp-big-map { display: block; width: 100%; border-radius: 10px; }

/* ---------- player bar ---------- */
#playerbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(15, 15, 25, .82);
  backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#seek { position: relative; height: 12px; cursor: pointer; }
#seek-fill { position: absolute; left: 0; top: 5px; height: 2px; background: linear-gradient(90deg, var(--cyan), var(--purple)); width: 0; pointer-events: none; }
#seek-ticks { position: absolute; inset: 0; pointer-events: none; }
.tick { position: absolute; top: 4px; width: 1.5px; height: 5px; background: var(--purple); opacity: .5; }
#playerbar-row { display: flex; align-items: center; gap: 13px; padding: 8px var(--pad) 12px; max-width: 640px; margin: 0 auto; }
#pb-art { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--bg-lift); }
#pb-meta { flex: 1; min-width: 0; }
#pb-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pb-time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); letter-spacing: .04em; }
#pb-play {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--cyan); border: none; color: #08131a;
  cursor: pointer; transition: transform .12s, filter .15s;
  padding: 0;
}
#pb-play:hover { filter: brightness(1.08); }
#pb-play:active { transform: scale(.94); }
#pb-play svg { width: 18px; height: 18px; display: block; }
#pb-back15, #pb-fwd30, #pb-speed { background: none; border: none; color: var(--ink-dim); font-size: 11px; cursor: pointer; padding: 6px 4px; letter-spacing: .04em; }
#pb-back15:hover, #pb-fwd30:hover, #pb-speed:hover { color: var(--cyan); }
#pb-fwd30:focus-visible, #pb-back15:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- episode artwork (only when a feed has distinct per-episode art) ---------- */
.ep-card.has-art { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: start; }
.ep-card .ep-art { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: var(--bg-lift); margin-top: 3px; }

/* ---------- settings ---------- */
#gear {
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
  font-size: 15px; padding: 4px 2px; line-height: 1;
}
#gear:hover { color: var(--cyan); }
#settings-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(7, 7, 14, .82); backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
}
#settings-sheet {
  width: 100%; max-width: 560px;
  background: var(--bg-lift);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 20px var(--pad) calc(28px + env(safe-area-inset-bottom));
  animation: sheetUp .3s cubic-bezier(.2, .7, .3, 1);
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#settings-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
#settings-head h2 { font-family: var(--serif); font-optical-sizing: auto; font-size: 20px; font-weight: 500; }
#settings-close { background: none; border: none; color: var(--ink-dim); font-size: 20px; cursor: pointer; }
.setting {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--line-soft); cursor: pointer;
}
.setting-text { font-size: 14px; }
.setting-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.toggle {
  flex: none; width: 42px; height: 24px; border-radius: 13px;
  background: var(--line); border: none; position: relative; cursor: pointer; transition: background .2s;
}
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-dim); transition: transform .2s, background .2s; }
.toggle.on { background: rgba(99, 230, 211, .3); }
.toggle.on::after { transform: translateX(18px); background: var(--cyan); }

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