/* unfolded design system (claude.ai artifact "Unfolded"): tokens + base. RTL first. */
:root {
  /* colour */
  --ground: #ececeb;        /* the table */
  --paper: #f6f6f5;         /* the sheet = the phone screen */
  --paper-shade: #e3e3e1;
  --paper-crease: #d2d2cf;
  --hairline: #bdbdba;
  --ink: #141414;
  --ink-soft: #3a3a3a;
  --muted: #666666;
  --faint: #8c8c8c;         /* placeholders only */
  --disabled: #e0e0de;
  --tag: #dcdcda;
  --on-ink: #f6f6f5;
  --signal: #a8261b;        /* errors only */
  /* type */
  --font-wordmark: "Newsreader", "Times New Roman", serif;
  --font-display: "Frank Ruhl Libre", "David", serif;
  --font-ui: "IBM Plex Sans Hebrew", "Arial Hebrew", system-ui, sans-serif;
  --font-mono: "Cascadia Code", ui-monospace, monospace;
  /* space */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px;
  /* radius + shadow */
  --radius-none: 0; --radius-field: 3px; --radius-dot: 2px;
  --shadow-rest: 0 1px 1px rgba(0,0,0,0.06), 0 10px 18px -10px rgba(0,0,0,0.22);
  --shadow-lift: 0 2px 3px rgba(0,0,0,0.06), 0 22px 32px -14px rgba(0,0,0,0.30);
  --shadow-ink: 0 1px 0 rgba(0,0,0,0.25);

  /* legacy names still used by screens not yet restyled */
  --paper-edge: var(--hairline);
  --accent: var(--ink);
  --accent-ink: var(--on-ink);
  --online: var(--ink);
  --radius: var(--radius-none);
  --serif: var(--font-display);
  --mono: var(--font-mono);
}

* { box-sizing: border-box; }
/* Anything the app hides stays hidden, whatever display a component sets. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/25px var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* The phone screen is a sheet of paper; on wider screens it sits on the grey table. */
.app {
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom));
  background: var(--paper);
  overflow-x: clip; /* slips that run off the edge mustn't make the page scroll sideways */
}
@media (min-width: 480px) {
  .app { min-height: calc(100dvh - 2 * var(--space-6)); margin: var(--space-6) auto; border: 1px solid var(--hairline); }
}

.screen { display: flex; flex-direction: column; gap: var(--space-3); }
.screen[hidden] { display: none; }

/* Splash: a cover over the whole page (the screens switch underneath it) until your screen is chosen
   and the fonts and the folded-paper picture have arrived; then it fades away. */
.boot { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: var(--space-1); background: var(--paper); transition: opacity 0.3s ease-out; }
@media (min-width: 480px) { .boot { background: var(--ground); } }
.boot.out { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .boot { transition: none; } }
.boot-mark { position: relative; width: 144px; height: 144px; }
.boot-mark img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* The cat winks once: the right eye closes at 0.5s and opens at 0.9s (two drawings swap, hand-drawn style) */
.boot-wink { opacity: 0; animation: boot-wink 1.2s steps(1, end) forwards; }
.boot-open { animation: boot-unwink 1.2s steps(1, end) forwards; }
@keyframes boot-wink { 0% { opacity: 0; } 42% { opacity: 1; } 75% { opacity: 0; } 100% { opacity: 0; } }
@keyframes boot-unwink { 0% { opacity: 1; } 42% { opacity: 0; } 75% { opacity: 1; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .boot-wink, .boot-open { animation: none; } }

/* Masthead: logo (an image, never retyped) */
.masthead { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.logo { display: block; height: 28px; width: auto; }
.logo--lg { height: 36px; }

/* Avatars: origami on paper, always round (the one exception to square corners) */
.avatar {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--ink); border-radius: 50%;
  background: var(--paper) center / cover no-repeat;
  color: var(--ink); font: 600 28px/1 var(--font-display);
}
.avatar.has-image > span { display: none; }
.avatar--lg { width: 112px; height: 112px; font-size: 64px; }

/* Home: profile entry in the far corner, opposite the reading start */
.masthead--home { position: relative; }
/* Corner controls sit where English-set phones expect them (Natalie, 2026-11-05): profile top-right, back top-left.
   Physical sides on purpose; the Hebrew text itself stays right-to-left. */
.avatar-btn { position: absolute; inset-block-start: 0; right: 0; cursor: pointer; }
.avatar-btn:active { filter: brightness(0.94); }
.avatar-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* One headline per screen */
.display { font: 600 40px/46px var(--font-display); margin: var(--space-6) 0 0; text-align: center; }
.title { font: 500 32px/40px var(--font-display); margin: var(--space-5) 0 0; text-align: center; }
.display, .title, .lead { text-wrap: balance; }
.lead { font-size: 19px; line-height: 27px; color: var(--ink-soft); margin: 0; text-align: center; }

.accordion { display: block; width: 200px; height: auto; margin: var(--space-3) auto var(--space-2); }
#home.joining .accordion { display: none; }


/* Fields */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field > span { font-size: 16px; line-height: 22px; font-weight: 500; }
input {
  font: 400 17px/25px var(--font-ui);
  width: 100%;
  padding: 12px var(--space-4);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-field);
}
input::placeholder { color: var(--faint); }
input:focus { border-color: var(--ink); outline: none; }
/* Room code: four slots to write on, serif numerals like the host's note */
.field--code > span:first-child { text-align: center; }
.code-slots { position: relative; display: flex; justify-content: center; gap: var(--space-4); direction: ltr; padding: var(--space-1) 0 var(--space-2); }
.slot {
  width: 52px; height: 60px;
  display: flex; align-items: flex-end; justify-content: center;
  font: 400 44px/1 var(--font-wordmark); padding-bottom: 6px;
  border-bottom: 1.5px solid var(--ink);
}
.slot.is-next::after { content: ""; width: 1.5px; height: 34px; background: var(--ink); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
/* The real input covers the slots, invisible, so tapping, typing and pasting just work */
.code-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; font-size: 16px; caret-color: transparent;
}

/* Buttons: one ink block, an outline, and underlined text links */
.btn {
  font: 500 18px/24px var(--font-ui);
  display: block;
  width: 100%;
  padding: 14px var(--space-4);
  border-radius: var(--radius-none);
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn.primary { background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-ink); }
.btn.primary:active { box-shadow: none; }
.btn:disabled { background: var(--disabled); border-color: var(--hairline); color: var(--faint); box-shadow: none; cursor: default; transform: none; }
.btn.ghost {
  width: auto; align-self: center; border: 0; background: none; padding: 2px 0;
  text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px;
}
.btn.small { padding: var(--space-2) var(--space-4); font-size: 16px; }

.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--muted); font-size: 16px; margin: var(--space-2) 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

.error { color: var(--signal); min-height: 1.5em; margin: 0; text-align: center; font-weight: 500; }
.error:empty { min-height: 0; }
.hint { color: var(--muted); text-align: center; margin: var(--space-1) 0 0; }
.footnote { color: var(--muted); font-size: 14px; line-height: 20px; text-align: center; margin: var(--space-2) 0 0; }

/* Specs strip: two numbers with small labels, split by a hairline */
.specs { display: grid; grid-template-columns: 1fr 1fr; margin: var(--space-5) 0 0; padding-top: var(--space-4); border-top: 1px solid var(--hairline); }
.specs > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.specs > div + div { border-inline-start: 1px solid var(--hairline); }
.specs dd { margin: 0; font: 400 28px/32px var(--font-wordmark); }
.specs dt { font-size: 13px; line-height: 18px; color: var(--muted); }

/* ---- lobby ---- */
/* FoldedNote: the room code on a slightly tilted slip, its bottom edge folded under */
.room-code {
  /* 9-slice of a photographed note: the curled corner keeps its shape, the middle stretches */
  border-style: solid; border-width: 40px 29px 62px 50px;
  border-image: url(img/note.webp) 95 70 150 120 fill;
  padding: 26px 0 4px; /* balances the paper's edges: equal air above and below */
  margin: var(--space-3) calc(-1 * var(--space-2)) 0;
  text-align: center;
  transform: rotate(-1deg);
  display: flex; flex-direction: column; align-items: center;
}
.room-code span { font-size: 14px; line-height: 20px; color: var(--muted); letter-spacing: 0.02em; }
.room-code strong { font: 400 68px/72px var(--font-wordmark); letter-spacing: 0.1em; margin: var(--space-1) 0 var(--space-4); padding-inline-start: 0.1em; }
.room-code .text-link { font-size: 15px; line-height: 20px; color: var(--ink-soft); }

/* Underlined text link (secondary actions) */
.text-link {
  font: 500 18px/24px var(--font-ui); background: none; border: 0; padding: 2px 0; color: var(--ink);
  text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; cursor: pointer;
}

h2 { font-size: 16px; line-height: 22px; font-weight: 500; margin: var(--space-3) 0 0; }
.count { color: var(--muted); font-weight: 400; }

/* PlayerList: names between hairlines */
.players { list-style: none; margin: 0; padding: 0; }
.players li {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 17px; line-height: 25px;
}
.players .dot { display: none; }
.players li.offline { color: var(--muted); }
.players .me { font-size: 14px; color: var(--muted); }
.players .tag { margin-inline-start: auto; font-size: 14px; line-height: 20px; background: var(--tag); color: var(--ink-soft); padding: 0 var(--space-2); }

#lobby .hint { margin-top: var(--space-5); }

/* ---- writing ---- */
/* Round counter under the logo: quiet UI type, over a short hairline
   (was the monospace font: Hebrew looked spaced out and accidental, Natalie 2026-11-06) */
.counter {
  font: 400 13px/20px var(--font-ui); color: var(--muted);
  padding-bottom: var(--space-2); border-bottom: 1px solid var(--hairline);
  min-width: 160px; text-align: center;
}
.counter:empty { display: none; }

.write-area { display: flex; flex-direction: column; gap: var(--space-3); }
.write-area .lead { margin-top: calc(-1 * var(--space-2)); }

/* The paper: a flat sheet (img/paper.png) drawn by fold.js on a canvas, so it can really bend.
   The text boxes sit on top of it; at the fold, the words are copied onto the paper and fold with it. */
.fold-area { margin: var(--space-4) -24px 0; transition: transform .55s cubic-bezier(.4,0,.2,1); }
.fold-area.up { transform: translateY(var(--lift, 0)); } /* after folding: glide up into the space */
.fold-area .entry-meta { padding: 0 24px; }
.stage { position: relative; }
#fold-canvas {
  display: block; width: 100%;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.08)) drop-shadow(0 10px 14px rgba(0,0,0,.10));
}
.stage .entry-wrap { position: absolute; top: var(--text-top, 28px); left: 56px; right: 56px; }
.stage.folded .entry-wrap { visibility: hidden; }
.stage textarea {
  background: transparent; border: 0; border-radius: 0; padding: 0;
  white-space: pre-wrap; overflow-wrap: break-word; overflow: hidden;
}
.stage textarea:focus { border: 0; }
#hook { position: absolute; top: var(--hook-top); left: 56px; right: 56px; width: auto; visibility: hidden; }
.stage.folded #hook { visibility: visible; }
.stage .pencil { right: 6px; bottom: -42px; } /* across the sheet's bottom corner (the sheet is inset 24px) */
/* Peek: once folded, the fold rests as a thick roll along the top with "pull to peek" on it.
   The pull area covers the roll and a finger's width around it, but stops above the next-sentence box. */
.peek-pull {
  position: absolute; left: 24px; right: 24px; top: calc(var(--half) - var(--roll) - 14px); height: calc(var(--roll) + 26px);
  opacity: 0; pointer-events: none; transition: opacity .3s; cursor: grab;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.peek-pull:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.peek-say {
  position: absolute; left: 0; right: 0; top: 16px; height: var(--roll); line-height: var(--roll); text-align: center;
  font: 500 13px var(--font-ui); line-height: var(--roll); color: var(--muted); letter-spacing: .01em; transition: opacity .15s;
}
.fold-area.up .peek-pull { opacity: 1; pointer-events: auto; }
.stage.peeking .peek-say { opacity: 0; }
/* No WebGL (rare): the same sheet as a plain picture; folding just hides the written half */
.stage.no-gl #fold-canvas { background: url(img/paper.png) center / calc(100% - 48px) calc(100% - 10px) no-repeat; }
.stage.no-gl.folded #fold-canvas { clip-path: inset(var(--half) 0 0 0); }
@media (prefers-reduced-motion: reduce) { .fold-area { transition: none; } }

/* The box's own text is invisible; the layer behind it paints it: their part grey, yours in ink */
#entry { position: relative; min-height: 90px; color: transparent; caret-color: var(--ink); }
.entry-paint {
  position: absolute; inset: 0; pointer-events: none;
  font: 400 20px/30px var(--font-ui); color: var(--ink);
  white-space: pre-wrap; overflow-wrap: break-word;
}
.entry-paint .theirs { color: var(--muted); } /* muted, not faint: their words must stay readable (5.3:1) */
.entry-paint .placeholder { color: var(--faint); }
#hook { min-height: 60px; }

/* The writing box */
textarea {
  font: 400 20px/30px var(--font-ui);
  width: 100%;
  padding: 12px var(--space-4);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-field);
  resize: none;
}
textarea::placeholder { color: var(--faint); }
textarea:focus { outline: none; border-color: var(--ink); }
.entry-meta { display: flex; justify-content: space-between; font-size: 14px; line-height: 20px; color: var(--muted); margin-top: var(--space-2); }

/* The pencil rests across the corner of the empty box on the opening round */
.entry-wrap { position: relative; }
.pencil {
  position: absolute; right: -18px; bottom: -46px; width: 190px; height: auto;
  pointer-events: none;
}
.edit-link { align-self: center; font-size: 14px; line-height: 20px; color: var(--muted); }

/* A hint belongs right under the field it describes */
.field-hint { margin: 0; font-size: 16px; line-height: 22px; color: var(--ink-soft); }

.inspire-link { align-self: center; font-size: 16px; margin-top: var(--space-2); transition: color 200ms ease-out; }
.inspire-link.is-used { font-size: 14px; color: var(--muted); text-decoration-color: var(--hairline); }

/* Inspiration bottom sheet: a sheet of paper sliding up over the table */
.sheet { position: fixed; inset: 0; z-index: 10; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 20, 20, 0.28); opacity: 0; transition: opacity 240ms ease-out; }
.sheet-panel {
  position: absolute; inset-inline: 0; bottom: 0;
  max-width: 440px; margin: 0 auto;
  background: var(--paper);
  box-shadow: var(--shadow-lift), 0 -8px 24px rgba(0, 0, 0, 0.08);
  padding: var(--space-3) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--space-3);
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-handle { align-self: center; width: 36px; height: 3px; border-radius: var(--radius-dot); background: var(--paper-crease); }
.sheet-title { font: 500 24px/32px var(--font-display); text-align: center; margin: var(--space-2) 0 0; }

/* The wheel: openers scroll past a hand-drawn ring; the one in the ring is the pick */
.wheel { position: relative; height: 320px; }
.wheel-list {
  list-style: none; margin: 0; padding: 128px 0; height: 100%;
  overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 32%, #000 68%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 32%, #000 68%, transparent);
}
.wheel-list::-webkit-scrollbar { display: none; }
.wheel-list li { scroll-snap-align: center; }
.wheel-item {
  font: 400 18px/24px var(--font-ui); color: var(--faint);
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 64px; padding: 0 var(--space-7);
  background: none; border: 0; cursor: pointer; text-align: center; text-wrap: balance;
  font-size: 17px; line-height: 22px;
  transition: color 160ms ease-out;
}
.wheel-item.is-center { color: var(--ink); font-weight: 500; }
.wheel-ring {
  position: absolute; inset-inline: 0; top: calc(50% - 38px); height: 76px; width: 100%;
  pointer-events: none; overflow: visible;
}
.wheel-ring path { fill: none; stroke: #5a5a5a; stroke-linecap: round; stroke-linejoin: round; }
.wheel-ring .ring-main { stroke-width: 2.2; }
.wheel-ring .ring-ghost { stroke-width: 0.9; opacity: 0.6; }

@media (prefers-reduced-motion: reduce) {
  .sheet-panel, .sheet-backdrop { transition: none; }
}

#submit, #fold-btn { margin-top: var(--space-5); }
/* Writing screen: the paper gets the room, the button rests at the bottom of the page */
.app:has(> #writing:not([hidden])) { display: flex; flex-direction: column; }
#writing, #write-area { flex: 1; }
#write-area #fold-btn, #write-area #submit { margin-top: auto; }
#write-area .entry-meta { margin-bottom: var(--space-6); }
/* Writing screen: "not yet" is an outline, not a grey block */
.write-area .btn:disabled { background: transparent; border: 1px solid var(--hairline); color: var(--faint); }

/* ProgressDashes: one per round */
.dashes { display: flex; justify-content: center; gap: 6px; padding: 0; margin: var(--space-3) 0 0; list-style: none; }
.dashes li { flex: 0 1 28px; height: 3px; border-radius: var(--radius-dot); background: var(--paper-crease); }
.dashes li.is-current { background: var(--ink); }

/* LastCall: text + typewriter timer + a thin bar */
.last-call {
  display: grid; grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-3); align-items: baseline;
  margin-top: var(--space-4);
}
.last-call-text { font-size: 17px; color: var(--ink-soft); }
.timer { font: 500 20px/24px var(--font-mono); font-variant-numeric: tabular-nums; }
.timer-track { grid-column: 1 / -1; height: 2px; background: var(--paper-crease); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--ink); transform-origin: right; }

/* Waiting: "folded and sent" */
.waiting { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding-top: var(--space-2); }
/* Whoever is writing: their avatar, and three dots that pulse only while they type */
.writer { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin: var(--space-5) auto var(--space-2); }
.writer .avatar--lg { width: 120px; height: 120px; }
.typing { display: flex; gap: 6px; height: 10px; align-items: center; opacity: 0; transition: opacity .25s ease-out; }
.typing.on { opacity: 1; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); opacity: .25; animation: typing-dot 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing span { animation-name: typing-dot-still; } }
@keyframes typing-dot-still { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.waiting .lead { color: var(--muted); }

/* ---- done ---- */
#done .display { margin-bottom: var(--space-5); }
#no-my-story { margin-top: var(--space-5); }
.others-label { font: 400 14px/20px var(--font-ui); color: var(--muted); margin: var(--space-7) 0 0; padding-bottom: var(--space-2); border-bottom: 1px solid var(--hairline); }
#stories, #archive { display: flex; flex-direction: column; gap: var(--space-6); margin-top: var(--space-5); }
/* "X's story" sits outside the note, above it */
.story-label { margin: 0 0 var(--space-3); font: 500 16px/22px var(--font-ui); color: var(--ink-soft); overflow-wrap: anywhere; }
/* Saved stories: the date line, with a quiet "delete" at its end */
.story-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin: 0 0 var(--space-3); }
.story-head .story-label { margin: 0; }
/* A small line-drawn trash can (Natalie: no word), with a 44px tap area that doesn't push the line apart */
.story-delete { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -11px -12px -11px -12px;
  padding: 0; background: none; border: 0; color: var(--muted); cursor: pointer; touch-action: manipulation; }
.story-delete svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.story-delete:focus-visible { outline: 2px solid var(--ink); outline-offset: -6px; }
/* Toast (Natalie: "story deleted" + undo at the bottom, not inline): dark ink bar, slides up, then away */
.toast { position: fixed; z-index: 30; inset-inline: var(--space-5); bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  max-width: 420px; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding-block: 6px; padding-inline: var(--space-5) 8px; border-radius: 12px; background: var(--ink); color: var(--paper);
  font: 400 15px/22px var(--font-ui); box-shadow: 0 8px 24px rgba(20,20,20,.18);
  opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .2s ease-out, transform .2s ease-out; }
.toast.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.toast-action { flex: none; min-height: 44px; padding: 0 var(--space-3); background: none; border: 0; color: var(--paper);
  font: 600 15px/22px var(--font-ui); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; touch-action: manipulation; }
.toast-action:focus-visible { outline: 2px solid var(--paper); outline-offset: -4px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .2s ease-out; transform: none; } }

/* StoryPaper: one continuous unfolded sheet; its height comes from the story.
   Ref: UNFOLDED/output/final-story-paper/paper-material-study.png
   - texture: a tiny seamless noise tile (no folds or edges in it, so it can repeat)
   - creases: thin decorative layers placed by app.js from the sheet's height, never by sentence
   - the wavy bottom edge and the lifted corner keep the same size at any length
   - one drop-shadow on the wrapper follows the clipped shape, so the whole sheet reads as one */
.story-paper {
  position: relative;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.07)) drop-shadow(0 12px 14px rgba(0,0,0,0.11));
}
.story-paper__sheet {
  position: relative; isolation: isolate;
  padding: 28px clamp(24px, 7vw, 36px) 36px; /* the bottom keeps text clear of the wavy edge and the corner */
  background-color: #fdfdfc;
  background-image:
    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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.035' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='360' height='360' filter='url(%23m)'/%3E%3C/svg%3E");
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 40px), calc(100% - 2px) calc(100% - 38px), calc(100% - 3.4px) calc(100% - 31.3px), calc(100% - 6.6px) calc(100% - 25.2px), calc(100% - 11.7px) calc(100% - 19.8px), calc(100% - 18.5px) calc(100% - 15px), calc(100% - 27.2px) calc(100% - 10.8px), calc(100% - 37.6px) calc(100% - 7.2px), calc(100% - 49.9px) calc(100% - 4.3px), calc(100% - 64px) calc(100% - 2px), 78% calc(100% - 2.5px), 70% calc(100% - 1px), 61% calc(100% - 2.2px), 52% calc(100% - 3.4px), 43% calc(100% - 2px), 34% calc(100% - 0.8px), 25% calc(100% - 2.4px), 16% calc(100% - 3.6px), 8% calc(100% - 2px), 0 calc(100% - 1px));
}
.story-paper__curl {
  position: absolute; right: 0; bottom: 0; width: 64px; height: 40px; z-index: 2;
  background: url(img/paper-curl.svg) no-repeat; pointer-events: none;
}
/* A crease: a soft valley (dark) with light catching its far side, uneven along its length */
.story-paper__crease {
  position: absolute; inset-inline: 0; height: 24px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent 0, rgba(0,0,0,0.014) 35%, rgba(0,0,0,0.042) 49%, rgba(255,255,255,0.75) 53%, rgba(255,255,255,0.3) 64%, transparent 100%);
  filter: blur(0.4px);
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0.55), #000 18%, rgba(0,0,0,0.7) 41%, #000 63%, rgba(0,0,0,0.6) 84%, rgba(0,0,0,0.9));
  mask-image: linear-gradient(90deg, rgba(0,0,0,0.55), #000 18%, rgba(0,0,0,0.7) 41%, #000 63%, rgba(0,0,0,0.6) 84%, rgba(0,0,0,0.9));
}
.story-paper__body { font: 400 20px/1.75 var(--font-display); color: var(--ink); text-align: start; overflow-wrap: anywhere; }
.story-paper__body p { margin: 0; white-space: pre-wrap; }
.story-paper__join { font-weight: 600; } /* the sentence start the previous writer left */
.story-paper__body p + p { margin-top: 0.4em; } /* a small breath between sentences, so a wrapped line isn't mistaken for a new one */
/* Signed by everyone who wrote in it, scattered like a card everyone signed (not in a row):
   each signature gets its own tilt, height and spacing from JS (--tilt, --lift, --nudge). */
.story-paper__signers { display: flex; flex-wrap: wrap; justify-content: space-evenly; align-items: center; gap: var(--space-6) var(--space-4); margin: var(--space-6) 0 var(--space-4); }
.signature {
  position: relative; display: inline-block; color: #2a2a2a;
  margin-inline-start: var(--nudge, 0);
  transform: translateY(var(--lift, 0)) rotate(var(--tilt, 0deg));
  overflow-wrap: anywhere;
}
/* No drawing yet: the name in the headline font */
.signature--name { font: 500 22px/1.2 var(--font-display); }
.signature--drawn { height: 38px; width: auto; overflow: visible; }
.signature--drawn path { fill: none; stroke: #242424; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.story-paper__signers:empty { display: none; }

/* Unfold: the content opens from zero height (400–600ms ease-out, per the motion plan) */
.story-paper__content { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 520ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.story-paper__inner { overflow: hidden; min-height: 0; }
.story-paper.is-folded .story-paper__content { grid-template-rows: 0fr; }
.story-paper.is-folded .story-paper__sheet { padding-block: 26px; clip-path: none; }
/* Folded, it's a plain stack of layers: the lifted corner and creases appear once it's open */
.story-paper.is-folded .story-paper__curl, .story-paper.is-folded .story-paper__crease { display: none; }
.story-paper.is-folded { cursor: pointer; }
/* A folded note: the layers of the fold peek out underneath */
.story-paper.is-folded::before, .story-paper.is-folded::after {
  content: ""; position: absolute; z-index: -1; height: 12px; background: #f7f7f6;
}
.story-paper.is-folded::before { inset-inline: 6px; bottom: -5px; }
.story-paper.is-folded::after { inset-inline: 12px; bottom: -10px; background: #f1f1ef; }
.story-paper__open { display: block; width: 100%; padding: 0; border: 0; background: none; font: 400 16px/22px var(--font-ui); color: var(--muted); text-align: center; cursor: pointer; }
.story-paper__first { display: block; padding: 0 24px; font: 400 19px/28px var(--font-display); color: var(--ink); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-paper__face-signers { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 14px; margin-top: 10px; padding: 0 16px; }
.story-paper__face-signers:empty { display: none; }
.story-paper__face-signers .signature { transform: rotate(var(--tilt, 0deg)); }
.story-paper__face-signers .signature--drawn { height: 22px; }
.story-paper__face-signers .signature--name { font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .story-paper__content { transition: none; } }
@media (min-width: 480px) { .story-paper__body { font-size: 22px; } }
#done .btn.ghost { margin-top: var(--space-6); }
#done .share-story { margin-top: var(--space-6); }

/* ---- debug menu (host, ?debug only) ---- */
.debug {
  margin-top: var(--space-6); padding: var(--space-4);
  border: 1px dashed var(--hairline);
  display: flex; flex-direction: column; gap: var(--space-2); align-items: stretch;
}
.debug-label { font: 400 13px/20px var(--font-mono); color: var(--muted); text-align: center; }
.debug-msg { font-size: 14px; line-height: 20px; color: var(--muted); text-align: center; margin: 0; }
.debug-msg:empty { display: none; }

/* ---- profile ---- */
/* Back: a "<" arrow in the top-left corner (44px tap area; the arrow lines up with the page edge) */
.back-link {
  position: absolute; inset-block-start: -7px; left: -10px;
  display: grid; place-items: center; width: 44px; height: 44px;
  padding: 0; background: none; border: 0; cursor: pointer; color: var(--ink);
}
.back-link svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.back-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.profile-id { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.profile-name { margin: 0; font: 500 22px/28px var(--font-display); }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); justify-items: center; margin-top: var(--space-2); }
.avatar-option { width: 64px; height: 64px; border-color: var(--hairline); cursor: pointer; }
.avatar-option[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
.avatar-option:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
#archive-empty { margin-top: var(--space-2); }
/* Your signature on the profile: a white card you tap to sign */
.sig-preview { position: relative; display: block; width: 100%; height: 120px; margin-top: var(--space-4); padding: 0; border: 0; background: #fdfdfc; box-shadow: var(--shadow-rest); cursor: pointer; }
.sig-preview:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sig-preview__svg { display: block; width: 100%; height: 100%; }
/* Empty: a signing line, and a "sign here" flag (like on a lease) poking in from the edge */
.sig-preview__empty { position: absolute; inset: 0; }
.sig-preview__empty::before { content: ""; position: absolute; inset-inline: 24px; bottom: 36px; border-top: 1px solid var(--paper-crease); }
.sig-flag {
  position: absolute; right: -10px; bottom: 22px; display: flex; align-items: center; height: 30px; padding: 0 12px 0 22px;
  background: var(--ink); color: var(--on-ink); font: 500 15px/1 var(--font-ui);
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%); /* the arrow points at the line */
  transform: rotate(-3deg); animation: sig-flag-nudge 3.2s ease-in-out infinite;
}
@keyframes sig-flag-nudge {
  0%, 70%, 100% { transform: translateX(0) rotate(-3deg); }
  78% { transform: translateX(-8px) rotate(-3deg); }
  86% { transform: translateX(0) rotate(-3deg); }
  92% { transform: translateX(-4px) rotate(-3deg); }
}
@media (prefers-reduced-motion: reduce) { .sig-flag { animation: none; } }
/* The same pencil as the opening round's empty box: "you can write here" */
.sig-pencil { position: absolute; right: -18px; bottom: -40px; width: 150px; height: auto; pointer-events: none; }
.sig-hint { margin-top: var(--space-6); }
.sig-edit { display: block; margin: var(--space-3) auto 0 0; } /* far side in RTL, clear of the pencil */
.sig-edit:not([hidden]) + .sig-hint { margin-top: var(--space-3); }
.sig-line { stroke: var(--paper-crease); stroke-width: 1; }
.sig-ink { fill: none; stroke: #242424; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Signing dialog: a small square card over a darkened page (ref: Strava's centred picker) */
.sig-dialog { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: var(--space-5);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; /* a long press mustn't select text */
  touch-action: manipulation; } /* quick taps on "undo" mustn't trigger double-tap zoom */
.sig-dialog__backdrop { position: absolute; inset: 0; background: rgba(20, 20, 20, 0.45); }
.sig-dialog__card { position: relative; width: 100%; max-width: 400px; background: var(--paper); box-shadow: var(--shadow-lift); }
.sig-dialog__title { margin: 0; padding: var(--space-5) var(--space-5) 0; font: 500 24px/32px var(--font-display); text-align: center; }
.sig-pad-wrap { position: relative; margin: var(--space-4) var(--space-4) 0; }
.sig-pad { display: block; width: 100%; height: 200px; background: #fdfdfc; box-shadow: var(--shadow-rest); touch-action: none; cursor: crosshair; }
.sig-placeholder { position: absolute; inset-inline-start: var(--space-5); bottom: 52px; font: 400 16px/22px var(--font-ui); color: var(--faint); pointer-events: none; }
.sig-tools { display: flex; justify-content: space-between; padding: var(--space-3) var(--space-4) var(--space-4); }
.text-btn { padding: var(--space-1) 0; background: none; border: 0; cursor: pointer; font: 400 16px/22px var(--font-ui); color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.text-btn:disabled { color: var(--faint); text-decoration: none; cursor: default; }
.sig-dialog__actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--hairline); }
.sig-dialog__actions button { padding: var(--space-4); background: none; border: 0; cursor: pointer; font: 400 17px/24px var(--font-ui); color: var(--ink); }
.sig-dialog__actions button + button { border-inline-start: 1px solid var(--hairline); }
.sig-dialog__actions .is-primary { font-weight: 600; }
.sig-dialog__actions button:disabled { color: var(--faint); cursor: default; }
.sig-dialog__actions button:focus-visible, .text-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.sig-dialog button { touch-action: manipulation; }
body.is-locked { overflow: hidden; }

/* ---- demo link (?demo) ---- */
.demo-tag { position: fixed; z-index: 50; left: 50%; bottom: calc(6px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 2px 8px; background: var(--paper); border: 1px solid var(--hairline); white-space: nowrap;
  font: 400 12px/18px var(--font-ui); color: var(--muted); pointer-events: none; }

/* ---- how to play ---- */
/* "How to play" on home: an open-book icon opposite the avatar (top-left, like the back arrow).
   Was a "?" in a circle: read as a missing image; the words "איך משחקים" were rejected too (Natalie, 2026-11-05). */
.help-btn { position: absolute; inset-block-start: -2px; left: -10px; display: grid; place-items: center; width: 44px; height: 44px;
  padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; touch-action: manipulation; }
/* an open book = the rules; same thin line as the back arrow, centred on the avatar's row */
.help-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.help-btn:active { opacity: .6; }
.help-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.howto { gap: var(--space-4); }
.howto-intro { margin-block-start: var(--space-2); }
.howto .title { margin: 0; text-align: start; }
.howto-intro p { margin: var(--space-1) 0 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.5; }

.steps { list-style: none; margin: 0; padding: 0; }
/* outer lines live on the first/last step so they fade in with them */
.step:first-child { border-block-start: 1px solid var(--hairline); }
.step:last-child { border-block-end: 1px solid var(--hairline); }
.step {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) 72px;
  align-items: center;
  gap: var(--space-3);
  padding-block: var(--space-3);
}
.step + .step { border-block-start: 1px solid var(--paper-crease); }
.step-num { align-self: start; font: 400 .9375rem/1.75rem var(--font-wordmark); color: var(--muted); }
.step h2 { font: 500 1.375rem/1.75rem var(--font-display); margin: 0 0 var(--space-1); }
.step p { margin: 0; font-size: 1rem; line-height: 1.45; color: var(--ink-soft); }
.step-art { display: grid; place-items: center; min-width: 0; }
@media (max-width: 360px) {
  .step { grid-template-columns: 1rem minmax(0, 1fr) 60px; gap: var(--space-2); }
}
@media (max-width: 300px) {
  .step { grid-template-columns: 1rem minmax(0, 1fr); }
  .step-art { display: none; }
}

/* 1: each friend on their own phone */
.art-phones { display: flex; gap: 4px; align-items: flex-end; width: 100%; padding-block-start: 5px; }
.art-phone { flex: 1; min-width: 0; aspect-ratio: 3 / 5; border: 1px solid var(--ink); border-radius: 4px; background: #fff; display: grid; place-items: center; }
.art-phone:nth-child(2) { transform: translateY(-5px); }
.art-phone img { width: 80%; border-radius: 50%; }
/* 2: one of them is picked to write */
.art-picked { position: relative; width: 100%; aspect-ratio: 11 / 8; }
.art-picked img { position: absolute; width: 36%; height: auto; border-radius: 50%; opacity: .35; }
.art-picked img:nth-child(1) { inset-inline-start: 0; top: 42%; }
.art-picked img:nth-child(2) { inset-inline-end: 0; top: 42%; }
.art-picked .chosen { left: 28%; top: 0; width: 44%; opacity: 1; box-shadow: 0 0 0 1px var(--paper), 0 0 0 2px var(--ink); }
.art-picked .pen { width: 45%; left: 29%; top: 76%; transform: rotate(-10deg); opacity: 1; border-radius: 0; }
/* 3: the top is folded over; you see their start (grey) and finish it (black), pencil at the end of your words */
.art-fold { position: relative; width: 100%; }
.art-fold__flap { position: relative; height: 22px; margin-inline: 3px; background: linear-gradient(#ebe9e3, #dedbd3);
  border-radius: 1px 1px 0 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding-inline: 8px; }
.art-fold__flap i { display: block; height: 2px; background: #c9c5bb; border-radius: 1px; }
.art-fold__flap i:last-child { width: 65%; }
.art-fold__flap::after { content: ""; position: absolute; left: -3px; right: -3px; bottom: -1px; height: 1px; background: #bdb9ae; }
.art-fold__body { background: #fff; box-shadow: var(--shadow-rest); padding: 7px 6px 8px; text-align: start;
  font: 400 11px/15px var(--font-display); }
.art-fold__body span { white-space: nowrap; }
.art-fold__body .theirs { display: block; color: var(--muted); }
/* the pencil hangs off the end of your words (their left edge, RTL), so it follows them at any width */
.art-fold__body .mine { position: relative; display: inline-block; color: var(--ink); }
.art-fold__pen { position: absolute; width: 40px; left: -5px; top: 0; transform-origin: 9% 72%; transform: rotate(40deg); }
@media (max-width: 360px) { .art-fold__body { padding-inline: 4px; font-size: 10px; } .art-fold__flap { padding-inline: 6px; } }
/* 4: the story unfolds */
.art-unfold { display: block; width: 100%; height: auto; }
.howto-actions { display: flex; flex-direction: column; gap: var(--space-2); margin-block-start: var(--space-2); }
/* Arriving: the page settles in, top to bottom (the header stays put). Replays every time the screen is shown. */
@keyframes howto-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.howto-intro, .howto .step, .howto-actions { animation: howto-in 520ms cubic-bezier(.22, 1, .36, 1) both; }
.howto .step:nth-child(1) { animation-delay: 90ms; }
.howto .step:nth-child(2) { animation-delay: 160ms; }
.howto .step:nth-child(3) { animation-delay: 230ms; }
.howto .step:nth-child(4) { animation-delay: 300ms; }
.howto-actions { animation-delay: 380ms; }
@media (prefers-reduced-motion: reduce) { .howto-intro, .howto .step, .howto-actions { animation: none; } }
.howto-actions .demo-tag {
  position: static;
  transform: none;
  align-self: center;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: center;
  white-space: normal;
}

/* ---- onboarding (first run) ---- */
.screen.ob { min-height: calc(100dvh - 2 * var(--space-6) - env(safe-area-inset-bottom)); }
@media (min-width: 480px) { .screen.ob { min-height: calc(100dvh - 4 * var(--space-6) - 2px); } }
.ob .title { margin-top: var(--space-6); }
.ob .hint { margin-top: 0; }
.ob-top { position: relative; display: flex; justify-content: flex-start; align-items: center; min-height: 28px; }
.ob-steps { display: flex; gap: 6px; }
.ob-steps[hidden] { display: none; }
.ob-steps i { width: 18px; height: 2px; background: var(--hairline); }
.ob-steps i.on { background: var(--ink); }
.ob-foot { margin-top: auto; padding-top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.ob-field { margin-top: var(--space-5); }
/* A small ✕ at the end of the text (left, since Hebrew runs right to left) to clear the box in one tap */
.clearable { position: relative; }
.clearable input { padding-left: 44px; }
.clear-btn { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; padding: 0; background: none; border: 0; color: var(--muted); cursor: pointer; touch-action: manipulation; }
.clear-btn[hidden] { display: none; }
.clear-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.clear-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -6px; }
.ob-pad-wrap { margin: var(--space-5) 0 0; }
.ob-tools { padding: var(--space-3) 0 0; }
.ob .profile-id { margin-top: var(--space-5); }
.ob-guest { align-self: center; }
.guest-note { font: 400 14px/20px var(--font-ui); color: var(--muted); text-align: center; margin: 0; text-wrap: balance; }
.account-note { margin-top: -4px; } /* belongs to the Google button above it, not the link below */
.account-note span { display: block; } /* one sentence per line */
.account-note .keep { display: inline; white-space: nowrap; } /* a narrow phone breaks only at the comma */

/* "Continue with Google", per developers.google.com/identity/branding-guidelines: white fill,
   1px #747775 border, #1F1F1F Google Sans Medium 14/20, 12px before the G, 10px after it,
   the standard colour G unchanged. Height/radius aren't specified there: 40px / 4px like Google's own. */
.gsi-btn { direction: ltr; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 40px; padding: 0 12px; background: #fff; border: 1px solid #747775; border-radius: 4px; color: #1F1F1F; font: 500 14px/20px "Google Sans", Roboto, Arial, sans-serif; letter-spacing: .25px; cursor: pointer; }
.gsi-btn svg { width: 20px; height: 20px; flex: none; }
.gsi-btn:active { background: #f2f2f2; }
.gsi-btn.is-leaving { cursor: progress; color: #5f6368; }
.gsi-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Home after onboarding: a hello instead of the name field */
.hello { font: 400 18px/24px var(--font-ui); color: var(--ink-soft); text-align: center; margin: 0; }
.hello[hidden], #home-name-field[hidden] { display: none; }

/* Avatars: two initials get a smaller size so they fit the circle */
.avatar.two { font-size: 18px; letter-spacing: -0.02em; }
.avatar-option.two { font-size: 24px; }
.avatar--lg.two { font-size: 46px; }
.avatar-option:not(.has-image) { border-color: var(--hairline); }

/* Upload your photo: the first circle of the grid (dashed, a camera), or tap the big avatar */
.avatar-upload { position: relative; display: block; cursor: pointer; border-radius: 50%; }
.avatar-photo { position: relative; overflow: hidden; }
.avatar-photo:not(.has-image) { border: 1px dashed var(--ink); background: transparent; }
.avatar-photo-icon { display: grid; place-items: center; }
.avatar-photo svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 1.5; }
.avatar-photo .upload-input { pointer-events: none; }
.avatar-photo:focus-within { outline: 2px solid var(--ink); outline-offset: 4px; }
/* A dry aside in the story voice (headline font), not a second label */
.name-google-hint { text-align: start; font-size: 14px; line-height: 20px; margin-top: var(--space-2); }
.name-google-hint[hidden] { display: none; }
.photo-hint { text-align: start; font: 400 17px/24px var(--font-display); color: var(--ink-soft); margin-top: var(--space-3); }
.upload-input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; cursor: pointer; }
.avatar-upload:focus-within .avatar { outline: 2px solid var(--ink); outline-offset: 4px; }
.avatar-upload:active .avatar { filter: brightness(0.94); }

/* Profile: edit your name in place */
.profile-name-box { display: block; width: min(100%, 260px); }
.profile-name-box[hidden] { display: none; }
.profile-name-input { width: 100%; text-align: center; font: 500 22px/28px var(--font-display); }
/* Same inset on both sides so the name stays centred next to the ✕ */
.clearable .profile-name-input { padding-right: 44px; }
.profile-name-input[hidden], .profile-name[hidden], #profile-name-edit[hidden] { display: none; }

/* Home: join first; the code slots open in place of the buttons */
.home-actions, .join-panel { display: flex; flex-direction: column; gap: var(--space-3); }
.home-actions[hidden], .join-panel[hidden] { display: none; }
.join-cancel { align-self: center; }
.join-cancel[hidden] { display: none; }
.name-row { display: flex; align-items: center; gap: var(--space-1); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; background: none; border: 0; cursor: pointer; color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.icon-btn:active { color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Profile: account */
.account-box { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.account-box[hidden] { display: none; }
