/* Clean and quiet: white cards on warm paper, soft depth, one ink colour and
   the red name tag as the only loud thing. Each place tints the background,
   so a change of context still reads as a change of room. */
:root {
  --ink: #10131f;
  --ink-2: #3b4055;
  --muted: #6c7186;
  --line: rgba(16, 19, 31, 0.09);
  --paper: #f6f5f1;
  --white: #ffffff;
  --red: #e2392d;
  --accent: #2f4fe0;
  --green: #0e9f62;
  --amber: #e39a12;
  --violet: #6a58e0;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --shadow-1: 0 1px 2px rgba(16, 19, 31, 0.06), 0 10px 28px -16px rgba(16, 19, 31, 0.28);
  --shadow-2: 0 2px 4px rgba(16, 19, 31, 0.06), 0 26px 50px -26px rgba(16, 19, 31, 0.5);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --tint: #fbead2;
  --pop: #d9822b;
  color-scheme: light;
}
.tone-ember { --tint: #fbead2; --pop: #d9822b; }
.tone-plum { --tint: #ebe5fb; --pop: #6a58e0; }
.tone-ocean { --tint: #dcebfa; --pop: #2f6fe0; }
.tone-rose { --tint: #fbe2e7; --pop: #d6456e; }
.tone-moss { --tint: #def0e0; --pop: #2e9153; }
.tone-dawn { --tint: #fde7da; --pop: #de6a3a; }
.tone-night { --tint: #e3e6f7; --pop: #3d49c9; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: #e9e7e1;
  color: var(--ink);
  font: 16px/1.42 var(--body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#app {
  position: relative;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  overflow: hidden;
}
#app[data-screen="play"], #app[data-screen="door"] { height: 100dvh; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; text-align: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
img { display: block; }

.door, .play, .summary { position: relative; isolation: isolate; background: linear-gradient(180deg, var(--tint) 0%, var(--paper) 68%); }

.eyebrow, .where {
  font: 600 11px/1 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede { color: var(--muted); font-size: 15px; }
.lede b { color: var(--ink); font-weight: 600; }
.lede.left { text-align: left; }
.fine { color: var(--muted); font-size: 12.5px; }
/* A small label in front of a line. */
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: rgba(16, 19, 31, 0.06); color: var(--ink-2); font: 600 10.5px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.badge.violet { background: rgba(106, 88, 224, 0.12); color: var(--violet); }
.badge.blue { background: rgba(47, 79, 224, 0.1); color: var(--accent); }
.badge.green { background: rgba(14, 159, 98, 0.12); color: var(--green); }
.badge.amber { background: rgba(227, 154, 18, 0.16); color: #96610a; }
.badge.plain { background: var(--white); box-shadow: inset 0 0 0 1px var(--line); padding: 6px 10px; }

.brand { display: flex; align-items: center; gap: 8px; font: 700 18px/1 var(--display); letter-spacing: -0.03em; }
.brand b { color: var(--red); font-weight: 700; }
.mini-tag { width: 24px; height: 19px; border-radius: 5px; background: var(--red); padding: 6px 2px 2px; }
.mini-tag i { display: block; height: 100%; border-radius: 2px; background: var(--white); }

.icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.icon:active { background: var(--line); }
.icon svg, .key svg, .chain svg, .streak svg, .skill > svg, .steps svg, .levelup svg, .seal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.go {
  display: block;
  width: 100%;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--white);
  font: 600 17px/1 var(--display);
  letter-spacing: -0.01em;
  text-align: center;
  box-shadow: 0 10px 22px -12px rgba(16, 19, 31, 0.7);
  transition: transform 0.12s var(--ease), background 0.12s;
}
.go:active { transform: scale(0.98); background: #232840; }
.go.ghost { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1); }
.go.ghost:active { background: #f1f0ec; }
.go.small { width: auto; min-width: 140px; padding: 14px 26px; font-size: 16px; }
.text { color: var(--ink-2); font-size: 14px; font-weight: 600; padding: 10px 12px; text-align: center; }
.text:active { opacity: 0.6; }

/* ---------- name tag ---------- */
.tag {
  width: 186px;
  border-radius: 12px;
  background: var(--red);
  padding: 0 4px 4px;
  box-shadow: 0 1px 2px rgba(16, 19, 31, 0.18), 0 14px 26px -12px rgba(16, 19, 31, 0.55);
  transition: background 0.25s;
}
.tag-top { display: flex; align-items: baseline; justify-content: center; gap: 6px; height: 25px; color: var(--white); }
.tag-top b { font: 700 13px/25px var(--display); letter-spacing: 0.16em; }
.tag-top span { font: 500 9.5px/25px var(--body); letter-spacing: 0.03em; opacity: 0.9; }
.tag-name {
  height: 50px;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 27px/1 var(--display);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
}
.tag .ghost { color: rgba(16, 19, 31, 0.18); }
.tag .caret { width: 2px; height: 28px; margin-left: 2px; border-radius: 2px; background: var(--accent); animation: blink 1.1s steps(2, start) infinite; }
.tag .ghost:not(:empty) + .caret, .tag.kept .caret, .small .caret { display: none; }
@keyframes blink { to { visibility: hidden; } }
.tag.wobble { animation: wobble 0.26s; }
@keyframes wobble { 25% { transform: translateX(-6px); } 60% { transform: translateX(5px); } }
.tag.kept { background: var(--amber); }
.tag .ch { display: inline-block; }
.tag .ch.in { animation: ink 0.16s var(--ease); }
@keyframes ink { from { opacity: 0; transform: translateY(6px) scale(1.25); } }

/* ---------- portrait ---------- */
.figure { position: relative; width: var(--face, 230px); margin: 0 auto; padding-bottom: 40px; }
.figure .face {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 5px var(--white), var(--shadow-2);
}
.figure.soft .face { border-radius: 26%; object-position: 50% 30%; }
.figure .face.flip { transform: scaleX(-1); }
/* While a photo is being fetched again, show a quiet pulse instead of the alt text. */
.figure .face.missing { color: transparent; animation: waiting 1.2s ease-in-out infinite alternate; }
@keyframes waiting { from { background: var(--white); } to { background: var(--line); } }
.figure .tag { position: absolute; left: 50%; bottom: 0; margin-left: -93px; z-index: 3; }
.figure.small { --face: 104px; padding-bottom: 24px; }
.figure.small .face { box-shadow: 0 0 0 3px var(--white), var(--shadow-1); }
.figure.small .tag { width: 96px; margin-left: -48px; padding: 0 3px 3px; border-radius: 7px; box-shadow: 0 6px 14px -8px rgba(16, 19, 31, 0.5); }
.figure.small .tag-top { height: 12px; }
.figure.small .tag-top b { font-size: 7px; line-height: 12px; }
.figure.small .tag-top span { display: none; }
.figure.small .tag-name { height: 24px; font-size: 13.5px; border-radius: 4px; }
.halo { position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 3px var(--green); opacity: 0; z-index: 1; pointer-events: none; }
.figure.soft .halo { border-radius: 26%; }
/* A thin ring pulses outward while they are talking. */
.figure.speaking::before, .figure.speaking::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid var(--pop);
  opacity: 0;
  z-index: -1;
  animation: sonar 2s ease-out infinite;
}
.figure.soft.speaking::before, .figure.soft.speaking::after { border-radius: 26%; }
.figure.speaking::after { animation-delay: 1s; }
@keyframes sonar { 0% { opacity: 0.55; transform: scale(1.04); } 100% { opacity: 0; transform: scale(1.3); } }

/* ---------- door ---------- */
.door { height: 100%; display: flex; flex-direction: column; padding: max(18px, env(safe-area-inset-top)) 24px max(26px, env(safe-area-inset-bottom)); }
.door-main { display: grid; gap: 12px; }
.door-tag { flex: 1; min-height: 120px; display: grid; place-items: center; }
.door-tag .tag { width: 250px; padding: 0 6px 6px; border-radius: 16px; transform: rotate(-4deg); box-shadow: 0 2px 4px rgba(16, 19, 31, 0.14), 0 40px 60px -30px rgba(16, 19, 31, 0.6); animation: sway 6s ease-in-out infinite alternate; }
.door-tag .tag-top { height: 36px; gap: 8px; }
.door-tag .tag-top b { font-size: 19px; line-height: 36px; }
.door-tag .tag-top span { font-size: 12px; line-height: 36px; }
.door-tag .tag-name { height: 74px; border-radius: 10px; }
.door-tag .caret { height: 40px; width: 3px; }
@keyframes sway { to { transform: rotate(-2deg) translateY(-8px); } }
.door h1 { font: 700 44px/1 var(--display); letter-spacing: -0.035em; }
.door .lede { font-size: 17px; max-width: 19em; color: var(--ink-2); }
.door .go { margin-top: 10px; }
.door .fine { text-align: center; }
.how { list-style: none; counter-reset: how; display: grid; gap: 9px; margin: 2px 0 4px; padding: 0; max-width: 320px; text-align: left; font-size: 14.5px; line-height: 1.35; color: var(--ink-2); }
.how li { counter-increment: how; display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; }
.how li::before { content: counter(how); width: 22px; height: 22px; border-radius: 50%; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; font: 600 12px/1 var(--display); color: var(--ink); }
.door .mystery-row { margin-bottom: 18px; }
.door .mystery { width: 84px; height: 84px; margin-left: -16px; }
.door .mystery:first-child { margin-left: 0; }

.mystery-row { display: flex; align-items: center; }
.mystery {
  position: relative;
  width: 52px;
  height: 52px;
  margin-left: -10px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--white), 0 6px 14px -8px rgba(16, 19, 31, 0.5);
  background: var(--white);
}
.mystery:first-child { margin-left: 0; }
.mystery img { width: 100%; height: 100%; object-fit: cover; filter: blur(7px) saturate(0.7) brightness(0.86); transform: scale(1.25); }
.mystery b { position: absolute; inset: 0; display: grid; place-items: center; font: 600 20px/1 var(--display); color: var(--white); }
.door .mystery b { font-size: 32px; }
.mystery.more { display: grid; place-items: center; font: 600 14px/1 var(--display); color: var(--ink-2); background: var(--white); }

/* ---------- home ---------- */
/* "backwards" only: a filling transform would trap the fixed sheet inside .home. */
.home, .summary, .door { animation: screen 0.36s var(--ease) backwards; }
@keyframes screen { from { opacity: 0; transform: translateY(8px); } }
.home { min-height: 100dvh; align-content: start; padding: max(12px, env(safe-area-inset-top)) 16px 40px; display: grid; gap: 14px; }
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.home-tools { display: flex; align-items: center; gap: 4px; }
.streak { display: inline-flex; align-items: center; gap: 4px; padding: 7px 11px 7px 8px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); font: 600 14px/1 var(--display); font-variant-numeric: tabular-nums; }
.streak svg { width: 16px; height: 16px; color: var(--amber); fill: var(--amber); stroke: none; }

.today, .skill, .pledge { border-radius: 22px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1); }
.today { position: relative; overflow: hidden; padding: 20px; display: grid; gap: 14px; }
.today::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 110px; background: linear-gradient(180deg, var(--tint), transparent); pointer-events: none; }
.today > * { position: relative; }
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.today-head h2 { margin-top: 8px; font: 700 28px/1.05 var(--display); letter-spacing: -0.03em; }
.steps { list-style: none; display: grid; gap: 2px; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 13px/1 var(--display); font-style: normal; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.steps li.now i { background: var(--ink); color: var(--white); box-shadow: none; }
.steps li.done i { background: var(--green); color: var(--white); box-shadow: none; }
.steps li.done i svg { width: 15px; height: 15px; stroke-width: 2.6; }
.steps b { display: block; font: 600 16px/1.25 var(--display); letter-spacing: -0.01em; }
.steps span { display: block; font-size: 13px; color: var(--muted); }
.steps li.done b { color: var(--ink-2); }
.today-extras { display: grid; gap: 10px; }
.today .fine { text-align: center; }

.ring-meter { position: relative; flex: none; width: 58px; height: 58px; display: grid; place-items: center; }
.ring-meter svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-meter circle { fill: none; stroke: var(--line); stroke-width: 5; }
.ring-meter circle.fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease); }
.ring-meter b { position: relative; font: 700 17px/1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.skill { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; padding: 18px 16px 16px 18px; width: 100%; }
.skill .ring-meter b { font-size: 22px; }
.skill-main { display: grid; gap: 5px; min-width: 0; }
.skill-main b { font: 700 21px/1 var(--display); letter-spacing: -0.02em; }
.skill-main .lede { font-size: 13px; line-height: 1.35; }
.skill > svg { color: var(--muted); }
.stat-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.stat-row span { display: grid; gap: 4px; font-size: 11.5px; line-height: 1.25; color: var(--muted); }
.stat-row b { font: 700 20px/1 var(--display); letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }

.playbook { display: grid; gap: 10px; padding: 6px 4px 0; }
.playbook-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.playbook-head h3, .people-head h3 { font: 700 17px/1 var(--display); letter-spacing: -0.02em; }
.playbook-row { display: flex; flex-wrap: wrap; gap: 7px; }
.move-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 6px 6px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); font: 600 12.5px/1 var(--display); }
.move-chip i { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--white); display: grid; place-items: center; font: 600 11px/1 var(--display); font-style: normal; }
.move-chip.locked { opacity: 0.45; }
.move-chip em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.move-chip em.real { background: rgba(14, 159, 98, 0.12); color: var(--green); padding: 3px 6px; border-radius: 999px; font-size: 11px; }
.pledge { padding: 16px 18px; display: grid; gap: 10px; transition: opacity 0.25s, transform 0.25s; }
.pledge .eyebrow { display: flex; align-items: center; gap: 7px; }
.pledge .eyebrow i { width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: var(--white); display: grid; place-items: center; font: 600 10px/1 var(--display); font-style: normal; letter-spacing: 0; }
.pledge h3 { font: 600 18px/1.25 var(--display); letter-spacing: -0.015em; }
.pledge-actions { display: flex; align-items: center; gap: 10px; }
.pledge-actions .go { width: auto; min-width: 0; padding: 12px 26px; margin: 0; }
.pledge.gone { opacity: 0; transform: translateY(-6px); }

.people { padding: 6px 4px 0; display: grid; gap: 14px; }
.people-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.people-head p, .playbook-head button { font-size: 13px; color: var(--muted); }
.playbook-head button { font-weight: 600; color: var(--accent); }
.peeps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; }
.peep { display: grid; justify-items: center; gap: 6px; min-width: 0; }
.peep .ring { position: relative; width: 62px; height: 62px; border-radius: 50%; padding: 3px; box-shadow: inset 0 0 0 1.5px var(--line); }
.peep.known .ring { box-shadow: inset 0 0 0 2px var(--green); }
.peep.due .ring { box-shadow: inset 0 0 0 2px var(--red); }
.peep.due .ring::after { content: ""; position: absolute; right: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--paper); }
.peep img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.peep.owed img { filter: saturate(0.55); }
.peep .chip { max-width: 100%; font: 500 12px/1.2 var(--display); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peep.known .chip { color: var(--ink); font-weight: 600; }
.peep.due .chip { color: var(--red); font-weight: 600; }
.proto { margin-top: 18px; padding: 14px; border-radius: 14px; border: 1px dashed rgba(16, 19, 31, 0.2); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; color: var(--muted); }
.proto p { width: 100%; font: 600 11px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; }
.proto button, .proto a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; }

.sheet { position: fixed; inset: 0; z-index: 20; display: grid; align-items: end; background: rgba(16, 19, 31, 0.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade 0.18s; }
.sheet[hidden] { display: none; }
.sheet-card { position: relative; width: min(100%, 460px); max-height: 88dvh; overflow-y: auto; margin: 0 auto; background: var(--white); border-radius: 26px 26px 0 0; padding: 30px 22px max(28px, env(safe-area-inset-bottom)); display: grid; gap: 12px; justify-items: center; text-align: center; animation: rise 0.3s var(--ease); }
.sheet-card .figure.small { --face: 150px; padding-bottom: 34px; }
.sheet-card .figure.small .tag { width: 140px; margin-left: -70px; }
.sheet-card .figure.small .tag-name { height: 34px; font-size: 20px; }
.sheet-card .figure.small .tag-top { height: 18px; }
.sheet-card .figure.small .tag-top b { font-size: 10px; line-height: 18px; }
.sheet-card .close { position: absolute; top: 10px; right: 10px; }
.sheet-card h2 { font: 700 25px/1.1 var(--display); letter-spacing: -0.03em; }
.quote { font-size: 15px; max-width: 22em; color: var(--ink-2); }
.why { list-style: none; display: grid; gap: 16px; text-align: left; width: 100%; }
.why li { display: grid; grid-template-columns: 26px 1fr; gap: 4px 12px; align-items: start; }
.why i { grid-row: span 3; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--white); display: grid; place-items: center; font: 600 13px/1 var(--display); font-style: normal; }
.why b { font: 600 16px/1.25 var(--display); letter-spacing: -0.01em; }
.why span { font-size: 14px; color: var(--ink-2); }
.why small { font-size: 12.5px; color: var(--muted); }
.caveat { text-align: left; font-size: 13px; padding: 12px 14px; border-radius: 12px; background: var(--paper); color: var(--ink-2); }
.levels { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.levels th, .levels td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.levels thead th { font: 600 10.5px/1.2 var(--display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); vertical-align: bottom; }
.levels tbody th { font-weight: 700; }
.levels td { color: var(--ink-2); }
.levels tr.here th, .levels tr.here td { background: rgba(47, 79, 224, 0.08); color: var(--accent); font-weight: 700; }
.rules { list-style: none; display: grid; gap: 8px; text-align: left; font-size: 14px; color: var(--ink-2); width: 100%; }
.rules b { color: var(--ink); font-weight: 600; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* ---------- play ---------- */
.play { height: 100%; display: grid; grid-template-rows: auto 1fr auto auto; padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 0; }
.track { flex: 1; display: flex; gap: 4px; padding: 0 4px; }
.track i { flex: 1; height: 4px; border-radius: 2px; background: rgba(16, 19, 31, 0.12); transition: background 0.3s; }
.track i.t-card { flex: 0 0 4px; }
.track i.done { background: var(--ink); }
.track i.now { background: var(--accent); }
.chain { display: flex; align-items: center; gap: 3px; padding: 6px 10px 6px 7px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); font: 600 13px/1 var(--display); font-variant-numeric: tabular-nums; opacity: 0; transform: scale(0.9); transition: opacity 0.2s, transform 0.2s; }
.chain svg { width: 14px; height: 14px; fill: var(--amber); stroke: none; }
.chain span { margin-left: 2px; font-weight: 500; font-size: 12px; color: var(--muted); }
.chain.on { opacity: 1; transform: none; }
.chain.tick { animation: tick 0.36s var(--ease); }
@keyframes tick { 40% { transform: scale(1.18); } }

.stage { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 1.6vh, 16px); padding: 6px 20px 2px; text-align: center; --face: clamp(150px, min(60vw, 30vh), 260px); }
.where { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 9px; animation: drop 0.4s var(--ease) both; }
/* Nothing in the stage is squeezed to fit. fitStage() in game.js makes the photo smaller when there is more to show. */
.stage > * { flex-shrink: 0; }
.stage.tight { justify-content: flex-start; overflow-y: auto; }
.stage.tight .where { display: none; }
@media (max-height: 620px) {
  .key { height: 36px; }
  .kb { gap: 6px; padding-top: 6px; }
  .moves { min-height: 44px; padding-bottom: 6px; }
}

.where b { padding: 6px 10px 6px 6px; border-radius: 999px; background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); letter-spacing: 0.06em; font-size: 10.5px; display: inline-flex; align-items: center; gap: 6px; }
.where b i { font-style: normal; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); color: var(--white); display: grid; place-items: center; font-size: 9.5px; letter-spacing: 0; }
.bubble {
  position: relative;
  max-width: 330px;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1);
  font: 500 16px/1.36 var(--body);
  text-align: left;
  margin-bottom: 4px;
  animation: pop 0.34s 0.16s var(--ease) both;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: var(--white); box-shadow: 1px 1px 0 var(--line); border-radius: 0 0 3px 0; transform: rotate(45deg); }
.bubble .w { opacity: 0; animation: word 0.2s forwards; }
/* With sound on, game.js shows each word as it is spoken. */
.bubble .timed .w { animation: none; transition: opacity 0.1s; }
.bubble .timed .w.on { opacity: 1; }
.bubble .w.name { color: var(--red); font-weight: 700; }
.bubble .tell { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; justify-items: start; font-size: 14px; line-height: 1.35; color: var(--ink-2); }
.bubble .tell[hidden] { display: none; }
.bubble .tell .badge { margin-bottom: 2px; }
.bubble .tell b { font: 700 16px/1.25 var(--display); color: var(--ink); letter-spacing: -0.01em; }
.bubble .asked { margin-bottom: 7px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.bubble .asked[hidden] { display: none; }
@keyframes word { to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(8px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

.play .figure { animation: arrive 0.46s var(--ease) both; }
@keyframes arrive { from { opacity: 0; transform: translateX(34px) scale(0.94); } }
.play[data-type="greet"] .figure { animation-name: arrive-left; }
@keyframes arrive-left { from { opacity: 0; transform: translateX(-34px) scale(0.94); } }
.play .figure .tag { animation: slap 0.3s 0.26s var(--ease) both; }
@keyframes slap { from { opacity: 0; transform: translateY(10px) scale(1.08); } }
.coach { min-height: 20px; max-width: 320px; font: 600 15px/1.35 var(--display); color: var(--ink); }
.tip { max-width: 320px; display: grid; gap: 5px; justify-items: start; text-align: left; padding: 9px 12px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.72); box-shadow: inset 0 0 0 1px var(--line); font: 400 13.5px/1.35 var(--body); color: var(--ink-2); }
.tip:empty { display: none; }

/* The person steps away before the next one arrives. */
.play.leaving .figure { animation: leave 0.23s ease-in forwards; }
.play.leaving .bubble, .play.leaving .where, .play.leaving .coach, .play.leaving .tip, .play.leaving .moves { opacity: 0; transition: opacity 0.16s; }
@keyframes leave { to { opacity: 0; transform: translateY(-18px) scale(0.96); } }

.moves { display: flex; justify-content: center; gap: 8px; min-height: 52px; padding: 2px 16px 10px; }
.move { padding: 11px 18px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line), 0 6px 14px -10px rgba(16, 19, 31, 0.4); font: 600 14px/1 var(--display); color: var(--ink-2); }
.move:active { background: #f1f0ec; }
.move:disabled { opacity: 0.35; }
.move.mic { display: inline-flex; align-items: center; gap: 7px; padding: 9px 17px 9px 13px; transition: background 0.15s, color 0.15s; }
.move.mic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.move.mic[data-mode="listening"] { background: var(--red); color: var(--white); box-shadow: 0 0 0 0 rgba(226, 57, 45, 0.45); animation: hearing 1.3s ease-out infinite; }
.move.mic[data-mode="working"] { opacity: 0.6; }
@keyframes hearing { to { box-shadow: 0 0 0 12px rgba(226, 57, 45, 0); } }

/* Linking a name: takes the keyboard's place once the name is on the tag. */
.play[data-linking] .kb, .play[data-linking] .moves { display: none; }
.link { display: grid; gap: 8px; padding: 14px 16px max(12px, env(safe-area-inset-bottom)); background: rgba(16, 19, 31, 0.06); border-top: 1px solid var(--line); animation: rise 0.22s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.link-q { font: 600 15px/1.3 var(--display); color: var(--ink); text-align: center; margin-bottom: 2px; }
.link-row { min-height: 46px; padding: 10px 14px; border-radius: 12px; background: var(--white); box-shadow: 0 1px 0 rgba(16, 19, 31, 0.2); font: 600 15px/1.25 var(--display); color: var(--ink); text-align: left; }
.link-row:active { background: #eceef6; }
.link > .text { justify-self: center; padding: 6px 12px; color: var(--muted); }
.link-own { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.link-own input { min-width: 0; height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); font: 500 16px/1 var(--body); color: var(--ink); }
.link-own input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.link-own .go.small { height: 46px; }
/* Choosing a picture for a name. */
.pic-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pic-tile { display: grid; justify-items: center; gap: 2px; padding: 6px 6px 9px; border-radius: 14px; background: var(--white); box-shadow: 0 1px 0 rgba(16, 19, 31, 0.2); color: var(--ink); min-width: 0; }
.pic-tile:active { background: #eceef6; transform: scale(0.97); }
.pic-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; background: var(--paper); margin-bottom: 4px; }
.pic-tile b { font: 700 15px/1.2 var(--display); letter-spacing: -0.01em; }
.pic-tile span { font: 500 11.5px/1.2 var(--body); color: var(--muted); text-align: center; }
.link-more { display: flex; justify-content: center; gap: 4px; }
.link-more .text { padding: 6px 10px; color: var(--muted); white-space: nowrap; }
@media (max-width: 350px) { .link-more { gap: 0; } .link-more .text { padding: 6px 7px; font-size: 14px; } .pic-row { gap: 8px; } .pic-tile b { font-size: 13.5px; } .pic-tile span { font-size: 11px; } }
/* On a short screen the pictures give room back to the face. */
@media (max-height: 640px) {
  .link.pics { gap: 6px; padding-top: 10px; }
  .pic-tile { padding: 5px 5px 7px; }
  .pic-tile img { width: 68%; margin-bottom: 2px; }
}
.link.pics { padding-top: 12px; }
/* The chosen picture, beside the face it now belongs to. */
.figure .pinned { position: absolute; right: -14px; top: -6px; width: 34%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; border: 3px solid var(--white); box-shadow: var(--shadow-1); z-index: 4; animation: pin 0.34s var(--ease) both; }
@keyframes pin { from { opacity: 0; transform: scale(0.6) rotate(8deg); } }
.pic { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line), 0 0 0 1px var(--line); }
.mine { display: flex; align-items: center; gap: 10px; }
.yours { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; font-size: 14px; color: var(--ink-2); }

.kb { padding: 9px 4px max(9px, env(safe-area-inset-bottom)); background: rgba(16, 19, 31, 0.06); border-top: 1px solid var(--line); display: grid; gap: 8px; user-select: none; -webkit-user-select: none; }
.kb-row { display: flex; gap: 5px; }
.kb-row.inset { padding: 0 5%; }
.key { flex: 1; height: clamp(40px, 5.8vh, 48px); border-radius: 7px; background: var(--white); box-shadow: 0 1px 0 rgba(16, 19, 31, 0.28); font: 500 18px/1 var(--display); display: grid; place-items: center; transition: transform 0.05s, background 0.05s; }
.key.down, .key:active { background: #dfe2ee; transform: scale(0.96); }
.key.wide { flex: 1.55; background: #d9dbe4; font-size: 14px; color: var(--ink-2); }
.key.say { font: 600 14px/1 var(--display); opacity: 0.6; }
.key.say.ready { opacity: 1; background: var(--accent); color: var(--white); }
.play[data-phase="win"] .kb, .play[data-phase="story"] .kb, .play[data-phase="met"] .kb, .play[data-phase="relearned"] .kb { opacity: 0.4; pointer-events: none; transition: opacity 0.2s; }

/* Meeting: the tag confirms the name. */
.play[data-phase="met"] .tag, .play[data-phase="relearned"] .tag { animation: stamp 0.3s var(--ease); }
@keyframes stamp { 40% { transform: scale(1.08); } }

/* Remembering: a green ring, the tag turns green, and you say it. */
.shout {
  position: absolute;
  left: 50%;
  top: -14px;
  z-index: 4;
  white-space: nowrap;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
  font: 700 clamp(19px, 5.6vw, 23px)/1 var(--display);
  letter-spacing: -0.02em;
  box-shadow: 0 14px 28px -12px rgba(14, 159, 98, 0.8);
  transform: translateX(-50%) translateY(10px) scale(0.8);
  opacity: 0;
  pointer-events: none;
}
.shout:empty { display: none; }
.play[data-phase="win"] .shout { animation: shout 0.42s cubic-bezier(0.2, 1.3, 0.3, 1) forwards; }
@keyframes shout { to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
.play[data-phase="win"] .bubble { transform: translateY(-14px); transition: transform 0.25s var(--ease); }
/* Once you've answered, the line at the top has done its job. Hiding it gives the reply room. */
.play[data-phase="win"] .where, .play[data-phase="story"] .where, .play[data-phase="told"] .where, .play[data-phase="relearned"] .where { animation: none; opacity: 0; transition: opacity 0.15s; }
.play[data-phase="win"] .face, .play[data-phase="story"] .face { animation: lit 0.5s var(--ease) forwards; }
.play[data-phase="win"] .face.flip, .play[data-phase="story"] .face.flip { animation-name: lit-flip; }
@keyframes lit { 35% { transform: scale(1.04); } 100% { transform: scale(1.015); box-shadow: 0 0 0 5px var(--white), 0 0 0 8px var(--green), var(--shadow-2); } }
@keyframes lit-flip { 35% { transform: scaleX(-1) scale(1.04); } 100% { transform: scaleX(-1) scale(1.015); box-shadow: 0 0 0 5px var(--white), 0 0 0 8px var(--green), var(--shadow-2); } }
.play[data-outcome="memory"] .halo, .play[data-outcome="comeback"] .halo { animation: halo 0.8s ease-out forwards; }
@keyframes halo { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.32); } }
.play[data-phase="win"] .tag { animation: stick 0.36s var(--ease); }
@keyframes stick { 35% { transform: scale(1.1); } }
.play[data-phase="win"] .tag .caret, .play[data-phase="story"] .tag .caret, .play[data-phase="met"] .tag .caret, .play[data-phase="relearned"] .tag .caret { display: none; }
.play[data-outcome="memory"] .tag, .play[data-outcome="comeback"] .tag { background: var(--green); }
.play[data-outcome="nudge"] .shout { background: var(--ink); box-shadow: 0 14px 28px -12px rgba(16, 19, 31, 0.7); }
.play[data-outcome="nudge"] .face { animation: none; }
.play[data-phase="story"] .shout { display: none; }

.burst { position: absolute; left: 50%; top: 42%; width: 0; height: 0; z-index: 2; pointer-events: none; }
.burst i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--green); opacity: 0; }
.burst i:nth-child(3n) { background: var(--amber); }
.burst i:nth-child(3n + 1) { background: var(--accent); width: 4px; height: 10px; border-radius: 2px; }
.play[data-outcome="memory"] .burst i, .play[data-outcome="comeback"] .burst i { animation: fling 0.75s cubic-bezier(0.1, 0.8, 0.3, 1) forwards; }
@keyframes fling {
  0% { opacity: 1; transform: rotate(var(--r)) translateY(0) scale(0.4); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--r)) translateY(calc(-1 * var(--d) - 60px)) scale(1); }
}

.seal { position: absolute; right: -10px; top: 6px; z-index: 5; display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px 7px 8px; border-radius: 999px; background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), 0 12px 24px -12px rgba(16, 19, 31, 0.6); font: 700 13px/1 var(--display); animation: seal 0.36s cubic-bezier(0.2, 1.3, 0.3, 1) both; }
.seal svg { width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: var(--amber); color: var(--white); stroke-width: 3; }
@keyframes seal { from { opacity: 0; transform: scale(1.5); } }

/* Blanking: same room, same warmth. The tag goes violet until you have it. */
.play[data-phase="told"] .tag, .play[data-phase="relearned"] .tag { background: var(--violet); }
.play[data-phase="told"] .bubble { animation: pop 0.3s var(--ease); }

.card-beat { gap: 12px; cursor: pointer; }
.card-beat h2 { font: 700 46px/1 var(--display); letter-spacing: -0.035em; animation: pop 0.4s 0.1s var(--ease) both; }
.card-beat .lede { animation: drop 0.4s 0.3s var(--ease) both; font-size: 17px; color: var(--ink-2); max-width: 17em; }

/* ---------- summary ---------- */
.summary { min-height: 100dvh; padding: max(26px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; text-align: center; }
.summary h1 { display: flex; align-items: baseline; justify-content: center; gap: 4px; font: 700 34px/1 var(--display); color: var(--muted); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; animation: pop 0.4s 0.1s var(--ease) both; }
.summary h1 .count { display: inline-block; font-size: 84px; letter-spacing: -0.05em; color: var(--ink); }
.summary[data-result="win"] h1 .count { color: var(--green); }
.summary h1 .count.bump { animation: bump 0.28s var(--ease); }
@keyframes bump { 40% { transform: scale(1.12); } }
.summary .lede { color: var(--ink-2); }
.results { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 6px; margin: 14px 0 6px; }
.result .figure.small { --face: 86px; }
.result { width: 104px; display: grid; gap: 6px; justify-items: center; animation: pop 0.4s calc(0.3s + var(--i) * 0.1s) var(--ease) both; }
.results.dense { gap: 12px 2px; }
.results.dense .result { width: 84px; }
.results.dense .result .figure.small { --face: 66px; }
.results.dense .result .figure.small .tag { width: 78px; margin-left: -39px; }
.results.dense .result .figure.small .tag-name { font-size: 11.5px; height: 21px; }
.result p { display: grid; gap: 4px; justify-items: center; font: 500 12px/1.25 var(--display); color: var(--muted); }
.result .badge { letter-spacing: 0.05em; padding: 4px 7px; }
.results.dense .result .badge { font-size: 9.5px; letter-spacing: 0.03em; padding: 4px 6px; }
.result.reminded .face { filter: saturate(0.45); }
.result.reminded .tag { background: var(--violet); }
.result.memory .tag, .result.comeback .tag { background: var(--green); }
.result .tag.kept { background: var(--amber); }
.levelup, .outside { margin: 6px auto 0; width: 100%; max-width: 25em; border-radius: 18px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1); text-align: left; }
.levelup { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; justify-items: start; padding: 14px 16px; }
.levelup .levelup-move { justify-self: end; }
.levelup-move { display: inline-flex; align-items: center; gap: 4px; font: 700 26px/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.levelup-move s { text-decoration: none; color: var(--muted); font-weight: 600; }
.levelup-move svg { color: var(--muted); width: 18px; height: 18px; }
.levelup.up .levelup-move b { color: var(--green); }
.levelup.down .levelup-move b { color: var(--violet); }
.levelup-note { grid-column: 1 / -1; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.outside { padding: 12px 16px; font-size: 14px; color: var(--ink-2); }
.outside { display: grid; gap: 8px; justify-items: start; }
.outside .text { color: var(--accent); }
.teaser { max-width: 24em; margin: 8px auto 0; display: grid; gap: 6px; justify-items: center; font-size: 13.5px; color: var(--ink-2); }
.summary-actions { margin-top: auto; padding-top: 14px; display: grid; gap: 2px; justify-items: center; }
.proto-link { font-size: 12.5px; opacity: 0.6; }

@media (max-height: 700px) {
  .stage { --face: clamp(130px, min(50vw, 25vh), 200px); }
}
@media (max-height: 640px) {
  .stage { gap: 6px; }
  .bubble { font-size: 14.5px; padding: 8px 13px; }
  .moves { min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .play[data-phase="win"] .shout { opacity: 1; transform: translateX(-50%); }
}
