/* ipheion — springtime in a royal garden.
   Cream stationery in a gilt frame, a lilac ribbon for the day, rose enamel
   plaques for buttons, and the spring starflower (Ipheion uniflorum) as the
   house mark. Colours are chosen to stay distinct under protanomaly: meaning
   never rests on red against green, and nothing important is aqua. */

@font-face { font-family: "Fraunces"; src: url("fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("fonts/cormorant.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Pinyon"; src: url("fonts/pinyon.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: block; }

:root {
  --ink: #3b2a4d;
  --ink-soft: #66557a;
  --ink-strong: #2a1b39;
  --paper: #fffaf2;
  --paper-deep: #fbf0e1;
  --blush: #f9dde5;
  --blush-deep: #eeb3c5;
  --rose: #c8577a;
  --rose-ink: #9c3f63;
  --lilac: #ded2f1;
  --wisteria: #8f72c4;
  --wisteria-deep: #6f54a6;
  --sage: #dfead8;
  --leaf: #5c8556;
  --leaf-ink: #3e5f3a;
  --butter: #f8e7a8;
  --gold: #c9a24d;
  --gold-light: #ecd9a0;
  --gold-deep: #9c7a2e;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --display: "Cormorant", "Cormorant Garamond", "Garamond", "Iowan Old Style", Georgia, serif;
  --script: "Pinyon", "Snell Roundhand", "Apple Chancery", cursive;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .38 0 0 0 0 .32 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --trellis: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M0 32L32 0L64 32L32 64Z' fill='none' stroke='%23b79a5a' stroke-opacity='.16' stroke-width='1'/%3E%3Cg fill='%23e7a9bd' fill-opacity='.35'%3E%3Ccircle cx='32' cy='0' r='2.4'/%3E%3Ccircle cx='0' cy='32' r='2.4'/%3E%3Ccircle cx='64' cy='32' r='2.4'/%3E%3Ccircle cx='32' cy='64' r='2.4'/%3E%3C/g%3E%3Ccircle cx='32' cy='32' r='1.6' fill='%23a995d4' fill-opacity='.3'/%3E%3C/svg%3E");
  --fade: rgba(246, 228, 238, .94);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 400 1.125rem/1.6 var(--serif);
  color: var(--ink);
  font-kerning: normal;
  background: #f6e6ec;
  -webkit-font-smoothing: antialiased;
}
/* The garden behind everything, on its own fixed layer so scrolling never
   repaints it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    var(--trellis),
    radial-gradient(120% 70% at 50% -10%, #fff9ec 0%, rgba(255, 249, 236, 0) 60%),
    radial-gradient(60% 50% at 0% 100%, rgba(197, 224, 186, .55), rgba(197, 224, 186, 0) 70%),
    radial-gradient(60% 50% at 100% 100%, rgba(217, 205, 239, .7), rgba(217, 205, 239, 0) 70%),
    linear-gradient(180deg, #fdf3ea 0%, #f9e2ea 45%, #efe4f5 100%);
}

a { color: var(--rose-ink); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--wisteria-deep); }
:focus-visible { outline: 2px solid var(--wisteria); outline-offset: 3px; border-radius: 3px; }
::selection { background: #f3c6d4; color: var(--ink-strong); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* --- the arbor: wisteria along the top, roses climbing the corners ----------- */
.arbor {
  position: absolute;
  inset: 0 0 auto 0;
  height: 250px;
  z-index: -1;
  pointer-events: none;
  background: url("wisteria.svg") center top / auto 250px repeat-x;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.roses { display: none; position: fixed; bottom: 0; width: 230px; height: 200px; z-index: -1; pointer-events: none; background: url("roses.svg") left bottom / contain no-repeat; }
.roses.r { right: 0; transform: scaleX(-1); }
@media (min-width: 1000px) { .roses.l { display: block; left: 0; } .roses.r { display: block; } }
@media (max-width: 640px) { .arbor { height: 150px; background-size: auto 150px; opacity: .85; } }

/* --- drifting petals ------------------------------------------------------ */
.petals { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.petals i {
  position: absolute;
  top: -4vh;
  width: 13px;
  height: 9px;
  border-radius: 85% 0 85% 0;
  background: linear-gradient(135deg, #fde4ea, #eba8bd);
  opacity: .55;
  will-change: transform;
  animation: fall 26s linear infinite;
}
.petals i:nth-child(1) { left: 8%;  animation-duration: 29s; animation-delay: -3s;  --drift: 9vw; }
.petals i:nth-child(2) { left: 22%; animation-duration: 34s; animation-delay: -17s; --drift: -6vw; background: linear-gradient(135deg, #f6f0ff, #c4b1e6); }
.petals i:nth-child(3) { left: 41%; animation-duration: 27s; animation-delay: -9s;  --drift: 7vw; }
.petals i:nth-child(4) { left: 58%; animation-duration: 38s; animation-delay: -25s; --drift: -10vw; background: linear-gradient(135deg, #fffbe6, #f2d77c); width: 10px; height: 7px; }
.petals i:nth-child(5) { left: 73%; animation-duration: 31s; animation-delay: -12s; --drift: 5vw; }
.petals i:nth-child(6) { left: 87%; animation-duration: 36s; animation-delay: -30s; --drift: -8vw; background: linear-gradient(135deg, #f6f0ff, #c4b1e6); }
.petals i:nth-child(7) { left: 95%; animation-duration: 40s; animation-delay: -6s;  --drift: -12vw; width: 9px; height: 6px; }
@keyframes fall {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  50%  { transform: translate3d(calc(var(--drift) * .6), 55vh, 0) rotate(260deg); }
  100% { transform: translate3d(var(--drift), 112vh, 0) rotate(560deg); }
}

/* --- masthead ------------------------------------------------------------- */
.masthead {
  display: grid;
  /* The wordmark's column may shrink: its flourishes give way before the
     controls are pushed off a narrow screen. */
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: .7rem clamp(.6rem, 3vw, 1.6rem) 0;
}
.wordmark {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--ink-strong);
  text-decoration: none;
}
.wordmark { padding: .1rem 1.2rem; background: radial-gradient(closest-side, rgba(255, 250, 240, .96) 55%, rgba(255, 250, 240, .7) 78%, rgba(255, 250, 240, 0)); }
.wordmark span {
  font: 400 clamp(2.1rem, 6vw, 2.9rem)/1 var(--script);
  padding: .15em .1em .05em;
  text-shadow: 0 1px 0 #fff, 0 0 18px rgba(236, 217, 160, .9);
}
.wordmark .mark { display: inline-block; width: 1.7rem; height: 1.7rem; margin-right: -.1rem; background: url("ornaments/starflower.svg") center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(110, 80, 160, .3)); }
.wordmark { min-width: 0; }
.wordmark .flourish { display: inline-block; flex: 0 1 6.5rem; min-width: 0; height: 1.7rem; background: url("ornaments/flourish.svg") center / contain no-repeat; }
.wordmark .flourish.flip { transform: scaleX(-1); }
.wordmark:hover { color: var(--wisteria-deep); }
.masthead-right { display: flex; align-items: center; gap: .35rem; justify-self: end; }
.icon-btn, .icon-spacer {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
}
.icon-btn {
  color: var(--wisteria-deep);
  background: radial-gradient(circle at 50% 35%, #fffdf7, #f7ecdc);
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fffaf2, 0 0 0 3px rgba(201, 162, 77, .55), 0 3px 8px -3px rgba(110, 70, 120, .35);
  cursor: pointer;
  padding: 0;
  transition: transform .12s ease, color .12s ease;
}
.icon-btn svg { width: 1.45rem; height: 1.45rem; }
.icon-btn:hover { color: var(--rose-ink); transform: translateY(-1px); }

.pansy { display: inline-grid; place-items: center; width: 2.9rem; height: 2.9rem; transition: transform .3s ease; }
.pansy svg { width: 2.75rem; height: 2.75rem; overflow: visible; filter: drop-shadow(0 1px 1.5px rgba(110, 70, 120, .3)); }
.pansy .petal { stroke: rgba(80, 50, 110, .35); stroke-width: .9; transition: fill .4s ease, opacity .4s ease; }
.pansy .petal:nth-of-type(3n+1) { fill: #c7b5ea; }
.pansy .petal:nth-of-type(3n+2) { fill: #f0b3c6; }
.pansy .petal:nth-of-type(3n)   { fill: #f4dc8a; }
.pansy .petal.spent { fill: #efe6da; opacity: .55; stroke-dasharray: 2 2; }
.pansy .heart { fill: #f2c94c; stroke: #b98a26; stroke-width: 1; }
.pansy:hover { transform: rotate(-12deg); }
.pansy.wilted svg { transform: rotate(18deg) translateY(2px); filter: grayscale(.5) drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); }

/* --- layout --------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 clamp(.6rem, 3vw, 1.6rem);
}
.chat-col { width: 100%; max-width: 47rem; margin: 0 auto; min-width: 0; }
.chat-col.narrow { max-width: 38rem; padding: 0 clamp(.6rem, 3vw, 1.6rem); }
.chat-col.wide { max-width: 60rem; padding: 0 clamp(.6rem, 3vw, 1.6rem); }

/* --- the almanac: earlier days ---------------------------------------------- */
.almanac {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: min(19rem, 86vw);
  padding: 1.4rem 1.2rem;
  overflow-y: auto;
  background: var(--noise), linear-gradient(180deg, #fffaf2, #fbefe6);
  border-right: 1px solid var(--gold-light);
  box-shadow: 8px 0 30px -12px rgba(90, 50, 110, .45);
  transform: translateX(-104%);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
}
body.almanac-open .almanac { transform: none; visibility: visible; }
body.almanac-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(70, 45, 90, .22);
}
.almanac h2 { font: 600 1.45rem/1.1 var(--display); margin: .2rem 0 .3rem; color: var(--ink-strong); letter-spacing: .02em; }
.almanac ul { list-style: none; margin: .5rem 0 0; padding: 0; }
.almanac li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .55rem;
  color: var(--ink);
  text-decoration: none;
  font: 600 1.12rem/1.2 var(--display);
  border-radius: 3px;
}
.almanac li a:hover { background: rgba(249, 221, 229, .6); }
.almanac li a[aria-current="page"] { background: linear-gradient(90deg, rgba(222, 210, 241, .85), rgba(222, 210, 241, 0)); color: var(--ink-strong); }
.almanac li.none { font-style: italic; color: var(--ink-soft); padding: .5rem; }
/* Pressed flowers: a heart and four petals, in five garden colours. */
.bloom { flex: none; width: 7px; height: 7px; margin: 7px; border-radius: 50%; background: #f2c94c; }
.bloom.b0 { box-shadow: 0 -6px 0 1px #c7b5ea, 0 6px 0 1px #c7b5ea, -6px 0 0 1px #c7b5ea, 6px 0 0 1px #c7b5ea; }
.bloom.b1 { box-shadow: 0 -6px 0 1px #f0b3c6, 0 6px 0 1px #f0b3c6, -6px 0 0 1px #f0b3c6, 6px 0 0 1px #f0b3c6; }
.bloom.b2 { box-shadow: 0 -6px 0 1px #f4dc8a, 0 6px 0 1px #f4dc8a, -6px 0 0 1px #f4dc8a, 6px 0 0 1px #f4dc8a; background: #e48a3c; }
.bloom.b3 { box-shadow: 0 -6px 0 1px #b9d3ad, 0 6px 0 1px #b9d3ad, -6px 0 0 1px #b9d3ad, 6px 0 0 1px #b9d3ad; }
.bloom.b4 { box-shadow: 0 -6px 0 1px #f7c9b5, 0 6px 0 1px #f7c9b5, -6px 0 0 1px #f7c9b5, 6px 0 0 1px #f7c9b5; }

@media (min-width: 1180px) {
  .layout { grid-template-columns: 15rem minmax(0, 47rem) 15rem; gap: 2rem; justify-content: center; }
  .almanac {
    position: sticky;
    top: 1rem;
    align-self: start;
    z-index: 1;
    max-height: calc(100vh - 2rem);
    width: auto;
    transform: none;
    visibility: visible;
    margin-top: 3.6rem;
    border: 1px solid var(--gold-light);
    border-radius: 4px;
    box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px rgba(201, 162, 77, .45), 0 12px 28px -16px rgba(110, 70, 120, .4);
  }
  .almanac-toggle { visibility: hidden; }
  body.almanac-open::after { display: none; }
}

/* --- the ribbon ------------------------------------------------------------- */
.ribbon { position: relative; z-index: 3; text-align: center; margin: 1rem 0 -1.15rem; }
.ribbon .label {
  position: relative;
  display: inline-block;
  padding: .42rem 2rem .48rem;
  font: 600 clamp(1.05rem, 3.4vw, 1.3rem)/1.2 var(--display);
  letter-spacing: .03em;
  color: #fffdf8;
  text-shadow: 0 1px 0 rgba(60, 30, 100, .45);
  background: linear-gradient(180deg, #c3a8e8 0%, #9d7fd0 55%, #8a6cc0 100%);
  border-top: 1px solid #e6d9f7;
  border-bottom: 1px solid #6f54a6;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 4px 8px -3px rgba(80, 50, 120, .45);
}
.ribbon .label::before, .ribbon .label::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: .45rem;
  width: 1.7rem;
  height: 100%;
  background: linear-gradient(180deg, #a68bd6, #7a5db5);
}
.ribbon .label::before { left: -1.25rem; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 38% 50%); }
.ribbon .label::after  { right: -1.25rem; clip-path: polygon(0 0, 100% 0, 62% 50%, 100% 100%, 0 100%); }

/* On a day's page the ribbon stays in reach: once the masthead has scrolled
   away it sticks to the top, and the masthead's controls bloom at its ends
   over a wash of the garden's blush — the composer's fade, mirrored. Nothing
   in it changes size when it sticks (the controls and the wash are laid over
   it, not beside it), so sticking never moves the page. */
.chat-page .ribbon { position: sticky; top: .45rem; z-index: 6; }
.chat-page .ribbon::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -.45rem -.6rem -1.25rem; /* -.6rem: the layout's narrowest side padding */
  background: linear-gradient(180deg, var(--fade) 0, var(--fade) 58%, rgba(246, 228, 238, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.rb-side {
  position: absolute;
  top: 50%;
  display: flex;
  align-items: center;
  gap: .3rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) scale(.85);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.rb-left { left: .15rem; }
.rb-right { right: .15rem; }
.rb-short { display: none; }
.icon-btn.mini { width: 2.3rem; height: 2.3rem; }
.icon-btn.mini svg { width: 1.2rem; height: 1.2rem; }
.pansy.mini { width: 2.4rem; height: 2.4rem; }
.pansy.mini svg { width: 2.25rem; height: 2.25rem; }
body.ribbon-stuck .ribbon::before { opacity: 1; }
body.ribbon-stuck .rb-side { opacity: 1; visibility: visible; transform: translateY(-50%); transition-delay: 0s; }
@media (max-width: 640px) {
  body.ribbon-stuck .rb-long { display: none; }
  body.ribbon-stuck .rb-short { display: inline; }
  body.ribbon-stuck .ribbon .label { padding-left: 1.3rem; padding-right: 1.3rem; }
}
@media (min-width: 1180px) { .rb-left { display: none; } }

/* --- the paper ------------------------------------------------------------- */
.paper {
  position: relative;
  z-index: 1;
  background:
    var(--noise),
    radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--paper), var(--paper-deep));
  border: 1px solid #e4cf9b;
  border-radius: 5px;
  box-shadow:
    0 0 0 5px var(--paper),
    0 0 0 6px #d8bd78,
    0 0 0 8px rgba(255, 250, 242, .9),
    0 0 0 9px rgba(201, 162, 77, .35),
    0 22px 44px -22px rgba(110, 60, 120, .45),
    0 3px 8px rgba(130, 90, 60, .12);
  padding: clamp(2.2rem, 5vw, 3.2rem) clamp(1.1rem, 4.4vw, 2.9rem) clamp(1.6rem, 4vw, 2.6rem);
  margin: 0 .6rem 1rem;
  min-height: 14rem;
}
.corner { position: absolute; width: 5.4rem; height: 5.4rem; pointer-events: none; background: url("ornaments/corner.svg") center / contain no-repeat; }
/* Never the scroll anchor: a bottom corner rides the paper's bottom edge, so
   anchored to it, every line streamed in above it scrolled the page down
   under someone reading a little way up. */
.corner { overflow-anchor: none; }
.corner.tl { top: -9px; left: -9px; }
.corner.tr { top: -9px; right: -9px; transform: scaleX(-1); }
.corner.bl { bottom: -9px; left: -9px; transform: scaleY(-1); }
.corner.br { bottom: -9px; right: -9px; transform: scale(-1, -1); }

.garland { display: block; width: min(20rem, 92%); height: 2rem; margin: 1.4rem auto; background: url("ornaments/garland.svg") center / contain no-repeat; }
.garland.small { width: 100%; height: 1.4rem; margin: .4rem 0 .6rem; }

/* --- greeting -------------------------------------------------------------- */
.greeting { text-align: center; padding: .4rem 0 .8rem; }
.greeting h1 { font: 600 clamp(1.7rem, 5vw, 2.25rem)/1.15 var(--display); margin: .5rem 0 .25rem; color: var(--ink-strong); letter-spacing: .01em; }
.greeting p { margin: 0 0 1.3rem; color: var(--ink-soft); font-size: 1.16rem; }
.seal { display: block; width: 4.6rem; height: 4.6rem; margin: 0 auto; background: url("ornaments/seal.svg") center / contain no-repeat; filter: drop-shadow(0 3px 3px rgba(120, 30, 70, .3)); transform: rotate(-8deg); }
.seeds { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
/* Seed packets: kraft paper with a printed inner border. */
.seed {
  font: 600 1.06rem/1 var(--display);
  color: var(--leaf-ink);
  padding: .7rem 1rem .66rem;
  background: var(--noise), linear-gradient(180deg, #fbf3e2, #f3e5c9);
  border: 1px solid #d9c49a;
  border-radius: 2px 2px 7px 7px;
  outline: 1px dashed rgba(156, 122, 46, .45);
  outline-offset: -5px;
  box-shadow: 0 2px 0 #e7d6b2, 0 6px 12px -8px rgba(110, 80, 40, .5);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}
.seed:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 3px 0 #e7d6b2, 0 10px 16px -8px rgba(110, 80, 40, .5); }
.seed:focus-visible { outline: 2px solid var(--wisteria); outline-offset: 2px; }

/* --- messages -------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; gap: 1.15rem; }
.msg { min-width: 0; overflow-wrap: anywhere; }
/* Only until app.js has laid the message out for real (`layOutRest`). */
.msg.deferred { content-visibility: auto; contain-intrinsic-size: auto 7rem; }
.msg.human {
  position: relative;
  align-self: flex-end;
  max-width: min(84%, 34rem);
  padding: .7rem 1.25rem .75rem 1.05rem;
  background: var(--noise), linear-gradient(170deg, #fdeef2, #f8d8e2);
  border: 1px solid #ebb7c7;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 7px 14px -9px rgba(160, 60, 100, .45);
  white-space: pre-wrap;
}
/* A turned-down corner. */
.msg.human::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 1rem;
  height: 1rem;
  background: linear-gradient(225deg, var(--paper) 49%, #e8b2c3 50%, #f6cfda 100%);
  border-bottom-left-radius: 3px;
  box-shadow: -1px 1px 2px rgba(150, 70, 100, .2);
}
.msg.agent { position: relative; padding-left: 2.7rem; }
.msg.agent::before { content: ""; position: absolute; left: -.15rem; top: -.2rem; width: 2.2rem; height: 2.2rem; background: url("ornaments/sprig.svg") center / contain no-repeat; }
.msg.agent.failed { opacity: .8; }
/* A reply being streamed is redrawn every frame; a browser that anchors its
   scroll position inside it (Firefox) nudges the page each time it grows. */
.msg.live { overflow-anchor: none; }

/* Plant markers for each call into ipheion. */
.tools { display: flex; flex-wrap: wrap; gap: .4rem; margin: .1rem 0 .55rem; }
.tool {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
  padding: .22rem .7rem .24rem .5rem;
  font: 600 .95rem/1.25 var(--display);
  color: var(--leaf-ink);
  background: linear-gradient(180deg, #f3f7ee, #e3edda);
  border: 1px solid #bcd2b2;
  border-radius: 2px 11px 2px 11px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 2px 4px -2px rgba(70, 100, 60, .4);
}
/* No :hover look: restyling the chip under a resting pointer moves the page
   in Firefox while a reply streams (perf/scroll.py, stream:scroll). */
button.tool { cursor: pointer; text-align: left; }
.tool:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tool[aria-expanded="true"] { background: linear-gradient(180deg, #e3edda, #f3f7ee); box-shadow: 0 1px 2px rgba(70, 100, 60, .3) inset; }
.tool .t-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .t-icon { flex: none; font-size: .9rem; line-height: 1; }
.tool.running .t-icon { animation: sway 1.2s ease-in-out infinite; }
.tool.failed { color: var(--rose-ink); background: linear-gradient(180deg, #fdf1f4, #f7dfe6); border-color: #ebbccb; }
/* The receipt a chip opens: the command in full, then what ipheion said. */
.receipt {
  margin: 0 0 .7rem;
  padding: .55em .85em .6em 1em;
  background: linear-gradient(180deg, #fffefa, #fdf8ec);
  border: 1px solid #ead9b0;
  border-left: 4px double var(--gold);
  border-radius: 2px;
  box-shadow: 0 6px 12px -10px rgba(110, 80, 40, .55);
}
.receipt .r-cmd { font: 600 .98rem/1.45 var(--display); color: var(--leaf-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.receipt .r-out { margin: .45em 0 0; padding-top: .45em; border-top: 1px dashed #ead9b0; max-height: 22rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; font: .84rem/1.45 ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, monospace; color: var(--ink-soft); }

/* Where the day's conversation was recapped for the model. Decoration only. */
.recap { display: flex; align-items: center; gap: .4rem; width: min(17rem, 78%); margin: 1.5rem auto; }
.recap::before, .recap::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.recap::after { background: linear-gradient(270deg, transparent, var(--gold)); }
.recap svg { width: .85rem; height: .85rem; color: #f0b3c6; }
.recap svg:nth-child(3) { color: #f4dc8a; }
.recap svg:nth-child(2) { color: #c7b5ea; transform: translateY(-2px) rotate(20deg); }

@keyframes sway { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }

.typing { display: inline-flex; gap: .3rem; align-items: center; height: 1.6rem; padding: 0 .2rem; }
.typing svg { width: .95rem; height: .95rem; animation: bob 1.1s ease-in-out infinite; }
.typing svg:nth-child(2) { animation-delay: .15s; }
.typing svg:nth-child(3) { animation-delay: .3s; }
.typing .t-word { font: 600 .98rem var(--display); color: var(--ink-soft); margin-left: .35rem; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(30deg); } }

.msg .err { display: block; margin-top: .45rem; padding: .55rem .8rem; color: var(--rose-ink); background: #fdf0f3; border: 1px solid #efc0ce; border-radius: 3px; font-size: 1.04rem; }

/* --- markdown ---------------------------------------------------------------- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .75em; }
.md strong { color: var(--ink-strong); font-weight: 700; }
.md em { font-style: italic; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--display); font-weight: 700; color: var(--ink-strong); line-height: 1.2; margin: 1.1em 0 .4em; letter-spacing: .01em; }
.md h1 { font-size: 1.5rem; } .md h2 { font-size: 1.35rem; } .md h3 { font-size: 1.2rem; } .md h4 { font-size: 1.08rem; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin: .18em 0; }
.md ul { list-style: none; padding-left: 1.3em; }
.md ul > li { position: relative; }
.md ul > li::before { content: ""; position: absolute; left: -1.05em; top: .62em; width: .42em; height: .42em; border-radius: 50% 0 50% 0; background: var(--blush-deep); transform: rotate(-20deg); }
.md ul > li.emoji-bullet::before { display: none; }
.md ul > li.emoji-bullet { margin-left: -1.3em; }
.md ol > li::marker { color: var(--rose-ink); font-family: var(--display); font-weight: 700; }
.md blockquote { margin: 0 0 .8em; padding: .2em 0 .2em 1em; border-left: 3px double var(--gold); color: var(--ink-soft); }
.md hr { height: 1px; margin: 1.1rem 0; border: 0; background: rgba(201, 162, 77, .6); }
/* A lunaria divider, in the attribute so it is neither copied nor read aloud.
   Flex centres one wider than the reply, so a small phone loses both ends, and
   the mask fades them. The height is fixed because its glyphs come from
   fallback fonts of any height, and roomy because the mask clips to it. */
.md hr[data-divider] {
  display: flex;
  justify-content: center;
  height: 2em;
  margin: .25rem 0;
  background: none;
  overflow: hidden;
  line-height: 2;
  color: var(--rose-ink);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.md hr[data-divider]::before { content: attr(data-divider); flex: none; white-space: pre; }
.md code { font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, monospace; font-size: .86em; padding: .05em .3em; background: #f4ecf8; border: 1px solid #e4d8ef; border-radius: 3px; color: var(--wisteria-deep); }
.md a { word-break: break-word; }
.md .divider {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  margin: .5em 0 .75em;
  color: var(--rose-ink);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
/* A receipt: the ledger slip each write is certified on. */
.md .slip {
  position: relative;
  margin: 0 0 .9em;
  padding: .7em 1em .75em 1.15em;
  white-space: pre-wrap;
  font: inherit;
  font-size: 1.04rem;
  line-height: 1.6;
  background:
    repeating-linear-gradient(180deg, transparent 0, transparent calc(1.6em - 1px), rgba(143, 114, 196, .13) calc(1.6em - 1px), rgba(143, 114, 196, .13) 1.6em) 0 .7em / 100% calc(100% - 1.4em) no-repeat,
    linear-gradient(180deg, #fffefa, #fdf8ec);
  border: 1px solid #ead9b0;
  border-left: 4px double var(--gold);
  border-radius: 2px;
  box-shadow: 0 6px 12px -10px rgba(110, 80, 40, .55);
  overflow-x: auto;
}
.md pre.code { margin: 0 0 .9em; padding: .7em .9em; background: #faf5fd; border: 1px solid #e4d8ef; border-radius: 3px; overflow-x: auto; font-size: .9rem; }
.md pre.code code { background: none; border: 0; padding: 0; color: var(--ink); }
.md table, table.ledger { border-collapse: collapse; margin: 0 0 1em; font-size: 1.03rem; width: 100%; }
.md .table-wrap { overflow-x: auto; margin: 0 0 1em; }
.md .table-wrap table { margin: 0; }
.md th, .md td, .ledger th, .ledger td { padding: .38em .7em; text-align: left; border-bottom: 1px solid rgba(201, 162, 77, .35); vertical-align: top; }
.md th, .ledger th { font: 700 1rem var(--display); color: var(--ink-strong); border-bottom: 2px solid rgba(201, 162, 77, .6); letter-spacing: .02em; }
.md tbody tr:nth-child(even), .ledger tbody tr:nth-child(even) { background: rgba(249, 221, 229, .35); }

/* --- composer --------------------------------------------------------------- */
.composer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: .8rem;
  padding: 1.6rem .6rem max(.9rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(246, 228, 238, 0), var(--fade) 38%);
}
.inkwell {
  background: var(--noise), linear-gradient(180deg, #fffdf9, #fdf7ec);
  border: 1px solid #dcc184;
  border-radius: 4px;
  box-shadow: inset 0 2px 5px rgba(120, 80, 60, .13), 0 0 0 3px var(--paper), 0 0 0 4px rgba(201, 162, 77, .5), 0 8px 18px -12px rgba(110, 60, 120, .5);
  transition: box-shadow .15s ease;
}
.inkwell:focus-within { box-shadow: inset 0 2px 5px rgba(120, 80, 60, .13), 0 0 0 3px var(--paper), 0 0 0 5px var(--wisteria), 0 8px 18px -12px rgba(110, 60, 120, .5); }
.inkwell textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  max-height: 40vh;
  padding: .72rem .95rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.14rem;
  line-height: 1.5;
  resize: none;
  outline: none;
}
.inkwell textarea::placeholder { color: #9d8aa8; font-style: italic; }
.inkwell textarea:disabled { cursor: not-allowed; }
.composer-note { grid-column: 1 / -1; margin: 0; text-align: center; color: var(--ink-soft); font-style: italic; }

/* --- plaques: every button -------------------------------------------------- */
.plaque {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: .55rem 1.35rem .6rem;
  font: 700 1.12rem/1 var(--display);
  letter-spacing: .07em;
  color: #fffaf6;
  text-decoration: none;
  text-shadow: 0 -1px 0 rgba(100, 20, 55, .55);
  background: linear-gradient(180deg, #eaa5ba 0%, #d06d8d 45%, #b54d72 100%);
  border: 1px solid #8e2f52;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    inset 0 0 0 2px rgba(255, 228, 236, .28),
    0 0 0 2px #ecd9a0,
    0 0 0 3px #a8843a,
    0 6px 12px -6px rgba(120, 40, 80, .55);
  cursor: pointer;
  transition: filter .12s ease, transform .08s ease;
}
.plaque::before, .plaque::after {
  content: "";
  width: .38rem;
  height: .38rem;
  margin: 0 .55rem;
  background: #fff1d0;
  transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(142, 47, 82, .6);
  opacity: .85;
}
.plaque:hover { filter: brightness(1.06) saturate(1.05); color: #fffaf6; }
.plaque:active { transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(90, 20, 50, .45), 0 0 0 2px #ecd9a0, 0 0 0 3px #a8843a; }
.plaque:disabled { filter: grayscale(.7) opacity(.65); cursor: not-allowed; }
.plaque.quiet {
  color: var(--ink);
  text-shadow: 0 1px 0 #fff;
  background: linear-gradient(180deg, #fffdf8, #f5ead6);
  border-color: #c9a24d;
}
.plaque.quiet::before, .plaque.quiet::after { background: var(--blush-deep); box-shadow: none; }
.composer .plaque { min-height: 3.1rem; margin-bottom: 1px; }
@media (max-width: 520px) {
  .composer .plaque::before, .composer .plaque::after { display: none; }
  .composer .plaque { padding: .55rem 1rem .6rem; }
}

.pressed { text-align: center; padding: .4rem 0 2.4rem; color: var(--ink-soft); font-style: italic; }
.pressed .garland { margin: .4rem auto .2rem; }
.pressed p { margin: 0 0 1rem; }

/* --- card pages: login, invitation ----------------------------------------- */
.card-wrap { max-width: 32rem; margin: 0 auto; padding: 1.4rem 1rem 3rem; display: flex; flex-direction: column; align-items: center; }
.wordmark.solo { margin: 0 0 1.4rem; }
.paper.card { width: 100%; margin: 0; text-align: center; }
.paper.card h1 { font: 600 clamp(1.6rem, 5vw, 2.05rem)/1.15 var(--display); margin: .6rem 0 1.1rem; color: var(--ink-strong); }
.overline { margin: .8rem 0 -.6rem; font: 600 1.05rem var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--rose-ink); }
.fields { display: grid; gap: .95rem; text-align: left; }
.fields label { display: grid; gap: .3rem; font: 700 1.08rem/1.2 var(--display); color: var(--ink-strong); letter-spacing: .015em; }
.fields label small { font: 400 .95rem/1.3 var(--serif); color: var(--ink-soft); letter-spacing: 0; }
.fields input, .fields select {
  width: 100%;
  min-height: 2.8rem;
  padding: .55rem .8rem;
  font: 400 1.11rem var(--serif);
  color: var(--ink);
  background: linear-gradient(180deg, #fffdf9, #fdf7ec);
  border: 1px solid #dcc184;
  border-radius: 3px;
  box-shadow: inset 0 2px 4px rgba(120, 80, 60, .1);
}
.fields input:focus, .fields select:focus { outline: none; border-color: var(--wisteria); box-shadow: inset 0 2px 4px rgba(120, 80, 60, .1), 0 0 0 3px rgba(143, 114, 196, .35); }
.fields fieldset { border: 1px solid rgba(201, 162, 77, .45); border-radius: 4px; padding: .9rem 1rem 1.1rem; margin: .3rem 0 0; display: grid; gap: .9rem; }
.fields legend { padding: 0 .5rem; font: 700 1.15rem var(--display); color: var(--rose-ink); }
.fields .plaque { justify-self: center; margin-top: .5rem; }
.fields.inline { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.fields.inline .plaque { margin: 0 0 1px; }
.row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.row.spread { justify-content: space-between; }
.aside { color: var(--ink-soft); font-size: 1.06rem; margin: 1rem 0 0; }
.aside.left { text-align: left; margin: 0 0 .9rem; }
.notice { margin: 0 0 1rem; padding: .6rem .9rem; text-align: left; color: var(--rose-ink); background: #fdf0f3; border: 1px solid #efc0ce; border-left: 4px solid var(--rose); border-radius: 3px; }
.notice.good { color: var(--leaf-ink); background: #f2f7ee; border-color: #c5dabc; border-left-color: var(--leaf); }
.code { font-family: var(--display); font-weight: 700; letter-spacing: .04em; }

/* --- settings ---------------------------------------------------------------- */
.settings-page .paper h2 { font: 700 1.45rem/1.2 var(--display); margin: 0 0 .8rem; color: var(--ink-strong); }
.allowance p { margin: .6rem 0 0; }
.gauge {
  position: relative;
  height: 1.3rem;
  border-radius: 3px;
  background: linear-gradient(180deg, #f1e8db, #fbf6ee);
  border: 1px solid #d6bd85;
  box-shadow: inset 0 2px 4px rgba(110, 80, 40, .2), 0 0 0 3px var(--paper), 0 0 0 4px rgba(201, 162, 77, .5);
  overflow: hidden;
}
.gauge .fill {
  height: 100%;
  width: 0;
  background: linear-gradient(180deg, #fff4c4, #f2cf5f 55%, #d9a630);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
  transition: width .6s ease;
}
.ledger td.code { white-space: nowrap; }
/* The gardener: three seed-packet cards, the chosen one pressed in lilac. */
.fields fieldset.choices { border: 0; padding: 0; margin: 0; gap: .55rem; }
.choice {
  position: relative;
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: .7rem;
  row-gap: 0 !important;
  padding: .7rem .9rem .7rem 2.6rem;
  background: var(--noise), linear-gradient(180deg, #fffdf8, #fbf3e4);
  border: 1px solid #dcc184;
  border-radius: 3px;
  box-shadow: 0 2px 0 #efe2c4, 0 6px 12px -10px rgba(110, 80, 40, .5);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.fields .choice input { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); width: 1.05rem; height: 1.05rem; min-height: 0; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; accent-color: var(--wisteria-deep); }
.choice .c-name { font: 700 1.15rem/1.2 var(--display); color: var(--ink-strong); }
.choice .c-blurb { font: 400 1.04rem/1.35 var(--serif); color: var(--ink-soft); letter-spacing: 0; }
.choice:hover { border-color: var(--wisteria); }
.choice:has(input:checked) { background: linear-gradient(180deg, #f6f0fd, #ece2f8); border-color: var(--wisteria); box-shadow: 0 0 0 1px var(--wisteria), 0 6px 12px -10px rgba(80, 50, 120, .5); }
.choice:has(input:focus-visible) { outline: 2px solid var(--wisteria); outline-offset: 2px; }
@media (max-width: 420px) { .choice { grid-template-columns: 1fr; } }

@media (max-width: 640px) {
  body { font-size: 1.09rem; }
  .wordmark .flourish { flex-basis: 3.2rem; }
  .corner { width: 3.8rem; height: 3.8rem; }
  .paper { margin: 0 .35rem .8rem; }
  .msg.agent { padding-left: 0; padding-top: 1.7rem; }
  .msg.agent::before { top: -.15rem; left: -.2rem; width: 1.8rem; height: 1.8rem; }
  .msg.human { max-width: 92%; }
  .fields.inline { grid-template-columns: 1fr; }
  .ledger { font-size: .95rem; }
}
@media (max-width: 380px) {
  .wordmark .flourish { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.md .al-r { text-align: right; }
.md .al-c { text-align: center; }
