@import url("/app/assets/themes.css"); /* per-theme token overrides, split out to stay under the LOC cap */
/*
 * haiku.to — "constellation lineage"
 * A sumi-black void lit from within: poems glow soft-white in negative space,
 * lineage runs as luminous indigo light-trails, vermilion is reserved for the
 * remix "cut" + the author seal. Mono terminal chrome. Motion + glow over a
 * drifting starfield (assets/starfield.js). Cinematic depth, haiku calm.
 */

:root {
  --void:   #0a0d13;  /* near-black, cool indigo tint — the night */
  --void-2: #10151f;  /* raised panels */
  --ink:    #eae7f0;  /* soft near-white — poem text */
  --ai:     #6ea8ff;  /* electric indigo — the lineage light (glows) */
  --ai-dim: #3f6fd1;
  --cut:    #ff4a35;  /* vermilion glow — the remix "cut" + the hanko seal */
  --mist:   #6b7688;  /* dim mono chrome, meta */
  --line:   rgba(110, 168, 255, 0.16); /* hairlines / faint structure */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  "Helvetica Neue", Inter, -apple-system, system-ui, "Segoe UI", sans-serif;
  --mono:  "SF Mono", ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, monospace;

  --measure: 33rem;
  --glow-ai:  0 0 22px rgba(110, 168, 255, 0.35);
  --glow-cut: 0 0 20px rgba(255, 74, 53, 0.45);

  /* ---- component tokens (theme blocks below override these) ------------- */
  --halo: rgba(234, 231, 240, 0.14);          /* poem text glow color */
  --bg-aurora:
    radial-gradient(120% 60% at 50% 118%, rgba(63, 111, 209, 0.22) 0%, transparent 60%),
    radial-gradient(90% 50% at 50% -10%, rgba(110, 168, 255, 0.08) 0%, transparent 55%);
  --card-bg:
    radial-gradient(130% 92% at 3% 50%, rgba(90, 140, 240, 0.15), rgba(110, 168, 255, 0.04) 44%, transparent 74%),
    rgba(13, 17, 27, 0.42);
  --card-bg-hover:
    radial-gradient(130% 96% at 3% 50%, rgba(110, 160, 250, 0.22), rgba(110, 168, 255, 0.06) 46%, transparent 76%),
    rgba(16, 21, 32, 0.5);
  --card-border-c: rgba(110, 168, 255, 0.09);
  --card-inset: inset 52px 0 58px -40px rgba(63, 111, 209, 0.18);
  --breathe-a: inset 50px 0 56px -40px rgba(63, 111, 209, 0.15);
  --breathe-b: inset 64px 0 68px -36px rgba(90, 140, 240, 0.28);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  /* a faint indigo aurora bleeding up from the horizon, like remix.run's valley */
  background-image: var(--bg-aurora);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* the starfield canvas (assets/starfield.js) mounts here, behind everything */
#starfield { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ---- masthead — mono terminal chrome -------------------------------------*/

header[role="banner"] {
  position: relative;
  /* above the home page's falling-paper scene (#feed[data-scene="falling"],
     z-index: 1 -- see the scene rules below) so a drifting card can never
     sit visually over the masthead's nav and block a click. */
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid var(--line);
}
header[role="banner"] h1 {
  margin: 0;
  font: 700 1.1rem/1 var(--sans);
  letter-spacing: 0.38em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(110, 168, 255, 0.25);
}
header[role="banner"] h1 a { color: var(--ink); text-decoration: none; }
header[role="banner"] h1 a::first-letter { color: var(--cut); text-shadow: var(--glow-cut); }

header[role="banner"] nav {
  display: flex; flex-wrap: wrap; row-gap: 0.5rem; gap: 1.1rem;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
}
header[role="banner"] nav a { display: inline-block; padding: 0.3rem 0; color: var(--ai); text-decoration: none; opacity: 0.85; }
header[role="banner"] nav a::before { content: "["; color: var(--mist); }
header[role="banner"] nav a::after  { content: "]"; color: var(--mist); }
header[role="banner"] nav a:hover { opacity: 1; text-shadow: var(--glow-ai); }

/* ---- main column ---------------------------------------------------------*/

main { position: relative; z-index: 1; max-width: var(--measure); margin: 0 auto; padding: 4rem 1.5rem 7rem; }
/* ID selector, not tag-qualified, so it applies whether the feed's host
   element is index.html's <main id="feed"> or lab.html's <div id="feed">
   (the lab page's own <main> is the lab panel, not the feed preview). */
#feed { max-width: 38rem; }

/* ---- the poem (hero) — glowing in the dark -------------------------------*/

/* poems float in a soft pool of ink — a calm luminous wash behind the text,
   so each poem glows from within the water (quiet, haiku restraint) */
[data-testid="poem"], .haiku-card {
  position: relative; margin: 0 0 3rem; padding: 1rem 1.6rem 1.2rem 1.7rem;
  /* frosted glass: a soft indigo pool over a semi-opaque pane that BLURS the
     ink/ripples flowing behind it, so the effects never sit sharp under the
     text — legible + still alive underneath */
  background: var(--card-bg);
  backdrop-filter: blur(7px) saturate(1.1);
  -webkit-backdrop-filter: blur(7px) saturate(1.1);
  border: 1px solid var(--card-border-c); border-left: none;
  border-radius: 0 1.1rem 1.1rem 0;
  box-shadow: var(--card-inset);
  transition: background 0.5s ease, transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
[data-testid="poem"]:hover, .haiku-card:hover {
  background: var(--card-bg-hover);
}
/* whole feed card is the click target, not just the text (stretched link:
   the poem <a> covers the card; the byline is plain text so this is safe) */
.haiku-card > a[data-testid^="haiku-poem"]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
/* the lineage spine: a luminous indigo thread with bloom */
[data-testid="poem"]::before, .haiku-card::before {
  content: ""; position: absolute; left: 0; top: 0.3rem; bottom: 0.3rem; width: 2px;
  background: linear-gradient(to bottom, var(--ai) 0%, var(--ai-dim) 82%, transparent 100%);
  box-shadow: var(--glow-ai);
  border-radius: 2px;
}
.haiku, [data-testid="poem-lines"] {
  white-space: pre-line; margin: 0; overflow-wrap: anywhere;
  font-family: var(--serif); font-size: clamp(1.15rem, 1rem + 2vw, 1.65rem); line-height: 2.1; letter-spacing: 0.005em;
  color: var(--ink); text-shadow: 0 0 26px var(--halo);
}
.haiku-card .haiku, .haiku-card [data-testid^="haiku-poem"] { font-size: 1.32rem; line-height: 1.95; }

@media (prefers-reduced-motion: no-preference) {
  [data-testid="poem-lines"] { animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(0.6rem); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
  /* the ink pool behind each poem gently breathes (calm, ~7s) */
  [data-testid="poem"] { animation: breathe 7s ease-in-out infinite; }
  @keyframes breathe {
    0%, 100% { box-shadow: var(--breathe-a); }
    50% { box-shadow: var(--breathe-b); }
  }
  /* feed cards wash in on load, staggered, then breathe */
  .haiku-card { animation: rise 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) both, breathe 7s ease-in-out infinite; }
  .haiku-card:nth-child(1) { animation-delay: 0.03s; }
  .haiku-card:nth-child(2) { animation-delay: 0.11s; }
  .haiku-card:nth-child(3) { animation-delay: 0.19s; }
  .haiku-card:nth-child(4) { animation-delay: 0.27s; }
  .haiku-card:nth-child(5) { animation-delay: 0.35s; }
  .haiku-card:nth-child(n + 6) { animation-delay: 0.42s; }
}
/* feed card hover: the poem leans toward you + its spine kindles (pairs with
   the water ripple starfield.js raises from the card on pointer-over) */
.haiku-card { transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.haiku-card:hover { transform: translateX(5px); }
.haiku-card:hover::before { box-shadow: 0 0 16px 1px var(--ai), 0 0 44px var(--ai-dim); }

/* ---- spine roots — glowing depth by descendant_count ---------------------*/
/* `data-roots` (haiku.js/library.js, bucketed via the shared
   `lineage-depth.js#bucketRoots` from `descendant_count` -- the haiku page
   reads it off `getHaikuLive()`, the feed reads it directly off each feed
   row, which already carries the count: 0 -> childless/no remixes, 1-2,
   3-6, 7+) grows a small root system off the spine's lower terminus -- the
   more a poem has been remixed, the deeper its roots. Applies to both the
   poem hero spine AND each `.haiku-card` in the library feed, so the feed
   reads as a field of poems with visible lineage depth too.
   `data-roots="0"` is the plain spine, no ::after at all. Each root is an
   SVG data-URI used purely as an alpha mask (the stroke value inside it is
   irrelevant to the final render) painted via `background-color`, so the
   glow color always comes from --ai -- never a baked hex. */
[data-testid="poem"][data-roots="1"]::after,
[data-testid="poem"][data-roots="2"]::after,
[data-testid="poem"][data-roots="3"]::after,
.haiku-card[data-roots="1"]::after,
.haiku-card[data-roots="2"]::after,
.haiku-card[data-roots="3"]::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0.15rem;
  transform: translate(-50%, 55%);
  transform-origin: top center;
  background-color: var(--ai);
  box-shadow: var(--glow-ai);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: top center;
  mask-position: top center;
  -webkit-mask-size: contain;
  mask-size: contain;
  pointer-events: none;
}
[data-testid="poem"][data-roots="1"]::after,
.haiku-card[data-roots="1"]::after {
  width: 1.3rem; height: 1.3rem; opacity: 0.55;
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 4 Q14 16 11 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/><path d='M20 4 Q26 16 29 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/></svg>");
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 4 Q14 16 11 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/><path d='M20 4 Q26 16 29 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/></svg>");
}
[data-testid="poem"][data-roots="2"]::after,
.haiku-card[data-roots="2"]::after {
  width: 1.6rem; height: 1.6rem; opacity: 0.7;
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 4 Q11 16 7 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/><path d='M20 4 Q20 20 20 34' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/><path d='M20 4 Q29 16 33 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/></svg>");
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 4 Q11 16 7 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/><path d='M20 4 Q20 20 20 34' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/><path d='M20 4 Q29 16 33 30' stroke='currentColor' stroke-width='2.5' fill='none' stroke-linecap='round'/></svg>");
}
[data-testid="poem"][data-roots="3"]::after,
.haiku-card[data-roots="3"]::after {
  width: 2rem; height: 2rem; opacity: 0.85;
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 4 Q9 15 4 27' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q14 18 11 35' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q20 22 20 38' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q26 18 29 35' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q31 15 36 27' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/></svg>");
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 4 Q9 15 4 27' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q14 18 11 35' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q20 22 20 38' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q26 18 29 35' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/><path d='M20 4 Q31 15 36 27' stroke='currentColor' stroke-width='2.25' fill='none' stroke-linecap='round'/></svg>");
}
@media (prefers-reduced-motion: no-preference) {
  [data-testid="poem"][data-roots="1"]::after,
  [data-testid="poem"][data-roots="2"]::after,
  [data-testid="poem"][data-roots="3"]::after,
  .haiku-card[data-roots="1"]::after,
  .haiku-card[data-roots="2"]::after,
  .haiku-card[data-roots="3"]::after {
    animation: rootsGrow 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  @keyframes rootsGrow {
    from { transform: translate(-50%, 55%) scaleY(0); }
    to   { transform: translate(-50%, 55%) scaleY(1); }
  }
}

/* ---- byline / seal / meta — mono -----------------------------------------*/

.counts, [data-testid="byline"], [data-testid^="haiku-meta"], [data-testid="lineage-summary"] {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em; color: var(--mist); margin: 0.7rem 0 0;
}
[data-testid="byline"]::before, [data-testid^="haiku-meta"]::before {
  content: ""; display: inline-block; width: 0.6em; height: 0.6em; margin-right: 0.6em;
  background: var(--cut); box-shadow: var(--glow-cut); border-radius: 1px; vertical-align: 0.02em;
}
[data-testid="lineage-summary"] { margin-top: 1.9rem; color: var(--ai); }

/* author @-references in the byline (a composite splice lists each source poet) */
.author-link { color: inherit; text-decoration: none; }
.author-link:hover { color: var(--ai); text-shadow: var(--glow-ai); }
/* lift author links above the feed card's stretched poem-link overlay so they
   go to the poet's page instead of the poem */
.haiku-card .author-link { position: relative; z-index: 1; }

.haiku-card a, [data-testid^="haiku-card"] a { color: inherit; text-decoration: none; }
.haiku-card { border-bottom: 1px solid var(--line); padding-bottom: 2.5rem; }

/* ---- tag chips -------------------------------------------------------*/
/* dim mono chips (no new hex -- --mist at rest, --ai on hover, same as the
   remix-bar/author-link chrome); wrap freely, never overflow. */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.7rem 0 0; }
.tag-chip {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em;
  color: var(--mist); text-decoration: none; padding: 0.2rem 0.6rem;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(110, 168, 255, 0.03);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.tag-chip:hover { color: var(--ai); border-color: var(--ai-dim); box-shadow: var(--glow-ai); }
/* lift tag chips above the feed card's stretched poem-link overlay (same
   fix as .haiku-card .author-link) so a chip click filters the feed
   instead of opening the poem underneath it. */
.haiku-card .tag-chip { position: relative; z-index: 1; }

/* ---- feed tag filter header -------------------------------------------*/
[data-testid="feed-tag-header"] {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--mist);
  margin: 0 0 2rem;
}
[data-testid="feed-tag-clear"] { color: var(--ai); text-decoration: none; margin-left: 0.4rem; }
[data-testid="feed-tag-clear"]:hover { text-shadow: var(--glow-ai); }

/* ---- home falling-paper scene ---------------------------------------------
   The home page's motion path (library.js#renderFalling) turns `#feed` itself
   into a full-viewport scene: each `.haiku-card` is the SAME frosted panel
   `card()` builds for the static feed/author lists (byline, tags, spine,
   testids -- all reused verbatim), laid out on one circular, endlessly
   looping column (poem `i` at a fixed `basePos`, wrapped by the current
   `scroll` into on-screen Y -- see that module's doc comment) -- there is no
   first/last poem, and the column is ALWAYS falling, even with no input. A
   rAF loop writes a per-frame `transform: translate(x,y) rotate(deg)` (the
   poem's wrapped position, plus a purely cosmetic breeze sway/bob/wobble on
   top) directly as an inline style; nothing else is animated per-frame, so
   this stays cheap despite the backdrop-filter each card already carries.
   Everything here is scoped to `[data-scene="falling"]` (set only by
   renderFalling) so the reduced-motion static list (renderFeed) -- and any
   other `.haiku-card` use, e.g. elsewhere in the app -- keeps its ordinary
   stacked-list layout untouched. */
#feed[data-scene="falling"] {
  position: fixed;
  inset: 0;
  z-index: 1;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* the whole scene is the scroll surface (library.js delegates pointer-drag
     scroll here, not per-card) -- a grabbable-paper affordance, and no
     native touch-scroll/text-selection to fight the custom scroll. */
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  /* kill the iOS long-press link preview/callout on the poem <a>s -- a hold is
     the start of a scroll drag here, not a request to preview the link. */
  -webkit-touch-callout: none;
}
/* while a drag is in progress (library.js sets/clears this each
   pointerdown/release): the "grabbing" cursor doubles as scroll-in-progress
   feedback. */
#feed[data-scene="falling"][data-dragging] { cursor: grabbing; }
/* the tag filter header/clear + the error alert float above the circular
   cards (position:absolute cards would otherwise paint over a position:static
   sibling regardless of DOM order) */
[data-scene="falling"] [data-testid="feed-tag-header"],
[data-scene="falling"] [data-testid="feed-error"] {
  position: relative;
  z-index: 2;
  margin: 1.2rem 1.5rem 0;
}
[data-scene="falling"] [data-testid="feed-list"] { position: absolute; inset: 0; }
[data-scene="falling"] .haiku-card {
  position: absolute;
  top: 0;
  left: 0;
  max-width: min(22rem, 86vw);
  margin: 0;
  padding-bottom: 1.2rem;
  border-bottom: none;
  will-change: transform;
  /* the static list's rise-in/breathe entrance animation (below, under
     prefers-reduced-motion: no-preference -- which is exactly when this
     scene renders) targets `transform`, and a CSS animation always outranks
     an element's own inline style for the same property -- left alone it
     would silently freeze every card's `transform` at the animation's final
     frame, undoing the scroll loop. The breeze sway/bob/wobble the loop
     already writes is motion enough, so the entrance animation is dropped. */
  animation: none;
  /* the rAF loop writes `transform` every frame; the base .haiku-card's
     `transition: transform` would animate each write, most visibly a big
     jump the instant a card is un-culled back into view. Transition only
     the hover glow. */
  transition: box-shadow 0.4s ease;
  /* a poem's own link must never start a native drag/selection -- scrolling
     is handled entirely by the scene-level pointer listeners. */
  user-select: none;
  -webkit-user-select: none;
}

/* ---- grab pop-out -- iOS-style pop when a card is picked up ---------------
   library.js's long-press sets `[data-held]` on the grabbed card (and pauses
   its ambient fall). `--feed-pop-scale` is written by library.js every frame
   off `window.HaikuFeed.get().popScale` (feed-tunables.ts), so this is live-
   tunable with no reload despite being pure CSS: `scale` is its OWN
   transform-related property (distinct from `transform`), so it composes
   with the `transform: translate(...) rotate(...)` library.js writes as an
   inline style every frame instead of fighting it (an inline `transform`
   always wins over a stylesheet `transform` on the same element/property,
   but `scale` doesn't touch that property at all). */
[data-scene="falling"] .haiku-card[data-held] {
  scale: var(--feed-pop-scale, 1.08);
  z-index: 3;
  box-shadow: 0 20px 48px -14px rgba(0, 0, 0, 0.6), 0 0 36px rgba(110, 168, 255, 0.4);
}

/* ---- born-from -----------------------------------------------------------*/

[data-testid="born-from"] { margin: 2.75rem 0 0; }
[data-testid="born-from"] h2 { font: 400 0.7rem/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--mist); margin: 0 0 0.75rem; }
[data-testid="born-from-list"] { list-style: none; margin: 0; padding: 0; }
[data-testid="born-from-list"] li { margin: 0 0 0.4rem; padding-left: 1.2rem; position: relative; }
[data-testid="born-from-list"] li::before { content: "\21B3"; position: absolute; left: 0; color: var(--ai); text-shadow: var(--glow-ai); }
[data-testid="born-from-list"] a { color: var(--ai); text-decoration: none; font-family: var(--serif); }
[data-testid="born-from-list"] a:hover { text-shadow: var(--glow-ai); }

/* ---- remix bar — the "cut" -----------------------------------------------*/

[data-testid="remix-bar"] { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2.75rem 0 0; padding-top: 1.9rem; border-top: 1px solid var(--line); }
[data-testid="remix-bar"] a {
  font: 400 0.72rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ai); text-decoration: none; padding: 0.55rem 0.9rem;
  border: 1px solid var(--line); border-radius: 2px; background: rgba(110, 168, 255, 0.03);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
[data-testid="remix-bar"] a:hover { color: var(--cut); border-color: var(--cut); box-shadow: var(--glow-cut); background: rgba(255, 74, 53, 0.06); }

/* ---- forms (compose / remix) ---------------------------------------------*/

form { margin: 0; }
label { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mist); margin: 1.4rem 0 0.4rem; }
input[type="text"], textarea, select {
  font: 1.3rem/1.9 var(--serif); color: var(--ink); width: 100%;
  background: transparent; border: none; border-bottom: 1px solid var(--line); padding: 0.4rem 0; border-radius: 0;
}
input[type="text"]::placeholder, textarea::placeholder { color: var(--mist); opacity: 0.5; }
input[type="text"]:focus, textarea:focus, select:focus { outline: none; border-bottom-color: var(--ai); box-shadow: 0 1px 0 0 var(--ai), var(--glow-ai); }
select { font-size: 1rem; }
select option { background: var(--void-2); color: var(--ink); }
textarea { resize: vertical; }
input[type="checkbox"] { accent-color: var(--ai); margin-right: 0.5rem; }

/* ---- settings (save confirmation / guarded delete) -----------------------*/

[data-testid="settings-success"] {
  color: var(--ai); font-family: var(--mono); font-size: 0.82rem; margin: 1.6rem 0 0;
  padding-left: 0.9rem; border-left: 2px solid var(--ai); box-shadow: -1px 0 12px -6px var(--ai);
}
[data-testid="delete-section"] { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
[data-testid="delete-panel"] { margin-top: 1rem; }
[data-testid="delete-account"], [data-testid="delete-confirm"] { background: var(--cut); box-shadow: var(--glow-cut); }
[data-testid="delete-account"]:hover, [data-testid="delete-confirm"]:hover { filter: brightness(1.15); box-shadow: 0 0 30px rgba(255, 74, 53, 0.6); }

[data-testid="syllable-counter"] { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.12em; color: var(--mist); margin: 1.4rem 0; }
[data-testid="syllable-counter"][data-valid="true"]  { color: var(--ai); text-shadow: var(--glow-ai); }
[data-testid="syllable-counter"][data-valid="false"] { color: var(--cut); }

button, [type="submit"] {
  font: 400 0.75rem/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; cursor: pointer;
  color: var(--void); background: var(--ai); border: none; border-radius: 2px; padding: 0.8rem 1.6rem; margin-top: 1.9rem;
  box-shadow: var(--glow-ai); transition: background 0.15s, box-shadow 0.15s;
}
button:hover, [type="submit"]:hover { background: #8bbaff; box-shadow: 0 0 30px rgba(110, 168, 255, 0.6); }
button:disabled { background: var(--mist); box-shadow: none; cursor: not-allowed; }

/* ---- identity heading (account / author) ---------------------------------*/
/* `@handle` is the one large, confident heading on these two pages -- the
   name, not chrome -- so it stays plain/bold/sans rather than picking up the
   small tracked-mono treatment the section labels below it use. Unifying the
   two pages' otherwise-identical h2 here (rather than leaving it to browser
   UA defaults) keeps their vertical rhythm into the stats grid identical. */
[data-testid="account-handle"], [data-testid="author-handle"] {
  font: 700 1.6rem/1.25 var(--sans);
  letter-spacing: 0.01em;
  margin: 0 0 0.3rem;
}
[data-testid="account-email"] {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em;
  color: var(--mist); margin: 0 0 1.8rem;
}

/* the settings link + sign-out control read as one deliberate row of
   controls, not two unrelated fragments crowded onto one line -- the link
   picks up the same bordered "pill" chrome as the remix-bar so it carries
   equal visual weight to the button beside it. */
[data-testid="account-controls"] {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.9rem;
  margin: 0.4rem 0 2.5rem;
}
[data-testid="account-controls"] [data-testid="nav-settings"],
[data-testid="account-controls"] [data-testid="nav-manage"] {
  font: 400 0.72rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: 2px;
  background: rgba(110, 168, 255, 0.03);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
[data-testid="account-controls"] [data-testid="nav-settings"]:hover,
[data-testid="account-controls"] [data-testid="nav-manage"]:hover {
  border-color: var(--ai); box-shadow: var(--glow-ai); background: rgba(110, 168, 255, 0.06); text-shadow: none;
}
[data-testid="account-controls"] [data-testid="signout"] {
  margin-top: 0; background: transparent; color: var(--mist);
  border: 1px solid var(--line); box-shadow: none;
}
[data-testid="account-controls"] [data-testid="signout"]:hover {
  color: var(--ink); border-color: var(--ai); box-shadow: var(--glow-ai); background: rgba(110, 168, 255, 0.06);
}

/* ---- stats (author / account) — a glowing ledger -------------------------*/

dl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 1.75rem 1.25rem; margin: 2.25rem 0;
}
/* the `dl` rule above sets `display: grid` with author-stylesheet priority,
   which would otherwise defeat the UA stylesheet's `[hidden] { display:
   none }` default (author rules win over UA rules regardless of
   specificity) -- explicitly restore hidden-means-hidden for any `dl`
   (e.g. the author page's `?credit=` view, which hides the per-account
   stats tile row since a free-text credit has no stats rollup). */
dl[hidden] { display: none; }
dl > div { min-width: 0; }
dt { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mist); }
dd {
  margin: 0.3rem 0 0; font-family: var(--mono); font-size: 1.9rem; color: var(--ink);
  text-shadow: 0 0 20px rgba(110, 168, 255, 0.2); overflow-wrap: anywhere;
}

main h3 { font: 700 1rem/1.3 var(--sans); color: var(--ink); margin: 2.5rem 0 0.9rem; }

[data-testid^="author-node"] { font-family: var(--serif); }
main ul { list-style: none; margin: 0; padding: 0; }
main li { margin: 0 0 0.5rem; }
main a { color: var(--ai); text-decoration: none; }
main a:hover { text-shadow: var(--glow-ai); }

/* by-mode reads as a tidy wrapped row of mono chips rather than a stacked
   list -- "syllable: 3   renga: 2   splice: 2" side by side. Shared by both
   author.js and account.js, which render the identical list shape. */
[data-testid="by-mode-list"] {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.03em; color: var(--mist);
}
[data-testid="by-mode-list"] li { margin: 0; }

[data-testid="author-works"] li { margin: 0 0 0.9rem; line-height: 1.5; }

/* the "none yet" / "no works yet" empty states (author.js/account.js tag
   these `data-testid="empty-state"`) read as dim + italic -- an absence, not
   just another row of content. */
[data-testid="empty-state"] {
  color: var(--mist); font-style: italic; opacity: 0.8;
}

/* ---- manage (your poems) --------------------------------------------------*/

[data-testid="manage-empty"] { color: var(--mist); font-style: italic; opacity: 0.8; }

[data-testid="manage-list"] { list-style: none; margin: 1.5rem 0 0; padding: 0; }
[data-testid="manage-list"] > li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
[data-testid="manage-list"] > li a { font-family: var(--serif); color: var(--ai); overflow-wrap: anywhere; }
[data-testid="manage-list"] > li button {
  margin: 0; background: var(--cut); box-shadow: var(--glow-cut);
}
[data-testid="manage-list"] > li button:hover { filter: brightness(1.15); box-shadow: 0 0 30px rgba(255, 74, 53, 0.6); }
[data-testid="manage-list"] > li [role="alert"] {
  flex-basis: 100%; margin: 0.3rem 0 0; padding-left: 0; border-left: none; box-shadow: none;
}

@media (max-width: 480px) {
  dl { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1rem; }
}

/* ---- lineage tree — the river of light ------------------------------------*/

[data-testid="lineage-tree"] { margin: 1.5rem 0 0; max-width: 100%; overflow-x: auto; }
.lineage-tree { display: block; width: 100%; height: auto; }
.lineage-node { cursor: pointer; }
.lineage-node text { font-family: var(--mono); pointer-events: none; }
.lineage-node:hover .lineage-node-dot,
.lineage-node:focus-visible .lineage-node-dot { filter: url(#lineage-glow) brightness(1.3); }
.lineage-node:focus-visible { outline: none; }
/* One intentional focus-glow opacity (0.75) used everywhere the focus ring
   glow's brightness is set -- the static base below, the reduced-motion
   fallback, and the animated pulse's peak all agree on 0.75 (was previously
   three slightly different values: 0.8 base / 0.75 reduced / 0.35<->0.75
   pulse -- now the base and the pulse's resting/peak state read the same
   under every motion preference). */
.lineage-node:focus-visible .lineage-node-glow { stroke: var(--ink); opacity: 0.75; }

/* the draw-in (stroke-dashoffset via JS) and the node fade/scale-in are set
   up in lineage-tree.js only when the user has no reduced-motion preference
   (see `prefersReducedMotion()`); the trail/glow strength itself (below) is
   not motion, so it always applies. */
@media (prefers-reduced-motion: no-preference) {
  /* a gentle "breathing" glow on hover/focus -- purely decorative, gated
     alongside the rest of the motion in this file. */
  .lineage-node:hover .lineage-node-glow,
  .lineage-node:focus-visible .lineage-node-glow {
    animation: lineage-node-pulse 1.6s ease-in-out infinite;
  }
  @keyframes lineage-node-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.75; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .lineage-node:hover .lineage-node-glow,
  .lineage-node:focus-visible .lineage-node-glow {
    opacity: 0.75;
  }
}

/* ---- lineage view toggle (tree | graph) -----------------------------------*/

.lineage-view-toggle { display: flex; gap: 0.6rem; margin: 1rem 0 0; }
.lineage-view-toggle button {
  background: transparent; border: 1px solid var(--line); color: var(--mist);
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em;
  padding: 0.35rem 0.9rem; border-radius: 999px; cursor: pointer;
}
.lineage-view-toggle button:hover { color: var(--ink); border-color: var(--ai-dim); }
.lineage-view-toggle button:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }
.lineage-view-toggle button[aria-pressed="true"] {
  color: var(--ink); border-color: var(--ai); box-shadow: var(--glow-ai);
}

/* ---- lineage graph — node-link DAG view -----------------------------------*/

[data-testid="lineage-graph"] {
  margin: 1.5rem 0 0; max-width: 100%; max-height: 70vh; overflow: auto;
}
[data-testid="lineage-graph"][hidden] { display: none; }
.lineage-graph-svg { display: block; width: 100%; height: auto; }
[data-testid="lineage-graph-note"] { color: var(--mist); font-family: var(--mono); font-size: 0.85rem; }

/* ---- metrics (signal) — request table -------------------------------------*/

[data-testid="metrics-table-scroll"] { max-width: 100%; overflow-x: auto; margin: 1.5rem 0; }
[data-testid="metrics-table"] {
  width: 100%; min-width: 34rem; border-collapse: collapse;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.01em;
}
[data-testid="metrics-table"] th, [data-testid="metrics-table"] td {
  text-align: left; padding: 0.55rem 0.9rem 0.55rem 0; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
[data-testid="metrics-table"] th {
  color: var(--mist); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.66rem;
}
[data-testid="metrics-table"] td { color: var(--ink); }
[data-testid="metrics-overall"] {
  font-family: var(--mono); font-size: 0.82rem; color: var(--ai); margin: 1.4rem 0 0; text-shadow: var(--glow-ai);
}

/* the account page's owner-only link to the metrics dashboard -- deliberately
   quiet: no pill chrome, no glow, just a dim mono line beneath the main
   account controls, so it reads as an internal aside rather than a feature
   any visitor is meant to notice. */
[data-testid="nav-metrics"] {
  display: inline-block; margin: 0.5rem 0 0;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em;
  color: var(--mist); text-decoration: none; opacity: 0.7;
}
[data-testid="nav-metrics"]:hover { opacity: 1; color: var(--ai); }

/* ---- fx + feed lab (live tuning panels, /app/lab.html) --------------------*/
/* A quiet instrument panel, not a feature page -- mono labels/values like the
   rest of the site's meta chrome, sliders tinted --ai, Reset styled like the
   settings page's low-key controls. The feed lab section (below the fx one)
   mirrors it exactly; both sit above a *live* falling-feed preview
   (library.js, mounted at #feed behind this panel -- see the #feed[data-scene]
   rules above), so the panel itself needs a frosted, opaque-enough backing to
   stay legible over the moving cards. */

[data-testid="lab-main"] {
  position: relative;
  /* above #feed[data-scene="falling"]'s z-index: 1 background preview. */
  z-index: 2;
  background: rgba(10, 13, 19, 0.74);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 48px 12px rgba(10, 13, 19, 0.74);
}
[data-testid="lab-main"] h2 { font: 700 1.3rem/1.3 var(--sans); margin: 0 0 0.5rem; }
/* the fx/feed sections are visually separated so two full slider stacks read
   as distinct instrument panels rather than one long undifferentiated list. */
[data-testid="lab-main"] section + section {
  margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line);
}

[data-testid="lab-instructions"], [data-testid="feed-lab-instructions"] {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em; color: var(--mist); margin: 0 0 2rem;
}

[data-testid="fx-controls"], [data-testid="feed-controls"] { display: flex; flex-direction: column; gap: 1.1rem; max-width: 100%; }
.fx-row { display: grid; grid-template-columns: 9rem 1fr 4.5rem; align-items: center; gap: 0.75rem; max-width: 100%; }
.fx-row label { margin: 0; font-size: 0.68rem; }
.fx-row input[type="range"] { width: 100%; max-width: 100%; accent-color: var(--ai); }
.fx-row .fx-value {
  font-family: var(--mono); font-size: 0.75rem; color: var(--ink); text-align: right; overflow-wrap: anywhere;
}

/* the feed lab's 25 sliders are grouped by concern (Fall, Sway/tilt, Scroll,
   Grab/throw) under these sub-headings -- usability over one long flat list. */
.feed-group-heading {
  margin: 1.5rem 0 0.2rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--line);
  font: 700 0.82rem/1.3 var(--sans); letter-spacing: 0.04em; color: var(--ai); text-shadow: var(--glow-ai);
}
.feed-group-heading:first-child { margin-top: 0; }

[data-testid="fx-actions"], [data-testid="feed-actions"] { display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 2rem 0 1.5rem; }
[data-testid="fx-reset"], [data-testid="feed-reset"] { margin-top: 0; background: transparent; color: var(--mist); border: 1px solid var(--line); box-shadow: none; }
[data-testid="fx-reset"]:hover, [data-testid="feed-reset"]:hover { color: var(--ink); border-color: var(--ai); box-shadow: var(--glow-ai); background: rgba(110, 168, 255, 0.06); }
[data-testid="fx-copy"], [data-testid="feed-copy"] { margin-top: 0; }

[data-testid="fx-json"], [data-testid="feed-json"] {
  font-family: var(--mono); font-size: 0.75rem; line-height: 1.6; color: var(--mist);
  background: var(--void-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 1rem; max-width: 100%; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}

@media (max-width: 480px) {
  .fx-row { grid-template-columns: 1fr; row-gap: 0.3rem; }
  .fx-row .fx-value { text-align: left; }
}

/* ---- errors --------------------------------------------------------------*/

[role="alert"], .err {
  color: var(--cut); font-family: var(--mono); font-size: 0.82rem; margin: 1.6rem 0 0;
  padding-left: 0.9rem; border-left: 2px solid var(--cut); box-shadow: -1px 0 12px -6px var(--cut);
}
[data-testid="rate-limit-claim"] { color: var(--ai); }

/* ---- responsive ----------------------------------------------------------*/
/* Mobile-first breakpoints: 480px (phones -- masthead stacks, poem settles
   to its mobile size, touch targets grow) and 768px (a gentler mid-tier
   tightening of the header/main padding for small tablets/large phones in
   landscape, between the phone stack and the full desktop measure). Nothing
   here changes the reading column's max-width -- `main`/`header` already cap
   at `--measure`/60rem and center, so the same breakpoints apply identically
   whether the viewport is 768px or 1920px. */

@media (max-width: 768px) {
  header[role="banner"] { padding: 1.2rem 1.25rem 0.9rem; }
  main { padding-left: 1.25rem; padding-right: 1.25rem; }
}

@media (max-width: 480px) {
  .haiku, [data-testid="poem-lines"] { font-size: 1.4rem; line-height: 1.95; }
  header[role="banner"] { flex-direction: column; gap: 0.6rem; align-items: flex-start; }
  main { padding-top: 2.75rem; }

  /* touch targets: form submit buttons go full-width and grow to a
     comfortable >=44px tap height; the remix-bar's compact chrome pills get
     a little more breathing room too, without ballooning into full buttons. */
  form button[type="submit"] { width: 100%; }
  button, [type="submit"] { min-height: 44px; padding: 0.9rem 1.6rem; }
  [data-testid="remix-bar"] a { padding: 0.7rem 1rem; }

  [data-testid="account-controls"] { gap: 0.75rem; }
}

:focus-visible { outline: 2px solid var(--ai); outline-offset: 3px; }
