/* Spark companion — the companions page and the corner presence.
 * Uses the living layer's palette where it is loaded, with the
 * Codex night colours as the fallback so it stands on its own. */

:root {
  --spark-ink: var(--living-ink, #e8ecf6);
  --spark-dim: var(--living-dim, #a7b0c6);
  --spark-gold: var(--lnav-gold, #d9a441);
  --spark-teal: #2dd4bf;
  --spark-card: rgba(16, 22, 38, 0.72);
  --spark-line: rgba(217, 164, 65, 0.35);
}

/* ---------- the roaming presence ---------- */

/* The field the Spark roams in: the whole screen, fixed, and it
 * takes no clicks at all — only the Spark itself does. */
.spark-presence {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  /* Above the site's chrome (its sticky header rides at 900,
   * its skip link at 1000): their panel must never sit under a
   * floating menu button (Aaron's phone review, Nov 19,
   * 2026). The layer itself takes no pointer events — only
   * their own furniture does — so the nav beneath stays fully
   * usable wherever they are not. */
  z-index: 10040;
  pointer-events: none;
  font-family: inherit;
}

/* The bubble floats above the Spark itself, so the roaming
 * walker's own box never changes size when it opens; up near
 * the top of the screen it opens below instead. */
.spark-walker .spark-presence-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
}

.spark-walker.bubble-below .spark-presence-bubble {
  bottom: auto;
  top: calc(100% + 8px);
}

.spark-walker {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  will-change: transform;
}

.spark-walker .spark-presence-button,
.spark-walker .spark-presence-bubble {
  pointer-events: auto;
}

.spark-presence-art.is-walking svg {
  animation: spark-walk-bob 0.36s ease-in-out infinite alternate;
}

@keyframes spark-walk-bob {
  from { transform: translateY(0) rotate(-2deg); }
  to { transform: translateY(-3px) rotate(2deg); }
}

.spark-presence-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  /* No pill around them anymore (Aaron's word, Nov 19, 2026:
   * the bubble around the character goes). The button keeps
   * its shape and its full tap target — the record of their
   * growth record line still needs a legible name beside
   * them, carried on a shadow now, not a box — but they stand
   * on the page itself, lit, not in a container. */
  border: 1px solid transparent;
  background: transparent;
  color: var(--spark-ink);
  cursor: pointer;
  animation: spark-bob 5s ease-in-out infinite;
}

.spark-presence-button .spark-presence-name {
  text-shadow:
    0 1px 6px rgba(5, 8, 16, 0.9),
    0 0 2px rgba(5, 8, 16, 0.9);
}

.spark-presence-art {
  display: block;
}

.spark-presence-art svg {
  display: block;
  width: calc(38px * var(--spark-size, 1));
  height: calc(38px * var(--spark-size, 1));
}

/* They light up like a spark: a soft warm aura stands around
 * the drawing itself — light, not a shape they sit in — and
 * their motes (drawn by the core, seeded per Spark) twinkle
 * gently out of step with one another. Under reduced motion
 * the motes rest where they were drawn and the aura simply
 * stands: a still glow. */
.spark-presence-art svg,
.spark-encounter-art svg {
  filter:
    drop-shadow(0 0 6px rgba(255, 226, 160, 0.45))
    drop-shadow(0 0 16px rgba(240, 190, 90, 0.28));
}

.spark-mote {
  transform-box: fill-box;
  transform-origin: center;
  animation: spark-mote-twinkle 3.4s ease-in-out infinite alternate;
}

@keyframes spark-mote-twinkle {
  from { opacity: 0.3; transform: scale(0.75); }
  to { opacity: 1; transform: scale(1.15); }
}

/* It turns to face the way it travels. */
.spark-presence-art.is-flipped {
  transform: scaleX(-1);
}

/* Its 3D body, where WebGL is to be had: the canvas stands in
 * the flat drawing's place, and the drawing steps aside. Where
 * it is not to be had, no canvas ever arrives and the drawing
 * simply stays — the fallback is the original, untouched. */
.spark-presence-art canvas,
.spark-encounter-art canvas,
.spark-big-art canvas {
  display: block;
}

.spark-encounter-art canvas,
.spark-big-art canvas {
  margin: 0 auto;
}

.spark-presence-art.has-3d svg,
.spark-encounter-art.has-3d svg,
.spark-big-art.has-3d svg {
  display: none;
}

/* Character, in motion only — no new art, just life. A tap is a
 * delighted bounce; its idle hours bring a spin, a stretch, or a
 * look around; and the moment it evolves, it grows in a flourish
 * its keeper can see from across the room. */
.spark-presence-art.is-delighted svg {
  animation: spark-delight 0.65s ease-in-out;
}

@keyframes spark-delight {
  0% { transform: translateY(0) scale(1) rotate(0deg); }
  30% { transform: translateY(-9px) scale(1.08) rotate(-4deg); }
  55% { transform: translateY(0) scale(1) rotate(3deg); }
  100% { transform: translateY(0) scale(1) rotate(0deg); }
}

.spark-presence-art.is-spinning svg {
  animation: spark-spin-once 0.9s ease-in-out;
}

@keyframes spark-spin-once {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.06); }
  100% { transform: rotate(360deg) scale(1); }
}

.spark-presence-art.is-stretching svg {
  animation: spark-stretch 1.1s ease-in-out;
}

@keyframes spark-stretch {
  0%, 100% { transform: scale(1, 1) translateY(0); }
  35% { transform: scale(0.94, 1.13) translateY(-3px); }
  70% { transform: scale(1.04, 0.95) translateY(0); }
}

.spark-presence-art.is-looking svg {
  animation: spark-look 1.4s ease-in-out;
}

@keyframes spark-look {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-3px) rotate(-4deg); }
  65% { transform: translateX(3px) rotate(4deg); }
}

.spark-presence-art.is-evolving svg {
  animation: spark-evolve 1.6s ease-in-out;
}

@keyframes spark-evolve {
  0% { transform: scale(1) rotate(0deg); filter: brightness(1); }
  30% { transform: scale(1.18) rotate(-6deg); filter: brightness(1.5); }
  55% { transform: scale(1.28) rotate(5deg); filter: brightness(1.8); }
  100% { transform: scale(1) rotate(0deg); filter: brightness(1); }
}

.spark-walker[data-gait="hop"] .spark-presence-art.is-walking svg {
  animation-name: spark-walk-hop;
}

@keyframes spark-walk-hop {
  from { transform: translateY(0); }
  to { transform: translateY(-7px); }
}

.spark-presence-name {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.spark-presence-bubble {
  max-width: min(300px, 82vw);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--spark-line);
  background: var(--spark-card);
  color: var(--spark-ink);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.spark-presence-bubble p {
  margin: 0 0 8px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.spark-presence-bubble p:last-child {
  margin-bottom: 0;
}

.spark-presence-bubble a {
  color: var(--spark-teal);
}

@keyframes spark-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .spark-presence-button { animation: none; }
  /* Their motes rest where they were drawn: a still glow. */
  .spark-mote { animation: none; }
  .spark-presence-art.is-walking svg { animation: none; }
  .spark-presence-art.is-delighted svg { animation: none; }
  .spark-presence-art.is-spinning svg { animation: none; }
  .spark-presence-art.is-stretching svg { animation: none; }
  .spark-presence-art.is-looking svg { animation: none; }
  .spark-presence-art.is-evolving svg { animation: none; }
  .spark-presence-art.is-flipped { transform: none; }
  .spark-big-art svg { animation: none; }
  .spark-encounter { animation: none; }
  .spark-encounter-art svg { animation: none; }
  .spark-ember { animation: none; }
  /* v2 life, stilled: breathing, blinking, glancing, wiggling,
   * arriving and celebrating all rest for reduced motion. The
   * Spark simply appears, as it always has. */
  .spark-presence-art svg { animation: none !important; }
  .spark-presence-button .spark-presence-art { animation: none !important; }
  .spark-eye { animation: none !important; }
  .spark-presence-art.is-reacting svg { animation: none !important; }
  .spark-encounter-art.is-reacting svg { animation: none !important; }
  .spark-encounter.is-celebrating { animation: none !important; }
  .spark-encounter.is-celebrating .spark-encounter-art svg { animation: none !important; }
  /* v3 life, stilled: kindling, the chase, the hop, and the
   * resting breath all rest for reduced motion too. */
  .spark-presence-art.is-kindling svg { animation: none !important; }
  .spark-presence-art.is-playful svg { animation: none !important; }
  .spark-presence-art.is-hopping svg { animation: none !important; }
  .spark-walker.is-resting .spark-presence-art svg { animation: none !important; }
  .spark-walker.is-napping .spark-presence-art svg { animation: none !important; }
}

/* ---------- idle life: breathing, blinking, glancing ---------- */

/* Settled in its corner, the Spark breathes — a slow swell and
 * settle, felt more than seen. While it walks, the walking
 * animation takes the stage instead. */
.spark-presence-art:not(.is-walking) svg {
  animation: spark-breathe 4.6s ease-in-out infinite;
}

@keyframes spark-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* The eye blinks: open for a long while, shut for a blink. The
 * eye shapes carry the class from the drawing itself, so every
 * Spark everywhere — corner, ember, meeting, home page — blinks
 * the same quiet way. */
.spark-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: spark-blink 5.4s infinite;
}

@keyframes spark-blink {
  0%, 91%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.12); }
  97% { transform: scaleY(1); }
}

/* Now and then it glances — a small tilt of attention, most of
 * the cycle spent simply being there. */
.spark-presence-button .spark-presence-art {
  display: block;
  animation: spark-glance 11s ease-in-out infinite;
}

@keyframes spark-glance {
  0%, 88%, 100% { transform: rotate(0deg); }
  91% { transform: rotate(-5deg); }
  94% { transform: rotate(3deg); }
  97% { transform: rotate(0deg); }
}

/* A tap answered in the body: one wiggle of delight. */
.spark-presence-art.is-reacting svg {
  animation: spark-wiggle 0.45s ease;
}

.spark-encounter-art.is-reacting svg {
  animation: spark-wiggle 0.45s ease;
}

@keyframes spark-wiggle {
  0% { transform: rotate(0deg) scale(1); }
  30% { transform: rotate(-7deg) scale(1.08); }
  60% { transform: rotate(6deg) scale(1.05); }
  100% { transform: rotate(0deg) scale(1); }
}

/* ---------- the bubble: the panel's furniture ---------- */

/* The panel sizes to its state: no max-height, no scroll —
 * at phone size every state stands whole (lab-measured). */
.spark-panel-coord {
  color: var(--spark-gold);
  font-size: 0.8rem !important;
  letter-spacing: 0.02em;
  margin: 0 0 8px !important;
}

.spark-panel-line {
  margin: 0 0 2px !important;
  font-size: 0.95rem !important;
  line-height: 1.4;
}

.spark-panel-line strong {
  color: var(--spark-gold);
  font-weight: 600;
}

.spark-panel-face {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.spark-panel-face svg {
  width: 54px;
  height: 54px;
}

.spark-panel-row {
  margin: 0 0 5px !important;
  font-size: 0.88rem !important;
}

.spark-panel-row strong {
  color: var(--spark-dim);
  font-weight: 600;
}

.spark-notice-kind {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--spark-line);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--spark-dim);
  vertical-align: 1px;
}

.spark-notice-kind.is-observed {
  color: var(--spark-gold);
  border-color: rgba(217, 164, 65, 0.5);
}

.spark-notice-kind.is-inferred {
  color: var(--spark-teal);
  border-color: rgba(45, 212, 191, 0.5);
}

/* ---------- v3: the care life, the daily trail, the real guide ---------- */

.spark-guide-doors,
.spark-trail-steps {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.spark-guide-doors li,
.spark-trail-steps li {
  margin: 0 0 5px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.spark-trail-mark {
  color: var(--spark-dim);
}

.spark-trail-steps li.is-done .spark-trail-mark {
  color: var(--spark-gold);
}

.spark-trail-steps li.is-done a {
  color: var(--spark-dim);
}

/* A kindle's warmth: a brief golden bloom around the body. */
.spark-presence-art.is-kindling svg,
.spark-encounter-art.is-kindling svg {
  animation: spark-kindling 1.2s ease;
}

@keyframes spark-kindling {
  0% { filter: drop-shadow(0 0 0 rgba(255, 190, 80, 0)); transform: scale(1); }
  35% { filter: drop-shadow(0 0 14px hsl(var(--spark-moon-hue, 43) 90% 62% / 0.85)); transform: scale(1.1); }
  100% { filter: drop-shadow(0 0 0 rgba(255, 190, 80, 0)); transform: scale(1); }
}

/* Kindled today: its ordinary glow runs warmer. */
.spark-walker[data-kindled="true"] .spark-presence-art svg {
  filter: drop-shadow(0 0 7px hsl(var(--spark-moon-hue, 43) 90% 64% / 0.55));
}

/* Waiting at a chase point: bright, bouncy, catchable. */
.spark-presence-art.is-playful svg {
  animation: spark-playful 0.7s ease-in-out infinite;
}

@keyframes spark-playful {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.06); }
}

/* A signature hop, one of its idle tricks. */
.spark-presence-art.is-hopping svg {
  animation: spark-hop-pattern 1.4s ease;
}

@keyframes spark-hop-pattern {
  0%, 100% { transform: translateY(0); }
  20% { transform: translateY(-9px); }
  40% { transform: translateY(0); }
  60% { transform: translateY(-6px); }
  80% { transform: translateY(0); }
}

/* Resting and napping: dimmed, curled a little, breathing slow.
 * It takes no clicks away and covers nothing new — it simply
 * quiets, where it already was. */
.spark-walker.is-resting .spark-presence-button,
.spark-walker.is-napping .spark-presence-button {
  opacity: 0.62;
  filter: saturate(0.7);
}

.spark-walker.is-resting .spark-presence-art svg,
.spark-walker.is-napping .spark-presence-art svg {
  animation: spark-rest-breathe 6.5s ease-in-out infinite;
}

@keyframes spark-rest-breathe {
  0%, 100% { transform: scale(0.94) translateY(2px); }
  50% { transform: scale(0.97) translateY(1px); }
}

/* ---------- the meeting: pop-up encounter and waiting ember ---------- */

/* The Spark pops up where its person first arrives: a card at the
 * corner of the page, the creature itself and its own short words.
 * It takes the corner only — the page behind it stays readable,
 * and both of its buttons are full-size tap targets. */
.spark-encounter-host {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  /* The meeting sits above everything of the site's chrome —
   * the header, the nav, the floating menu button, even the
   * living opening's overlay: nothing hovers over the card
   * (Aaron's phone review, Nov 19, 2026). */
  z-index: 10060;
  font-family: inherit;
}

.spark-encounter {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  max-width: min(400px, calc(100vw - 24px));
  /* The whole moment stays on screen, even a small one: when
   * the celebration makes the card taller than the view, the
   * card scrolls within itself rather than leaving the screen.
   * The cap is measured from the screen itself, so the card's
   * top always clears the day line and the header. */
  max-height: min(calc(100dvh - 96px), 760px);
  overflow-y: auto;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--spark-line);
  /* Near-solid, where the shared card tint is translucent:
   * on the encounter nothing of the page behind may bleed
   * through (Aaron's screenshot showed the page's own words
   * inside the card). */
  background: rgba(13, 18, 32, 0.96);
  color: var(--spark-ink);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  transform-origin: bottom right;
  animation: spark-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes spark-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* It arrives the way its seed taught it to move: a hopper bounces
 * in, a drifter floats down soft and slow, a stroller takes the
 * plain pop above. */
.spark-encounter[data-gait="hop"] {
  animation-name: spark-pop-hop;
  animation-duration: 0.6s;
}

@keyframes spark-pop-hop {
  0% { opacity: 0; transform: translateY(26px) scale(0.85); }
  55% { opacity: 1; transform: translateY(-8px) scale(1.02); }
  75% { transform: translateY(3px) scale(0.99); }
  100% { transform: translateY(0) scale(1); }
}

.spark-encounter[data-gait="drift"] {
  animation-name: spark-pop-drift;
  animation-duration: 0.95s;
}

@keyframes spark-pop-drift {
  from { opacity: 0; transform: translateY(18px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* The creature itself is a button before it is adopted — tapping
 * it is how you say hello first. It wears no button's clothing. */
.spark-encounter-artbtn {
  flex: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 18px;
}

.spark-encounter-art {
  display: block;
}

.spark-encounter-voice {
  font-style: italic;
}

.spark-encounter-look {
  color: var(--spark-dim);
  font-size: 0.86rem !important;
}

/* The adoption moment: a ring of light blooms outward, the Spark
 * swells once with delight, and its name stands large. */
.spark-encounter.is-celebrating {
  border-color: var(--spark-gold);
  animation: spark-bloom 1.1s ease-out;
}

@keyframes spark-bloom {
  0% { box-shadow: 0 0 0 0 rgba(217, 164, 65, 0.55), 0 16px 40px rgba(0, 0, 0, 0.5); }
  100% { box-shadow: 0 0 0 26px rgba(217, 164, 65, 0), 0 16px 40px rgba(0, 0, 0, 0.5); }
}

.spark-encounter.is-celebrating .spark-encounter-art svg {
  animation: spark-celebrate-pulse 0.9s ease-in-out;
}

@keyframes spark-celebrate-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.18) rotate(-3deg); }
  100% { transform: scale(1); }
}

.spark-encounter-bigname {
  font-size: 1.7rem !important;
  font-weight: 700;
  color: var(--spark-gold);
  margin: 4px 0 2px !important;
}

.spark-encounter-seednote {
  color: var(--spark-dim);
  font-size: 0.86rem !important;
}

.spark-encounter-namelabel {
  display: block;
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}

.spark-encounter-name-input {
  width: 100%;
  max-width: 300px;
  min-height: 44px;
  padding: 8px 12px;
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid rgba(167, 176, 198, 0.4);
  background: rgba(5, 7, 13, 0.6);
  color: var(--spark-ink);
  font-size: 1rem;
}

.spark-encounter-name-keep {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--spark-gold);
  background: var(--spark-gold);
  color: #14100a;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.spark-encounter-name-skip {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--spark-dim);
  font-size: 0.9rem;
  cursor: pointer;
}

.spark-encounter-art svg {
  display: block;
  width: 84px;
  height: 84px;
  animation: spark-bob 5s ease-in-out infinite;
}

.spark-encounter-words p {
  margin: 0 0 6px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.spark-encounter-greet {
  font-weight: 700;
  font-size: 1rem !important;
}

.spark-encounter-born,
.spark-encounter-invite {
  color: var(--spark-dim);
  font-size: 0.86rem !important;
}

.spark-encounter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* The flex above would otherwise outrank the hidden attribute:
 * a hidden actions row must truly go. */
.spark-encounter-actions[hidden],
.spark-encounter-celebrate[hidden] {
  display: none;
}

.spark-encounter-adopt {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--spark-gold);
  background: var(--spark-gold);
  color: #14100a;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.spark-encounter-later {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--spark-dim);
  font-size: 0.9rem;
  cursor: pointer;
}

/* After "Not now": the same Spark, waiting as a small ember at the
 * edge of the page. Quiet on purpose — a soft pulse, nothing more.
 * It never pops up on its own again. */
.spark-ember-host {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10040;
  font-family: inherit;
}

.spark-ember {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--spark-line);
  background: var(--spark-card);
  cursor: pointer;
  opacity: 0.75;
  animation: spark-ember-pulse 4.5s ease-in-out infinite;
}

.spark-ember:hover,
.spark-ember:focus-visible {
  opacity: 1;
}

.spark-ember-art svg {
  display: block;
  width: 32px;
  height: 32px;
}

@keyframes spark-ember-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 164, 65, 0); }
  50% { box-shadow: 0 0 14px 2px rgba(217, 164, 65, 0.25); }
}

/* ---------- the companions page ---------- */

.spark-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 18px 64px;
  color: var(--spark-ink);
}

.spark-wrap h1 {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  margin: 8px 0 6px;
}

.spark-lede {
  color: var(--spark-dim);
  line-height: 1.55;
  max-width: 56ch;
}

.spark-today {
  display: inline-block;
  margin: 10px 0 4px;
  padding: 6px 12px;
  border: 1px solid var(--spark-line);
  border-radius: 999px;
  color: var(--spark-gold);
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}

.spark-question {
  border: 1px solid rgba(167, 176, 198, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0;
}

.spark-question legend {
  padding: 0 6px;
  font-weight: 600;
}

.spark-option {
  display: block;
  padding: 8px 6px;
  min-height: 44px;
  line-height: 1.4;
  cursor: pointer;
}

.spark-name-row {
  margin: 18px 0;
}

.spark-name-row label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.spark-name-row input,
.spark-rename-row input {
  width: 100%;
  max-width: 340px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(167, 176, 198, 0.4);
  background: rgba(5, 7, 13, 0.6);
  color: var(--spark-ink);
  font-size: 1rem;
}

.spark-button {
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--spark-gold);
  background: transparent;
  color: var(--spark-gold);
  font-size: 1rem;
  cursor: pointer;
}

.spark-button.primary {
  background: var(--spark-gold);
  color: #14100a;
  font-weight: 600;
}

.spark-button.quiet {
  border-color: rgba(167, 176, 198, 0.4);
  color: var(--spark-dim);
}

.spark-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.spark-preview,
.spark-companion-card {
  border: 1px solid var(--spark-line);
  border-radius: 18px;
  padding: 20px;
  margin: 20px 0;
  background: var(--spark-card);
  text-align: center;
}

.spark-preview-art svg,
.spark-big-art svg {
  width: min(220px, 60vw);
  height: auto;
}

.spark-big-art svg {
  animation: spark-bob 6s ease-in-out infinite;
}

.spark-facts {
  text-align: left;
  line-height: 1.6;
  max-width: 52ch;
  margin: 12px auto 0;
}

.spark-facts p {
  margin: 6px 0;
}

.spark-guide-box {
  border-left: 3px solid var(--spark-teal);
  padding: 10px 14px;
  margin: 18px 0;
  text-align: left;
  background: rgba(45, 212, 191, 0.06);
  line-height: 1.55;
}

.spark-rename-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.spark-note {
  color: var(--spark-dim);
  font-size: 0.92rem;
  line-height: 1.55;
}

.spark-wrap h2 {
  margin-top: 36px;
  font-size: 1.25rem;
}


/* ---------- v8: the control panel, and bubbles a thumb can hit ----------
 * A tap on the Spark opens a panel, not a scrolling talk.
 * One short line of theirs at the top, the day's coordinate in
 * small type, any short rows the state carries, and a grid of
 * big bubbles that simply appear — every bubble at least
 * 48px tall, labelled in a word or two, answering the press
 * visibly the moment it lands. A state replaces the state
 * before it; nothing in the panel scrolls. Nothing waits on
 * a hover: there is no hover on a phone. Their light — the
 * halo the panel stands in — borrows the hue family of the
 * moon they are under (--spark-moon-hue, set from the
 * calendar's own element for that moon); their seed-grown
 * body colours never take it. */

/* The panel gets a definite width — wide enough at phone
 * size for three bubbles across — and the presence places
 * it beside the Spark at open time, clamped to the view. */
.spark-presence-bubble {
  width: min(356px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
}

.spark-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.spark-panel-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  min-width: 0;
  padding: 8px 4px;
  border-radius: 16px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.08);
  color: var(--spark-ink);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.15;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, background 0.08s ease;
}

.spark-panel-bubble:hover,
.spark-panel-bubble:focus-visible {
  background: rgba(45, 212, 191, 0.2);
}

.spark-panel-bubble:active {
  transform: scale(0.95);
  background: rgba(45, 212, 191, 0.3);
}

.spark-panel-icon {
  font-size: 1.05rem;
  line-height: 1;
  color: var(--spark-gold);
}

.spark-panel-label {
  text-align: center;
  overflow-wrap: break-word;
}

.spark-panel-state {
  font-size: 0.68rem;
  color: var(--spark-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* The day's one thing stands first, wide, in gold. */
.spark-panel-onething {
  grid-column: 1 / -1;
  flex-direction: row;
  gap: 8px;
  min-height: 52px;
  border-color: rgba(217, 164, 65, 0.65);
  background: rgba(217, 164, 65, 0.12);
}

/* In the Guide state the grid carries doors: gold-edged. */
.spark-guide-doors .spark-panel-bubble {
  border-color: rgba(217, 164, 65, 0.4);
  background: rgba(217, 164, 65, 0.07);
}

.spark-walker .spark-presence-bubble {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.45),
    0 0 22px hsl(var(--spark-moon-hue, 43) 85% 60% / 0.16);
}

.spark-presence-button:active {
  transform: scale(0.94);
}

/* The tap reaction, with its settle: a squash as the bounce
 * lands, then the spring back — follow-through you can see. */
@keyframes spark-wiggle {
  0% { transform: rotate(0deg) scale(1, 1); }
  30% { transform: rotate(-7deg) scale(1.08, 1.05); }
  55% { transform: rotate(6deg) scale(1.05, 1.08); }
  78% { transform: rotate(-2deg) scale(0.96, 0.94); }
  100% { transform: rotate(0deg) scale(1, 1); }
}

@media (prefers-reduced-motion: reduce) {
  .spark-panel-bubble { transition: none; }
  .spark-panel-bubble:active { transform: none; }
  .spark-presence-button:active { transform: none; }
}

/* ---------- v6: touch, tricks, the echo game, moods ----------
 * They answer the hand itself now: the button takes the whole
 * press (no scroll fights it), a poke squashes, a petting leans
 * them in with a static warmth under the lean, and each trick has
 * its own small performance. Their mood shows in their light — a
 * filter, not a costume — so it reads at a glance and costs the
 * phone nothing. The echo pads are their own colours, thumb-sized,
 * and light where their pattern touches them. */

.spark-presence-button {
  touch-action: none;
  cursor: grab;
}

.spark-presence-button:active {
  cursor: grabbing;
}

.spark-presence-art.is-poked svg {
  animation: spark-poke 0.24s ease;
}

@keyframes spark-poke {
  40% { transform: scale(0.86, 1.12); }
  70% { transform: scale(1.05, 0.96); }
}

.spark-presence-art.is-petted {
  filter: brightness(1.13) saturate(1.12);
}

.spark-presence-art.is-petted svg {
  animation: spark-pet-lean 1s ease;
}

@keyframes spark-pet-lean {
  30% { transform: rotate(-5deg) translateY(2px) scale(1.04); }
  65% { transform: rotate(4deg) translateY(1px) scale(1.03); }
}

.spark-presence-art.is-leaping svg {
  animation: spark-leap 0.9s ease;
}

@keyframes spark-leap {
  35% { transform: translateY(-26px) scale(1.02, 1.06); }
  70% { transform: translateY(1px) scale(1.07, 0.93); }
}

.spark-presence-art.is-pulsing svg {
  animation: spark-pulse-glow 1.2s ease;
}

@keyframes spark-pulse-glow {
  35% { filter: brightness(1.45) drop-shadow(0 0 14px rgba(255, 214, 120, 0.65)); transform: scale(1.07); }
}

.spark-presence-art.is-trick-flare svg {
  animation: spark-trick-flare 1.1s ease;
}

@keyframes spark-trick-flare {
  30% { filter: brightness(1.8) saturate(1.3); transform: scale(1.13); }
}

.spark-presence-art.is-trick-ripple svg {
  animation: spark-trick-ripple 1.4s ease;
}

@keyframes spark-trick-ripple {
  40% { transform: scale(1.06, 0.94); filter: drop-shadow(0 0 12px rgba(94, 200, 220, 0.55)); }
  75% { transform: scale(0.98, 1.03); }
}

.spark-presence-art.is-trick-vanish svg {
  animation: spark-trick-vanish 1.4s ease;
}

@keyframes spark-trick-vanish {
  40% { opacity: 0.12; transform: scale(0.92); }
  70% { opacity: 0.35; }
}

.spark-presence-art.is-trick-loop svg {
  animation: spark-trick-loop 0.95s ease;
}

@keyframes spark-trick-loop {
  60% { transform: rotate(330deg) translateY(-8px); }
  100% { transform: rotate(360deg); }
}

.spark-presence-art.is-trick-root svg {
  animation: spark-trick-root 1.4s ease;
}

@keyframes spark-trick-root {
  35% { transform: scale(1.05, 0.9) translateY(3px); filter: brightness(0.94); }
  80% { transform: scale(1.01, 0.99); }
}

.spark-presence-art.is-trick-beam svg {
  animation: spark-trick-beam 1.2s ease;
}

@keyframes spark-trick-beam {
  35% { filter: brightness(1.6) saturate(1.35) drop-shadow(0 0 16px rgba(255, 236, 170, 0.8)); transform: scale(1.06); }
}

/* Their mood, in their light. */
.spark-presence-art.is-mood-bright svg {
  filter: brightness(1.09) drop-shadow(0 0 9px rgba(255, 196, 86, 0.5));
}

.spark-presence-art.is-mood-proud svg {
  filter: brightness(1.06) drop-shadow(0 0 7px rgba(217, 164, 65, 0.45));
}

.spark-presence-art.is-mood-calm svg {
  filter: saturate(0.9) brightness(0.98);
}

.spark-presence-art.is-mood-sleepy svg {
  filter: brightness(0.84) saturate(0.82);
}

/* The echo game board, inside the talk. */
.spark-echo {
  margin-top: 10px;
}

.spark-echo-pads {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.spark-echo-pad {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: var(--echo-pad, #888);
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.spark-echo-pad.is-lit {
  filter: brightness(1.55);
  transform: scale(1.14);
}

.spark-echo-pad:active {
  transform: scale(0.94);
}

@media (prefers-reduced-motion: reduce) {
  .spark-presence-art.is-poked svg { animation: none !important; }
  .spark-presence-art.is-petted svg { animation: none !important; }
  .spark-presence-art.is-leaping svg { animation: none !important; }
  .spark-presence-art.is-pulsing svg { animation: none !important; }
  .spark-presence-art.is-trick-flare svg { animation: none !important; }
  .spark-presence-art.is-trick-ripple svg { animation: none !important; }
  .spark-presence-art.is-trick-vanish svg { animation: none !important; }
  .spark-presence-art.is-trick-loop svg { animation: none !important; }
  .spark-presence-art.is-trick-root svg { animation: none !important; }
  .spark-presence-art.is-trick-beam svg { animation: none !important; }
  .spark-echo-pad { transition: none; }
  .spark-echo-pad.is-lit { transform: none; }
  .spark-presence-button { cursor: auto; }
}

@media (max-width: 480px), (max-height: 560px) {
  .spark-encounter {
    gap: 8px;
    max-width: min(320px, calc(100vw - 24px));
    padding: 12px;
  }

  .spark-encounter-art svg {
    width: 56px;
    height: 56px;
  }

  .spark-encounter-voice,
  .spark-encounter-look,
  .spark-encounter-born {
    display: none;
  }
}

/* ---- the passport and the page's own play (Nov 22, 2026) ---- */

/* A line the Spark speaks on this page — under its picture,
 * never blocking anything. */
.spark-speech {
  min-height: 1.2em;
  margin: 6px 0 0;
  font-style: italic;
  color: var(--spark-dim);
}

/* The pictures answer a tap; the cursor says so. */
.spark-preview-art,
.spark-big-art {
  cursor: pointer;
}

/* The happy bounce a tap is answered with. */
@keyframes spark-bounce-anim {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-10px) scale(1.04); }
  70% { transform: translateY(2px) scale(0.99); }
  100% { transform: translateY(0) scale(1); }
}
.spark-bounce {
  animation: spark-bounce-anim 0.45s ease;
}
@media (prefers-reduced-motion: reduce) {
  .spark-bounce { animation: none; }
}

/* The passport: the code stands large and plain, in a hand's
 * width, so it can be read aloud or typed without squinting. */
.spark-passport-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  word-break: break-all;
  color: var(--spark-gold);
  margin: 6px 0;
}

.spark-passport-qr {
  width: 168px;
  height: 168px;
  margin: 8px 0;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spark-passport-qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

.spark-passport-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 8px 0;
}
.spark-passport-row input {
  flex: 1 1 240px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--spark-line);
  background: rgba(5, 8, 16, 0.6);
  color: var(--spark-ink);
}

.spark-passport-video {
  width: min(320px, 100%);
  border-radius: 12px;
  margin: 8px 0;
  background: #000;
}

.spark-passport-door {
  margin-top: 18px;
  border-top: 1px solid var(--spark-line);
  padding-top: 10px;
}
