:root {
  --soil: #120e0a;
  --ink: #efe9dc;
  --muted: #b3aa97;
  --line: rgba(239, 233, 220, 0.14);
  --field: rgba(239, 233, 220, 0.06);
  --moss: #8fd3a6;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--soil); color: var(--ink); font-family: var(--sans); line-height: 1.5; }

/* Living garden background */
#garden-paint, #garden-bg, #garden-air { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

main {
  max-width: 860px; margin: 40px auto 120px; padding: 40px 44px 56px;
  background: rgba(14, 11, 8, 0.66);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  border: 1px solid var(--line); border-radius: 18px;
}

header h1 { font-family: var(--serif); font-weight: 400; font-size: 3.2rem; margin: 0; letter-spacing: -0.01em; }
.version { font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em; vertical-align: super; margin-left: 6px; padding: 3px 9px; border: 1px solid var(--moss); border-radius: 999px; color: var(--moss); }
.tagline { color: var(--muted); font-size: 1.1rem; margin-top: 4px; }

.how { margin: 22px 0 0; padding: 0; list-style: none; counter-reset: how; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.how li { counter-increment: how; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); font-size: 0.92rem; color: var(--muted); }
.how li::before { content: counter(how); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-bottom: 8px; border-radius: 50%; background: var(--moss); color: var(--soil); font-weight: 700; font-size: 0.8rem; }
.how b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
section { margin-top: 44px; }
h2 { font-family: var(--serif); font-weight: 400; font-size: 1.4rem; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.hint { color: var(--muted); font-size: 0.9rem; }

/* Orbs */
#orbs { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.orb-wrap { position: absolute; left: 0; top: 0; width: 24px; height: 24px; pointer-events: auto; cursor: grab; touch-action: none; user-select: none; will-change: transform; }
.orb-wrap.held { cursor: grabbing; }
.orb-wrap .orb { width: 100%; height: 100%; }
.orb-wrap.remembered .orb { opacity: 0.8; }
.orb {
  width: 24px; height: 24px;
  /* a drop of light: soft highlight over the companion's color */
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,0.7), rgba(255,255,255,0) 42%),
    radial-gradient(circle at 60% 70%, rgba(0,0,0,0.25), rgba(0,0,0,0) 60%),
    var(--c);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--c), 0 0 2px var(--c);
  animation:
    glow 4s ease-in-out infinite,
    morph 9s ease-in-out infinite,
    drift 13s ease-in-out infinite;
}
.orb-wrap:nth-child(2) .orb { animation-duration: 4.6s, 10s, 15s; }
.orb-wrap:nth-child(3) .orb { animation-duration: 5.2s, 8s, 12s; }
.orb-wrap:nth-child(4) .orb { animation-duration: 4.3s, 11s, 14s; }
.orb-wrap.held .orb { box-shadow: 0 0 30px var(--c), 0 0 8px var(--c); }

/* seedlings and mushrooms that grow from the orbs */
.sprouts { position: absolute; inset: 0; pointer-events: none; }
.sprout { position: absolute; left: 50%; top: 50%; width: 12px; height: 14px; margin: -14px 0 0 -6px; transform-origin: 50% 100%; }
.sprout svg { display: block; transform: scale(0); transform-origin: 50% 100%; transition: transform 1.6s cubic-bezier(.2,1.4,.4,1); filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.sprout.grown svg { transform: scale(1); }
.thinking .orb { animation-duration: 1.1s, 2.5s, 4s; }

/* glow and swell */
@keyframes glow {
  50% { scale: 1.28; box-shadow: 0 0 34px var(--c), 0 0 8px var(--c); opacity: 0.85; }
}
/* blob / puddle / drop shapes */
@keyframes morph {
  0%, 100% { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
  20% { border-radius: 62% 38% 54% 46% / 44% 58% 42% 56%; }
  40% { border-radius: 40% 60% 70% 30% / 55% 35% 65% 45%; }
  60% { border-radius: 50% 50% 34% 66% / 64% 60% 40% 36%; }   /* drop */
  80% { border-radius: 70% 30% 46% 54% / 40% 52% 48% 60%; }   /* puddle */
}
/* a slow wobble so each blob feels alive */
@keyframes drift {
  0%, 100% { rotate: 0deg; translate: 0 0; }
  33% { rotate: 24deg; translate: 2px -2px; }
  66% { rotate: -18deg; translate: -2px 2px; }
}

@media (prefers-reduced-motion: reduce) { .orb { animation: none; } .sprout svg { transition: none; } }

/* Companion editor */
.companion { display: grid; grid-template-columns: 14px 1fr 1.3fr 1fr 1.6fr auto auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); width: 100%; }
input::placeholder, textarea::placeholder { color: #8d8574; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--moss); }
option { color: #1d1b19; }
textarea { resize: vertical; }
.remembered { font-size: 0.8rem; color: var(--muted); display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.remembered input { width: auto; accent-color: var(--moss); }
.remembered-note { margin-top: -6px; display: flex; align-items: center; gap: 8px; }
.remembered-note strong { color: var(--ink); font-weight: 600; }
.remembered-note .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--moss); box-shadow: 0 0 8px var(--moss); }

button { font: inherit; cursor: pointer; border-radius: 999px; padding: 8px 18px; border: 1px solid var(--ink); }
.primary { background: var(--ink); color: var(--soil); }
.primary:hover { background: var(--moss); border-color: var(--moss); }
.primary:disabled { opacity: 0.5; cursor: wait; }
.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.ghost:hover { border-color: var(--ink); }
.row { display: flex; gap: 12px; justify-content: space-between; margin-top: 12px; }
#status { color: var(--moss); font-style: italic; min-height: 1.5em; }

/* Reflection */
#constellation { width: 100%; height: auto; border-radius: 10px; background: #0b0907; border: 1px solid var(--line); }
#journey-poem { font-family: var(--serif); font-size: 1.5rem; line-height: 1.45; white-space: pre-line; margin: 32px 0; padding-left: 20px; border-left: 2px solid var(--moss); }
.reflection-card { display: grid; grid-template-columns: 160px 1fr; gap: 20px; padding: 20px 0; border-top: 1px solid var(--line); }
.reflection-card .art { width: 160px; aspect-ratio: 1; background: var(--field); border-radius: 8px; object-fit: cover; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 0.8rem; color: var(--muted); padding: 8px; overflow: hidden; }
.reflection-card img.art { padding: 0; }
.reflection-card .who { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.reflection-card .lines { font-family: var(--serif); font-size: 1.2rem; white-space: pre-line; margin: 8px 0; }
.reflection-card .meta { font-size: 0.85rem; color: var(--muted); }
.reflection-card a { color: inherit; }
.on-view { color: var(--moss) !important; font-weight: 600; }
.share { margin-top: 28px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--field); }
.share h3 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin: 0 0 4px; }
.share-row { justify-content: flex-start; flex-wrap: wrap; }
.send-one { margin-top: 6px; font-size: 0.85rem; padding: 5px 14px; }
.share-net { display: flex; gap: 8px; align-items: baseline; margin-top: 14px; font-size: 0.9rem; color: var(--ink); cursor: pointer; }
.share-net input { width: auto; accent-color: var(--moss); }
.share-net span { color: var(--muted); font-size: 0.82rem; }
.network-line { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; color: var(--moss); font-size: 0.9rem; }
.network-line .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--moss); box-shadow: 0 0 10px var(--moss); }
.network-count { font-family: var(--serif); font-size: 1.4rem; margin: 10px 0 20px; }
.network-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.network-grid h3 { font-family: var(--serif); font-weight: 400; font-size: 1.1rem; margin: 0 0 10px; color: var(--muted); }
.network-themes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.thread { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); font-size: 0.88rem; }
.network-art { margin: 0; padding-left: 20px; }
.network-art li { margin-bottom: 8px; }
.network-art a { color: var(--ink); }
.network-art .times { color: var(--muted); font-size: 0.8rem; margin-left: 4px; }
.credit { font-size: 0.8rem; color: var(--muted); margin-top: 32px; }

@media (max-width: 760px) {
  main { margin: 16px 12px 80px 52px; padding: 24px 20px; }
  .companion { grid-template-columns: 14px 1fr 1fr; }
  .reflection-card { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr; }
  .network-grid { grid-template-columns: 1fr; }
}
