/* If I Were the Grown-Up, digital (play/grown_up.templ).
   One board, two worlds. The Kid's half is crayon on cheap paper: Gochi Hand,
   a yellow highlighter swipe, a scribble in the corner. The Grown-Up's half is
   the site's own grown-up voice: forest green, Fraunces italic, a gold badge.
   The line between them is the timer, draining left to right.
   The one moving part is the "played by" name-tag sticker: Swap! flies the two
   across the line (grown-up.js), so the people change sides and the roles stay.
   Phone: halves stacked, read top to bottom. ≥760px: side by side, so the
   stickers cross sideways. No cards or piles (Story Sparks), no desk
   (What Happened Here?). */
.gu {
  --gu-paper: #fff6dc;
  --gu-crayon-ink: #3a2a1a;
  --gu-red: #d9412f;
  --gu-blue: #2c62c9;
  --gu-highlight: #ffd84a;
  --gu-forest: #1a3828;
  --gu-forest-deep: #11261b;
  --gu-cream: #f4ecd9;
  --gu-gold: #e8a84a;
  --gu-hand: "Gochi Hand", "Comic Sans MS", cursive;
  --gu-serif: "Fraunces", Georgia, serif;
}
.gu [x-cloak] { display: none !important; }

.gu-lede {
  margin: 0 0 1rem;
  max-width: 52ch;
  color: var(--slate);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* ---- Topic picker ------------------------------------------------------ */
.gu-topic {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
}
.gu-topic-label {
  flex: none;
  color: var(--gu-forest);
  font-weight: 700;
  font-size: 0.88rem;
}
.gu-topic select { width: auto; min-width: 12rem; min-height: 2.75rem; }

/* ---- The board --------------------------------------------------------- */
.gu-board {
  display: grid;
  grid-template-areas: "kid" "seam" "grown";
  border-radius: var(--radius-lg, 18px);
  box-shadow: 0 18px 40px rgba(26, 56, 40, 0.18), 0 3px 8px rgba(26, 56, 40, 0.1);
}
.gu-half {
  position: relative;
  display: grid;
  align-content: start;
  gap: 1rem;
  min-height: 15rem;
  padding: 1.25rem 1.25rem 1.5rem;
}
.gu-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.gu-role {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  white-space: nowrap;
}
.gu-body { display: grid; gap: 0.6rem; }
.gu-label {
  font: 700 0.72rem/1.3 "Montserrat", system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The Kid: crayon on paper. */
.gu-kid {
  grid-area: kid;
  border-radius: var(--radius-lg, 18px) var(--radius-lg, 18px) 0 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(217, 65, 47, 0.06), transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(44, 98, 201, 0.06), transparent 45%),
    var(--gu-paper);
  color: var(--gu-crayon-ink);
}
.gu-kid .gu-role {
  color: var(--gu-red);
  font: 400 clamp(1.9rem, 8vw, 2.4rem)/1 var(--gu-hand);
  rotate: -2deg;
}
.gu-situation {
  margin: 0;
  font: 400 clamp(1.25rem, 5vw, 1.45rem)/1.35 var(--gu-hand);
  text-wrap: pretty;
}
.gu-pile {
  justify-self: start;
  padding: 0.15rem 0.6rem;
  border: 2px solid var(--gu-blue);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; /* drawn, not ruled */
  color: var(--gu-blue);
  font: 400 1rem/1.2 var(--gu-hand);
}
.gu-pile-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
/* Swap the situation, keep the roles: a crayon button, drawn like the tag. */
.gu-new {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  border: 2px solid var(--gu-crayon-ink);
  border-radius: 15px 225px 15px 255px / 255px 15px 225px 15px;
  background: #fff;
  color: var(--gu-crayon-ink);
  font: 400 1.1rem/1 var(--gu-hand);
  cursor: pointer;
  transition: background 0.15s ease, rotate 0.2s ease;
}
.gu-new svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) { .gu-new:hover { background: var(--gu-highlight); rotate: -2deg; } }
.gu-new:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.gu-new:disabled { opacity: 0.5; cursor: default; }
.gu-title {
  margin: 0;
  color: var(--gu-crayon-ink);
  font: 400 clamp(1.8rem, 7.5vw, 2.3rem)/1.05 var(--gu-hand);
  text-wrap: balance;
}
.gu-title:focus { outline: none; }
.gu-wants { display: grid; gap: 0.3rem; margin: 0.4rem 0 0; }
.gu-wants .gu-label { color: var(--gu-red); }
.gu-wants mark {
  justify-self: start;
  padding: 0.05em 0.35em;
  background: linear-gradient(100deg, transparent 0.2em, var(--gu-highlight) 0.4em, var(--gu-highlight) calc(100% - 0.5em), transparent calc(100% - 0.2em));
  color: var(--gu-crayon-ink);
  font: 400 clamp(1.45rem, 6vw, 1.75rem)/1.25 var(--gu-hand);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.gu-scribble {
  position: absolute;
  top: calc(1.25rem + clamp(1.9rem, 8vw, 2.4rem) - 0.1rem);
  left: 1.1rem;
  width: 7.5rem;
  fill: none;
  stroke: var(--gu-red);
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.35;
  pointer-events: none;
}

/* The Grown-Up: the site's own sensible voice. */
.gu-grown {
  grid-area: grown;
  border-radius: 0 0 var(--radius-lg, 18px) var(--radius-lg, 18px);
  background:
    radial-gradient(ellipse 80% 60% at 50% 110%, var(--gu-forest-deep), transparent 70%),
    var(--gu-forest);
  color: var(--gu-cream);
}
.gu-grown .gu-role {
  font: italic 500 clamp(1.5rem, 6.5vw, 1.9rem)/1.1 var(--gu-serif);
}
.gu-badge { width: 2.4rem; height: 2.4rem; flex: none; fill: var(--gu-gold); }
.gu-badge-inner { fill: var(--gu-forest); }
.gu-grown .gu-label { color: var(--gu-gold); }
.gu-job,
.gu-talk {
  margin: 0;
  font: italic 500 clamp(1.45rem, 6vw, 1.8rem)/1.2 var(--gu-serif);
  text-wrap: balance;
}

/* Ideas tried: tap the ones you used, two to fill the dots. */
.gu-ideas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0 0;
  padding: 0;
  border: 0;
}
.gu-ideas legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  padding: 0;
  color: var(--gu-gold);
  font: 700 0.72rem/1.3 "Montserrat", system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gu-dots { display: inline-flex; gap: 0.35rem; }
.gu-dot {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--gu-gold);
  border-radius: 50%;
  transition: background 0.2s ease, scale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.gu-dot.is-on { background: var(--gu-gold); scale: 1.15; }
.gu-idea {
  min-height: 2.75rem;
  padding: 0 0.95rem;
  border: 1.5px solid rgba(244, 236, 217, 0.4);
  border-radius: 999px;
  background: transparent;
  color: var(--gu-cream);
  font: 600 0.9rem/1 "Montserrat", system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.gu-idea[aria-pressed="true"] {
  border-color: var(--gu-gold);
  background: var(--gu-gold);
  color: #24170a;
}
.gu-idea:focus-visible { outline: 3px solid var(--gu-cream); outline-offset: 2px; }
@media (hover: hover) {
  .gu-idea:hover:not([aria-pressed="true"]) { border-color: var(--gu-cream); }
}

/* ---- The sticker: a "played by" name tag ------------------------------- */
.gu-sticker {
  position: relative;
  z-index: 3; /* flies over the other half */
  display: grid;
  flex: none;
  min-width: 7.5rem;
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(26, 56, 40, 0.22), 0 1px 2px rgba(26, 56, 40, 0.2);
  text-align: center;
  rotate: 4deg;
  will-change: transform;
}
.gu-grown .gu-sticker { rotate: -3deg; }
.gu-sticker-by {
  padding: 0.25rem 0.6rem 0.2rem;
  background: var(--gu-red);
  color: #fff;
  font: 700 0.62rem/1.2 "Montserrat", system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.gu-sticker b {
  padding: 0.3rem 0.6rem 0.4rem;
  color: var(--gu-crayon-ink);
  font: 400 1.3rem/1.1 var(--gu-hand);
}

/* ---- The line between: the timer --------------------------------------- */
.gu-seam {
  grid-area: seam;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  padding: 0.5rem 1rem;
  background: var(--gu-cream);
  color: var(--gu-forest);
  border-block: 2px dashed rgba(26, 56, 40, 0.3);
}
.gu-seam-fill {
  position: absolute;
  inset: 0;
  background: rgba(232, 168, 74, 0.45);
  transform-origin: left;
  scale: var(--left, 1) 1;
  transition: scale 0.3s linear;
}
.gu:not(.is-play) .gu-seam-fill { opacity: 0; }
.gu-seam > :not(.gu-seam-fill) { position: relative; }
.gu-seam-note {
  font: italic 500 1.1rem/1.2 var(--gu-serif);
  text-align: center;
}
.gu-clock { display: flex; align-items: center; gap: 1rem; }
.gu-time {
  min-width: 3.2ch;
  font: 600 1.8rem/1 "Montserrat", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.gu-seam-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 2px solid var(--gu-forest);
  border-radius: 999px;
  background: #fff;
  color: var(--gu-forest);
  font: 700 0.9rem/1 "Montserrat", system-ui, sans-serif;
  cursor: pointer;
}
.gu-seam-btn[aria-pressed="true"] { background: var(--gu-forest); color: var(--gu-cream); }
.gu-seam-btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.gu-seam-btn svg,
.gu-btn svg {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gu.is-done .gu-seam { background: var(--gu-highlight); }

/* ---- Main action, under the thumb on a phone --------------------------- */
.gu-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(247, 245, 240, 0), var(--warm-white, #f7f5f0) 35%);
}
.gu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: min(100%, 22rem);
  min-height: 3.4rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: var(--radius, 9px);
  background: var(--teal);
  color: #fff;
  font: 700 1.05rem/1 "Montserrat", system-ui, sans-serif;
  box-shadow: 0 8px 18px rgba(27, 140, 138, 0.3);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
@media (hover: hover) { .gu-btn:hover { background: var(--teal-hover); } }
.gu-btn:active:not(:disabled) { transform: translateY(1px); }
.gu-btn:disabled { opacity: 0.6; cursor: default; }
.gu-btn:focus-visible { outline: 3px solid var(--gu-forest); outline-offset: 3px; }

/* New content settles in after each swap. */
.gu-body { animation: gu-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes gu-in { from { opacity: 0; translate: 0 0.5rem; } }

/* ---- Wide screens: side by side ---------------------------------------- */
@media (min-width: 760px) {
  .gu-lede { font-size: 1.05rem; }
  .gu-board {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "kid grown" "seam seam";
  }
  .gu-half { min-height: 24rem; padding: 2rem 2rem 2.25rem; gap: 1.25rem; }
  .gu-scribble { top: calc(2rem + 2.3rem); left: 1.85rem; }
  .gu-kid { border-radius: var(--radius-lg, 18px) 0 0 0; }
  .gu-grown { border-radius: 0 var(--radius-lg, 18px) 0 0; }
  .gu-seam { border-bottom: 0; border-radius: 0 0 var(--radius-lg, 18px) var(--radius-lg, 18px); overflow: hidden; }
  .gu-actions { position: static; padding: 1.5rem 0 0; background: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gu-body { animation: none; }
  .gu-seam-fill,
  .gu-dot { transition: none; }
}
