/* Beefcake — plum, white and rose; glass; phone-only. Brand tokens: docs/brand.md. */

:root {
  --bg: #1E0F2E;
  --surface: #281937;
  --text: #FBF7FA;
  --text-soft: #D8D2D9;
  --text-muted: #B6AFBA;
  --text-faint: #958C9C;
  --hairline: rgba(255, 255, 255, 0.14);

  /* The three brand colours. Rose is hers: her messages, the one primary
     action per screen, the wordmark. Never rose text on white. */
  --plum: #1E0F2E;
  --white: #FBF7FA;
  --rose: #F08BB4;

  /* Tier colours, the one exception to three colours: how he writes.
     Moonstone, starlight gold, nebula violet, from the tier names.
     Only for the tier icons and the Stardust icon (it takes the colour of
     the tier you're on). */
  --planetary: #C9DCEA;
  --stellar: #F2D08A;
  --galactic: #B9A2FF;

  --font-sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", Georgia, serif;   /* always italic 600 */
  --font-mono: "DM Mono", "SFMono-Regular", Menlo, monospace;

  --radius-card: 20px;
  --radius-pill: 999px;

  /* The app is always a phone-width column. On tablets and desktops it sits
     centred with black bars on either side. Anything position: fixed must
     stay inside this width (see .app). */
  --app-width: 480px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }

/* `hidden` always wins, even over components that set their own display. */
[hidden] { display: none !important; }

/* iOS-style glass for anything floating over imagery. */
/* Neutral dark, so photos behind it keep their own colours. */
.glass {
  background: rgba(16, 12, 20, 0.55);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 30px rgba(0, 0, 0, 0.4);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(22, 16, 28, 0.94); }
}

.wordmark {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: 32px;
  letter-spacing: -0.5px;
}
/* The beefcake wordmark itself: always lowercase, flat, rose on plum. */
.wordmark--brand { color: var(--rose); }

/* ---- App shell ---- */

.app {
  position: relative;
  width: 100%;
  max-width: var(--app-width);
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: var(--safe-bottom);
  overflow-x: clip;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 16px 8px;
}

.empty {
  min-height: 60dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 32px;
  text-align: center;
}
.empty__title {
  margin: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: 40px;
  line-height: 1;
}
.empty__text { margin: 0; color: var(--text-muted); font-size: 15px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- Cards (Home, Your characters, the edit preview) ---- */

.card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: #30223F;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
/* A faint light edge, so every card reads as one object on plum. */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  pointer-events: none;
}
.card:active { transform: scale(0.98); }
.card:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
/* Every card on Home is the same height, whichever row it sits in. */
.card--tall { height: 250px; }

.card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}
/* Video loops sit over their cover and fade in once actually playing. */
.autoplay-video { opacity: 0; transition: opacity 0.4s ease; }
.autoplay-video.is-playing { opacity: 1; }

.card__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 72px 12px 12px;
  background: linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.45) 42%, rgba(0, 0, 0, 0.85) 100%);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card__title {
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: 24px;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__hook {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Home hero: the newest few characters, stories-style ---- */

.hero {
  position: relative;
  height: min(76svh, 680px);
  min-height: 520px;
  overflow: hidden;
  background: var(--plum);
}
.hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease-out, visibility 0s linear 0.35s;
}
.hero__slide.is-active { opacity: 1; visibility: visible; transition: opacity 0.35s ease-out; }
.hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}
.hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 72%, var(--plum) 100%);
}
.hero__top {
  position: absolute;
  top: calc(16px + var(--safe-top));
  left: 16px;
  z-index: 3;
  pointer-events: none;
}
.hero__top .cupcow { display: block; }
/* Thin bars under his hook show which one you're on. */
.hero__bars {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 20px;
  z-index: 3;
  display: flex;
  gap: 4px;
}
.hero__bar { flex: 1; height: 2px; border-radius: 1px; background: rgba(251, 247, 250, 0.22); overflow: hidden; }
.hero__bar-fill { display: block; width: 0; height: 100%; background: rgba(251, 247, 250, 0.85); }
.hero__bar.is-done .hero__bar-fill { width: 100%; }
.hero__bar.is-running .hero__bar-fill { animation: hero-bar 5s linear forwards; }
@keyframes hero-bar { to { width: 100%; } }
/* Tap the left or right side of the picture to go back or on. They stop
   above the text so his name and the reply box stay tappable. */
/* Stories-style: tap the left half to go back, the right half to go on,
   anywhere on the picture. Only his name and hook open his page. */
.hero__nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 2;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hero__nav--prev { left: 0; }
.hero__nav--next { right: 0; }
.hero__nav:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; border-radius: 20px; }
.hero__body {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 38px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none; /* taps around the words still reach the tap zones */
}
.hero__title, .hero__hook { align-self: flex-start; pointer-events: auto; }
.hero__body:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 12px; }
.hero__title {
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: 54px;
  line-height: 0.92;
  letter-spacing: -0.5px;
}
.hero__hook { font-size: 16px; line-height: 1.4; color: #E4DEE4; }

/* Small rose label: "New". */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tag--rose { background: var(--rose); color: var(--plum); }
.tag--line { box-shadow: inset 0 0 0 1px rgba(240, 139, 180, 0.8); color: var(--rose); }
.hero__tags { display: flex; gap: 6px; align-self: flex-start; pointer-events: auto; }

/* ---- Home shelves: Recent, Trending, Community ---- */

.shelf { margin-top: 30px; display: flex; flex-direction: column; gap: 12px; }
.shelf:first-child { margin-top: 14px; }
.shelf__title {
  margin: 0;
  padding: 0 16px;
  font-size: 26px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 16px 4px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
/* Continue, For you and Trending: the same cards as Community, in a row you swipe. */
.rail--ranked { margin: 0; list-style: none; }
.card--rail { flex-shrink: 0; width: 174px; height: 250px; }
.card--rail .card__title { font-size: 19px; line-height: 1.02; }
/* Continue: a little smaller, so the new picks below lead. */
.card--small { width: 136px; height: 196px; }
.card--small .card__title { font-size: 17px; }
.card--small .card__caption { padding-top: 56px; }
.card--small .card__hook { font-size: 12px; }
/* Under his name on every card: his message count, or when you last played. */
.card__meta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; line-height: 1.3; color: rgba(251, 247, 250, 0.78); font-variant-numeric: tabular-nums; }
.card__meta svg { opacity: 0.85; }
/* Creator and count share the line: the handle shrinks, the count never does. */
.card__meta:has(.card__creator) { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.card__creator { min-width: 0; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__count { flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; }

/* Beefcake Originals (made by us): a small rose label, top left. */
.card__original {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--rose);
  color: var(--plum);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 5px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.cupcow-mini { flex-shrink: 0; display: block; }
.card__meta:empty, .card__hook:empty { display: none; }
/* His place in Trending: small and quiet, top right. */
.card__rank {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: rgba(16, 12, 20, 0.4);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: rgba(251, 247, 250, 0.8);
  font-variant-numeric: tabular-nums;
}

/* Community ends with a way to make your own. */
.card--make::after { display: none; }
.card--make {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(251, 247, 250, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.card--make__icon { width: 48px; height: 48px; border-radius: 24px; background: rgba(251, 247, 250, 0.1); display: flex; align-items: center; justify-content: center; }
.card--make__label { font-size: 15px; font-weight: 600; }
.recent:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 18px; }

.ranked { padding: 0 10px; }
.ranked--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* ---- Your characters (/me) ---- */

.mine { background: #30223F; }
.mine__empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  border-radius: inherit;
}
.mine__chip {
  position: absolute;
  top: 10px;
  left: 10px;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}
.mine__chip--draft { background: var(--text); color: var(--plum); }
.mine__pen {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card__caption--plain { background: none; }

/* ---- Buttons ---- */

.button-primary {
  height: 54px;
  border-radius: 27px;
  background: var(--rose);
  color: var(--plum);
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.button-primary:active { transform: scale(0.98); }

/* ---- Character sheet (/c/{id}, and Home's slide-up overlay) ---- */

html.is-locked { overflow: hidden; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: calc(48px + var(--safe-top));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 40px rgba(30, 15, 46, 0.5);
  display: flex;
  flex-direction: column;
}

.sheet__media {
  position: relative;
  flex-shrink: 0;
  height: min(60dvh, 520px);
  touch-action: pan-x;
}
.sheet__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}
.sheet__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(30, 15, 46, 0.35) 0%, rgba(30, 15, 46, 0) 22%, rgba(40, 25, 55, 0) 50%, rgba(40, 25, 55, 0.85) 82%, var(--surface) 100%);
}
.sheet__grabber {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 88px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.sheet__grabber span { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.55); }
.sheet__grabber:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; border-radius: 14px; }
.sheet__head {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sheet__title {
  margin: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: 54px;
  line-height: 0.95;
  letter-spacing: -0.5px;
}
.sheet__hook { margin: 0; font-size: 16px; line-height: 1.4; color: var(--text-soft); }

.sheet__body {
  flex-grow: 1;
  padding: 14px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sheet__story {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  white-space: pre-line;
}

.note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.note__label {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.note__text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-soft); }

.sheet__actions {
  position: sticky;
  bottom: 0;
  padding: 28px 16px calc(24px + var(--safe-bottom));
  background: linear-gradient(rgba(40, 25, 55, 0), var(--surface) 40%);
}

/* Opened directly: the sheet over a blurred cover. */
.sheet-page {
  position: relative;
  height: 100dvh;
  overflow: hidden;
}
.sheet-page__backdrop {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(24px) brightness(0.45);
}

/* From Home: a layer inside the phone column that slides the sheet up. */
.sheet-layer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, var(--app-width));
  transform: translateX(-50%);
  z-index: 10;
}
.sheet-layer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 15, 46, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sheet-layer .sheet {
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-layer.is-open .sheet-layer__backdrop { opacity: 1; }
.sheet-layer.is-open .sheet { transform: none; }

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

/* ---- Chat (/c/{id}/chat): the character's picture behind the conversation ---- */

.chat {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Faded like venusx: blurred, slightly zoomed (hides the blur's soft edges)
   and at about a quarter opacity on black, so the picture sets the mood
   without competing with the messages. */
.chat__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: blur(6px);
  transform: scale(1.1);
  opacity: 0.24;
  animation: chat-backdrop-in 0.7s ease-out both;
}
@keyframes chat-backdrop-in { from { opacity: 0; } to { opacity: 0.24; } }
.chat__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, 0.55) 100%);
}

.chat__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 12px 8px;
}
.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-button-spacer { width: 44px; flex-shrink: 0; }
.chat__who {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 24px;
}
.chat__avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 17px;
  object-fit: cover;
  object-position: center 15%;
}
.chat__name {
  min-width: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: 22px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

.chat__log {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
}
.chat__log > :first-child { margin-top: auto; } /* keep messages at the bottom */

.bubble {
  margin: 0;
  max-width: 82%;
  padding: 12px 15px;
  font-size: 15.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* His messages: a quiet outline, so hers (rose) lead. */
.bubble--them {
  align-self: flex-start;
  max-width: 100%;
  border-radius: 22px 22px 22px 8px;
  background: rgba(16, 12, 20, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgba(251, 247, 250, 0.2);
}
.bubble--me {
  align-self: flex-end;
  border-radius: 22px 22px 8px 22px;
  background: var(--rose);
  color: var(--plum);
}
/* One of his messages, with room for his avatar on the left. In a run of
   his messages the avatar shows only beside the last one, and the run sits
   closer together. */
.from-him {
  align-self: flex-start;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%; /* his replies run long: use the whole width */
  margin-left: -4px;
}
.from-him + .from-him { margin-top: -6px; }
.from-him .bubble { max-width: none; min-width: 0; }
.from-him--image { width: calc(62% + 40px); }
.from-him--image .bubble-image { width: auto; min-width: 0; flex: 1 1 auto; }
.from-him__avatar {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 16px;
  overflow: hidden;
}
.from-him__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  border-radius: inherit;
}
.bubble .action { font-style: italic; color: var(--text-muted); }
.bubble--me .action { color: rgba(30, 15, 46, 0.72); }
.bubble-image {
  align-self: flex-start;
  width: 62%;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
/* His reply on its way: three dots in his bubble until the first words. */
.bubble--typing { padding: 15px 16px; }
.typing { display: inline-flex; gap: 5px; vertical-align: middle; }
.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(244, 241, 238, 0.72);
  animation: typing 1.2s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .typing i { animation: none; opacity: 0.72; }
}
.chat__notice {
  margin: 4px 0 0;
  align-self: center;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: rgba(251, 247, 250, 0.85);
}

.composer {
  position: relative;
  margin: 0 10px calc(16px + var(--safe-bottom));
  border-radius: 26px;
  padding: 4px 6px 6px;
  display: flex;
  flex-direction: column;
}
.composer__input {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 12px 6px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  line-height: 1.4;
  resize: none;
  outline: none;
}
.composer__input::placeholder { color: rgba(251, 247, 250, 0.55); }
/* Tools on the left line up with the text above; send on the right. */
.composer__actions { display: flex; align-items: center; gap: 2px; padding-left: 2px; }
.composer__spacer { flex-grow: 1; }
.composer__tool,
.composer__send {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.composer__tool { background: transparent; color: rgba(251, 247, 250, 0.75); }
.composer__tool:active { background: rgba(255, 255, 255, 0.1); }
.composer__tool:disabled { color: rgba(251, 247, 250, 0.3); cursor: default; }
.composer__send { width: 36px; height: 36px; border-radius: 18px; margin-right: 2px; background: var(--rose); color: var(--plum); }
.composer__send:disabled { background: rgba(255, 255, 255, 0.16); color: rgba(251, 247, 250, 0.5); cursor: default; }

/* ---- Stardust (chat): every message you send uses some (stardust.py) ---- */

/* Top right: the tier's icon and your balance, one button. */
.stardust-pill {
  height: 44px;
  min-width: 44px;
  padding: 0 16px 0 14px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stardust-pill:active { transform: scale(0.97); }
/* The Stardust icon takes the colour of the tier you're on. */
.chat { --tier: var(--planetary); }
.chat[data-current-tier="stellar"] { --tier: var(--stellar); }
.chat[data-current-tier="galactic"] { --tier: var(--galactic); }
.stardust-pill__balance svg, .stardust-sheet__left svg, .stardust-sheet__balance svg { color: var(--tier); }
.stardust-pill__balance { display: flex; align-items: center; gap: 4px; line-height: 1; font-variant-numeric: tabular-nums; }
.stardust-pill:focus-visible, .stardust-option:focus-visible, .stardust-sheet__link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Out of Stardust: sits on the composer, instead of sending. */
.stardust-out {
  position: relative;
  z-index: 1;
  margin: 0 10px 10px;
  padding: 18px 16px 16px;
  border-radius: 26px;
  background: #30223F;
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: stardust-out-up 0.25s ease-out;
}
@keyframes stardust-out-up { from { transform: translateY(16px); opacity: 0; } }
.stardust-out__title { margin: 0; font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 28px; line-height: 1.05; }
.stardust-out__text { margin: 0 0 4px; font-size: 15px; line-height: 1.45; color: var(--text-muted); }

/* The tier and pack sheets. */
.stardust-sheet { gap: 0; padding-left: 16px; padding-right: 16px; }
.stardust-sheet__grab {
  align-self: center;
  width: 88px;
  height: 28px;
  margin: -6px 0 18px;
  padding: 0;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stardust-sheet__grab span { width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }
.stardust-sheet__grab:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 14px; }
.stardust-sheet__title { margin: 0 0 6px; font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 30px; line-height: 1.1; }
.stardust-sheet__text { margin: 0 0 14px; font-size: 15px; line-height: 1.45; color: var(--text-muted); }
.stardust-sheet__balance {
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.stardust-sheet__balance-left { font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--text-muted); }
.stardust-sheet__foot { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.stardust-sheet__left { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 12px; border-radius: 18px; background: rgba(255, 255, 255, 0.07); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stardust-sheet__link {
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.stardust-sheet .button-primary { width: 100%; border: 0; margin-top: 16px; font-family: inherit; cursor: pointer; }
.stardust-sheet .editor__error { margin-top: 10px; }

.stardust-options { display: flex; flex-direction: column; gap: 8px; }
.stardust-option {
  width: 100%;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stardust-option[aria-checked="true"] { border-color: rgba(251, 247, 250, 0.85); background: rgba(255, 255, 255, 0.08); }
.stardust-option--pack { min-height: 64px; }
.stardust-option__icon { display: flex; flex-shrink: 0; }
.stardust-option__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.stardust-option__name { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 24px; line-height: 1; }
.stardust-option__line { font-size: 13.5px; line-height: 1.35; color: var(--text-muted); }
.stardust-option__cost { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.stardust-option__per { font-weight: 400; font-size: 13px; color: var(--text-muted); }
.stardust-option__tick {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.stardust-option[aria-checked="true"] .stardust-option__tick { background: var(--text); border-color: var(--text); color: var(--plum); }
.stardust-option__amount { display: flex; align-items: center; gap: 5px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stardust-option__tag {
  margin-left: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.stardust-option__price { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* How he writes: each tier a card, its icon in a soft square (rose when
   picked), the price stacked on the right, a white edge and check when
   picked. */
.stardust-option--tier {
  position: relative;
  min-height: 76px;
  padding: 14px 14px 14px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  gap: 14px;
  transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
}
.stardust-option--tier[aria-checked="true"] { border-color: rgba(251, 247, 250, 0.9); background: rgba(255, 255, 255, 0.09); }
.stardust-option--tier .stardust-option__icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease-out;
}
.stardust-option--planetary { --own: var(--planetary); }
.stardust-option--stellar { --own: var(--stellar); }
.stardust-option--galactic { --own: var(--galactic); }
.stardust-option--tier .stardust-option__icon { color: var(--own); }
.stardust-option--tier[aria-checked="true"] .stardust-option__icon { background: color-mix(in srgb, var(--own) 20%, transparent); }
.stardust-option--tier .stardust-option__amount-line svg { color: var(--own); }
.stardust-option--tier .stardust-option__name { font-size: 22px; }
.stardust-option--tier .stardust-option__body { gap: 5px; }
.stardust-option--tier .stardust-option__cost { flex-direction: column; align-items: flex-end; gap: 2px; }
.stardust-option__amount-line { display: inline-flex; align-items: center; gap: 4px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stardust-option--tier .stardust-option__per { font-size: 11px; font-weight: 500; letter-spacing: 0.02em; }
.stardust-option--tier .stardust-option__tick { width: 24px; height: 24px; border-radius: 12px; }

/* Not open yet: faded and can't be picked; the label says so in words. */
.stardust-option--soon { cursor: default; }
.stardust-option--soon .stardust-option__icon,
.stardust-option--soon .stardust-option__body { opacity: 0.45; }
.stardust-option__soon {
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
}
.stardust-busy { opacity: 0.5; pointer-events: none; }

/* ---- Shared controls ---- */

.pill-button {
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.pill-select {
  position: relative;
  height: 40px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
}
.pill-select select {
  appearance: none;
  -webkit-appearance: none;
  height: 100%;
  padding: 0 30px 0 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
}
.pill-select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 16px;
  width: 6px;
  height: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  pointer-events: none;
}
.pill-select option { color: var(--plum); }
button.button-primary { width: 100%; border: 0; font: inherit; font-weight: 600; font-size: 16px; gap: 8px; cursor: pointer; transition: opacity 0.2s; }
.button-primary:disabled, .button-primary[aria-disabled="true"] { opacity: 0.4; cursor: default; transform: none; pointer-events: none; }

.sheet__edit { position: absolute; top: 18px; left: 14px; width: 40px; height: 40px; border-radius: 20px; }

/* Floating tab bar (Home, Chats, Create, Yours), inside the phone column. */
.tabbar {
  position: fixed;
  bottom: calc(22px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  height: 64px;
  padding: 0 8px;
  border-radius: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tabbar__tab {
  width: 68px;
  height: 48px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-soft);
}
.tabbar__tab[aria-current="page"] { background: rgba(255, 255, 255, 0.16); color: var(--text); font-weight: 600; }
.tabbar__create {
  width: 52px;
  height: 48px;
  border-radius: 24px;
  background: var(--rose);
  color: var(--plum);
  display: flex;
  align-items: center;
  justify-content: center;
}
.home { padding-bottom: 90px; }

/* ---- Create: genre, idea, where it begins, his past (/create, /c/{id}/edit) ---- */

.make {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(240, 139, 180, 0.14), rgba(30, 15, 46, 0) 70%),
    var(--bg);
}
.make__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 14px 6px;
}
.make__main { flex-grow: 1; display: flex; flex-direction: column; gap: 16px; padding: 8px 16px 24px; }
.make__footer {
  position: sticky;
  bottom: 0;
  padding: 16px 16px calc(24px + var(--safe-bottom));
  background: linear-gradient(rgba(30, 15, 46, 0), var(--plum) 40%);
}
.make__error { margin: 0 4px; color: var(--text-muted); font-size: 15px; line-height: 1.5; }
.make__error a, .link-button { color: var(--text); text-decoration: underline; }
.link-button { border: 0; padding: 0; background: none; font: inherit; cursor: pointer; }

/* Where you are: four thin segments in the top bar. */
/* Sits in the top bar between the back button and its spacer, centred on them. */
.steps { flex: 1; max-width: 200px; display: flex; gap: 4px; margin: 0 16px; }
.steps__part { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
.steps__part.is-on { background: var(--text); }

/* The guide: Cupcow, the mascot, talks you through it, in a speech bubble.
   The one place in the app with exclamation marks (AGENTS.md). */
.guide { display: flex; align-items: flex-end; gap: 10px; }
.guide__mascot { flex-shrink: 0; overflow: visible; filter: drop-shadow(0 6px 16px rgba(240, 139, 180, 0.22)); animation: guide-bob 3.2s ease-in-out infinite; }
.guide__mascot--thinking { animation: guide-think 1.6s ease-in-out infinite; }
.guide__thinking, .guide__mascot--thinking .guide__awake { display: none; }
.guide__mascot--thinking .guide__thinking { display: inline; }
.guide__eye { transform-box: fill-box; transform-origin: center; animation: guide-blink 4.5s infinite; }
.guide__line {
  margin: 0;
  max-width: 290px;
  padding: 14px 16px;
  border-radius: 22px 22px 22px 6px;
  background: rgba(48, 34, 63, 0.6);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.4;
}
.guide__dots { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.guide__dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--text-muted); animation: guide-dot 1.2s infinite; }
.guide__dots i:nth-child(2) { animation-delay: 0.15s; }
.guide__dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes guide-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes guide-think { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes guide-blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes guide-dot { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Step 1: genres, one column. */
.genres { display: flex; flex-direction: column; gap: 10px; }
.genre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px 14px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  -webkit-tap-highlight-color: transparent;
}
.genre:active { background: rgba(255, 255, 255, 0.1); }
.genre:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.genre__name { display: block; font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 28px; line-height: 1; }
.genre__line { display: block; margin-top: 5px; font-size: 14.5px; color: var(--text-muted); }
.genre__go { flex-shrink: 0; color: rgba(251, 247, 250, 0.5); }

/* Step 2: the idea box, with example ideas fading in and out while it's empty. */
.field {
  position: relative;
  min-height: 220px;
  border-radius: 24px;
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.field:focus-within { box-shadow: inset 0 0 0 1.5px rgba(251, 247, 250, 0.55), 0 8px 30px rgba(30, 15, 46, 0.3); }
.field__input {
  position: relative;
  z-index: 1;
  flex-grow: 1;
  min-height: 180px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 16px 16px 8px;
  font: inherit;
  font-size: 18px;
  line-height: 1.5;
  resize: none;
  outline: none;
}
.field__count { align-self: flex-end; padding: 0 14px 10px; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.examples { position: absolute; top: 20px; left: 20px; right: 20px; pointer-events: none; }
.examples__line {
  display: block;
  font-size: 18px;
  line-height: 1.5;
  color: rgba(251, 247, 250, 0.42);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.examples__line.is-leaving { opacity: 0; transform: translateY(-4px); }

/* Steps 3–4: four suggestions to pick from. */
.picks { display: flex; flex-direction: column; gap: 10px; }
.pick {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 60px 16px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pick[aria-checked="true"] { background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 2px var(--text); }
.pick:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.pick__title { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 24px; line-height: 1.05; }
.pick__text { font-size: 15px; line-height: 1.45; color: #C7C1CA; }
.pick__edit {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  border-radius: 22px;
  background: transparent;
  color: rgba(251, 247, 250, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pick__edit::before { content: ""; position: absolute; inset: 4px; border-radius: 18px; background: rgba(255, 255, 255, 0.08); }
.pick__edit svg { position: relative; }
.pick--loading { gap: 10px; padding-right: 16px; cursor: default; }
.pick-own {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

/* Loading surfaces: a soft sheen moving across. */
.sheen {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.05) 100%);
  background-size: 600px 100%;
  animation: sheen-move 1.4s linear infinite;
}
.pick--loading .sheen { height: 14px; width: 92%; }
.pick--loading .sheen:first-child { height: 22px; width: 55%; }
.pick--loading .sheen:last-child { width: 70%; }
@keyframes sheen-move { from { background-position: -300px 0; } to { background-position: 300px 0; } }

/* The editor sheet with two fields (a suggestion's title and line). */
.editor__label { padding: 4px 8px 0; font-size: 12px; font-weight: 600; color: var(--text-faint); }
.editor__text--title { min-height: 0; font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 26px; line-height: 1.15; }

/* ---- Create: writing him (checklist) ---- */

.drafting__progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgba(255, 255, 255, 0.1); }
.drafting__bar { display: block; height: 100%; width: 0; background: var(--text); transition: width 1.2s cubic-bezier(0.3, 0.7, 0.2, 1); }
.checklist__result .action { font-style: italic; color: rgba(251, 247, 250, 0.62); }
a.button-primary[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.checklist { margin: 0; padding: 6px 0; list-style: none; border-radius: 24px; }
.checklist__item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; }
.checklist__item + .checklist__item { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.checklist__mark { position: relative; width: 24px; height: 24px; flex-shrink: 0; margin-top: 1px; }
.checklist__mark svg { position: absolute; inset: 0; width: 24px; height: 24px; }
.checklist__spinner { color: var(--text); animation: spin 0.9s linear infinite; }
.checklist__check { display: none; }
.checklist__item:not(.is-active):not(.is-done) .checklist__mark { border-radius: 12px; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.28); }
.checklist__item:not(.is-active) .checklist__spinner { display: none; }
.checklist__item.is-done .checklist__mark { border-radius: 12px; background: var(--text); color: var(--plum); }
.checklist__item.is-done .checklist__check { display: block; padding: 5px; }
.checklist__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.checklist__label { font-size: 15px; font-weight: 600; color: rgba(251, 247, 250, 0.5); }
.checklist__item.is-active .checklist__label,
.checklist__item.is-done .checklist__label { color: var(--text); }
.checklist__result {
  font-size: 14px;
  line-height: 1.4;
  color: rgba(251, 247, 250, 0.85);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  animation: fade-up 0.45s ease-out both;
}
.checklist__item:not(.is-done) .checklist__result { display: none; }
.checklist__item[data-step="title"] .checklist__result { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 22px; }
.shimmer { display: none; height: 10px; width: 200px; border-radius: 5px; margin-top: 3px; }
.checklist__item.is-active .shimmer {
  display: block;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.24) 50%, rgba(255, 255, 255, 0.08) 100%);
  background-size: 220px 100%;
  animation: sheen 1.3s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sheen { from { background-position: -220px 0; } to { background-position: 220px 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Create: his page, edited in place (/c/{id}/edit) ---- */

.edit { position: relative; min-height: 100dvh; background: #271836; padding-bottom: calc(120px + var(--safe-bottom)); }
.edit__media { position: relative; height: 410px; background: #30223F; }
.edit__drawing { position: absolute; inset: 0; border-radius: 0; display: none; }
.edit__view { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; padding: 0; background: transparent; cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
.edit__view:disabled { cursor: default; }
.edit__view:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }

/* His picture, full screen: the whole picture on black, inside the phone column. */
.lightbox {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--app-width));
  z-index: 12;
  background: var(--plum);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightbox-in 0.2s ease-out;
  cursor: zoom-out;
}
.lightbox__img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox__close { position: absolute; top: calc(12px + var(--safe-top)); left: 14px; border: 0; padding: 0; color: var(--text); cursor: pointer; }
@keyframes lightbox-in { from { opacity: 0; } }
.edit__media.is-drawing .edit__drawing { display: block; }
.edit__media.is-drawing .edit__img { opacity: 0.35; }
.edit__picture-status { position: absolute; left: 16px; top: calc(72px + var(--safe-top)); margin: 0; font-size: 13.5px; color: var(--text-soft); text-shadow: 0 1px 8px rgba(30, 15, 46, 0.6); }
.edit__picture-status:empty { display: none; }
.edit__picture-tools { position: absolute; right: 14px; top: 228px; z-index: 2; display: flex; gap: 8px; }
.edit__picture-tools .icon-button { border: 0; padding: 0; color: var(--text); cursor: pointer; }
.edit__picture-tools .icon-button:disabled { opacity: 0.45; cursor: default; }
.edit__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 12%; }
.edit__shade { position: absolute; inset: 0; background: linear-gradient(rgba(30, 15, 46, 0.5) 0%, rgba(30, 15, 46, 0) 22%, rgba(39, 24, 54, 0) 45%, rgba(39, 24, 54, 0.85) 78%, #271836 100%); }
.edit__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(12px + var(--safe-top)) 14px 8px;
}
.icon-button--primary { background: var(--rose); color: var(--plum); border: 0; }
button.icon-button { padding: 0; color: var(--text); cursor: pointer; }
button.icon-button--primary { color: var(--plum); }

.edit__main {
  position: relative;
  margin-top: -122px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Fields are text, not text boxes: each is a button that opens the editor. */
.text-field, .ed-card {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.field-head { display: flex; flex-direction: column; gap: 8px; padding: 0 4px 4px; }
.text-field {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.text-field:focus-visible, .ed-card:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
.text-field--title {
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  font-size: 48px;
  line-height: 0.98;
  letter-spacing: -0.6px;
  text-shadow: 0 2px 24px rgba(30, 15, 46, 0.5);
}
.text-field--hook { font-size: 16px; line-height: 1.4; color: #DFDAE0; }
.text-field--story {
  font-size: 15px;
  line-height: 1.55;
  color: #C7C1CA;
  max-height: calc(1.55em * 6);
  overflow: hidden;
}
/* Long stories fade out at the cut (edit.js sets it when the text overflows). */
.text-field--story.is-clipped {
  -webkit-mask-image: linear-gradient(var(--plum) 65%, transparent);
  mask-image: linear-gradient(var(--plum) 65%, transparent);
}
.text-field--note { font-size: 15px; line-height: 1.5; color: var(--text-soft); }
.text-field--empty { color: rgba(251, 247, 250, 0.45); }

.ed-card {
  width: 100%;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.ed-card:active { background: rgba(255, 255, 255, 0.07); }
.ed-card--preview { cursor: default; }
.ed-card__head { display: flex; align-items: center; justify-content: space-between; min-height: 26px; }
.ed-card__label { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: rgba(251, 247, 250, 0.5); }
.pen {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(251, 247, 250, 0.7);
}

/* The opening scene card: the whole scene, small, as chat shows it. */
.scene-peek { display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.scene-peek .bubble, .scene-peek .narration { font-size: 13.5px; padding-top: 9px; padding-bottom: 9px; }
.scene-peek .narration { padding: 0; }
.scene-peek .from-him--image { width: 46%; }

.edit__footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 5;
  width: min(100%, var(--app-width));
  padding: 40px 16px calc(26px + var(--safe-bottom));
  background: linear-gradient(rgba(39, 24, 54, 0), rgba(39, 24, 54, 0.96) 45%, #271836);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  width: max-content;
  max-width: min(90vw, 420px);
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  text-align: center;
}
.toast.is-error { border-color: var(--rose); }
/* A one-off note on page load (e.g. "… was deleted"): fades after a few seconds. */
.toast--fade { animation: toast-out 0.3s ease-out 3.5s forwards; }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }

/* ---- Editor sheet: one plain text box above the keyboard ----
   Used for every field on his page and for parts of the opening scene.
   The text is 17px (iOS zooms into anything under 16px) and the sheet sits on
   the keyboard (--keyboard, from static/keyboard.js), so nothing jumps. */

.editor { position: fixed; inset: 0; z-index: 10; }
.editor__scrim { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: rgba(30, 15, 46, 0.5); }
.editor__sheet {
  position: absolute;
  left: 50%;
  bottom: var(--keyboard, 0px);
  transform: translateX(-50%);
  width: min(100%, var(--app-width));
  max-height: calc(100dvh - var(--keyboard, 0px) - var(--safe-top) - 24px);
  padding: 10px 12px calc(12px + var(--safe-bottom));
  border-radius: 26px 26px 0 0;
  background: #30223F;
  box-shadow: 0 -10px 40px rgba(30, 15, 46, 0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: confirm-up 0.25s ease-out;
}
.editor__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.editor__close { background: rgba(255, 255, 255, 0.08); border: 0; color: var(--text); cursor: pointer; }
.editor__title { margin: 0; font-size: 15px; font-weight: 600; text-align: center; }
.editor__text {
  width: 100%;
  min-height: 3em;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
  font-size: 17px;
  line-height: 1.55;
  resize: none;
  outline: none;
}
.editor__text::placeholder { color: rgba(251, 247, 250, 0.45); }
.editor__meta { margin: 0; padding: 0 8px; font-size: 12px; color: var(--text-faint); text-align: right; font-variant-numeric: tabular-nums; }
.editor__error { margin: 0; padding: 0 8px; font-size: 13.5px; color: var(--rose); }
.editor__speakers { padding: 0 4px; }
.editor__tools { display: flex; align-items: center; gap: 8px; }
.editor__tool {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.editor__tool:disabled { opacity: 0.35; cursor: default; }
.editor__tool--danger { color: var(--rose); }
.has-sheet .composer { visibility: hidden; }

/* ---- Opening scene (/c/{id}/opening) ---- */

.narration {
  align-self: center;
  max-width: 86%;
  margin: 2px 0;
  text-align: center;
  font-size: 15px;
  line-height: 1.55;
  font-style: italic;
  color: #CCC6CF;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.narration .action { font-style: normal; }
/* In the editor every part is a button; it should still look exactly like chat. */
.scene-part { font: inherit; color: inherit; text-align: inherit; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.from-him { background: none; padding: 0; text-align: left; }
button.narration { background: none; padding: 0; font-style: italic; color: #CCC6CF; text-align: center; }
button.bubble--me { color: var(--plum); text-align: left; }
.scene-part:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 22px; }
.scene-part.is-selected { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 22px; }
.scene-empty { margin: auto 0 0; align-self: center; max-width: 80%; text-align: center; font-size: 15px; color: var(--text-muted); }

/* Who says it: a small segmented control of real radio buttons. */
.speakers { display: flex; gap: 2px; padding: 3px; border-radius: 20px; background: rgba(255, 255, 255, 0.08); }
.speakers__option { position: relative; cursor: pointer; }
.speakers__option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.speakers__option span {
  height: 38px;
  padding: 0 12px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
}
.speakers__option span img { width: 26px; height: 26px; margin-left: -8px; border-radius: 13px; object-fit: cover; object-position: center 15%; }
.speakers__option input:checked + span { background: rgba(255, 255, 255, 0.2); color: var(--text); font-weight: 600; }
.speakers__option input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 1px; }
.editor .speakers__option { flex: 1; }
.editor .speakers__option span { justify-content: center; }

/* Add a picture: describe the moment, 4 new ones fill in. */
.describe { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.describe__label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.describe__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 16px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.describe__input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; outline: none; }
.describe__input::placeholder { color: rgba(251, 247, 250, 0.45); }
.describe__go {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 22px;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.describe__go:disabled { opacity: 0.4; cursor: default; }
.drawn { position: relative; align-self: center; width: min(70%, 300px); }
.drawn__tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  background: #372945;
}
.drawn__tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drawn__tile.is-loading {
  background: linear-gradient(110deg, #372945 30%, #443651 50%, #372945 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.drawn__tile.is-failed { opacity: 0.4; }
.drawn__tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; }
.drawn__tools .icon-button { border: 0; padding: 0; color: var(--text); cursor: pointer; }
.drawn__tools .icon-button:disabled { opacity: 0.45; cursor: default; }
.drawn__words { margin: 0; text-align: center; font-size: 15px; color: var(--text-muted); }
@keyframes shimmer { to { background-position: -200% 0; } }
.editor__sheet--picture { gap: 14px; padding-left: 16px; padding-right: 16px; }

.toast__action {
  margin-left: 10px;
  padding: 0 4px;
  min-height: 32px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- Confirm sheet (delete) ---- */

.edit__bar-end { display: flex; align-items: center; gap: 8px; }
.edit__bar .icon-button--danger { width: 44px; height: 44px; color: var(--rose); }
.confirm { position: fixed; inset: 0; z-index: 10; }
.confirm__scrim { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: rgba(30, 15, 46, 0.62); }
.confirm__sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, var(--app-width));
  padding: 10px 16px calc(26px + var(--safe-bottom));
  border-radius: 28px 28px 0 0;
  background: #30223F;
  box-shadow: 0 -10px 40px rgba(30, 15, 46, 0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: confirm-up 0.25s ease-out;
}
@keyframes confirm-up { from { transform: translate(-50%, 24px); opacity: 0; } }
.confirm__sheet:focus { outline: none; }
.confirm__grabber { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }
.confirm__title { margin: 6px 4px 0; font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 30px; line-height: 1.05; }
.confirm__text { margin: 0 4px 4px; font-size: 15px; line-height: 1.5; color: var(--text-muted); }
.button-danger, .button-plain {
  width: 100%;
  border: 0;
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.button-danger { height: 54px; border-radius: 27px; background: var(--white); color: var(--plum); font-size: 16px; font-weight: 600; }
.button-danger:disabled { opacity: 0.5; cursor: default; }
.button-plain { height: 48px; border-radius: 24px; background: transparent; color: var(--text-soft); font-size: 15px; font-weight: 500; }
.button-danger:focus-visible, .button-plain:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .checklist__spinner, .shimmer, .checklist__result { animation: none !important; }
  .hero__slide, .hero__slide.is-active { transition: none; }
  .confirm__sheet, .editor__sheet, .lightbox, .stardust-out { animation: none; }
  .stardust-pill:active { transform: none; }
  .drawn__tile.is-loading, .sheen, .guide__mascot, .guide__eye, .guide__dots i { animation: none; }
  .examples__line { transition: none; }
}

/* ---- Chats tab (/chats) ---- */

.chats { padding: 4px 12px 110px; }
.chats__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 18px;
  -webkit-tap-highlight-color: transparent;
}
.chat-row:active { background: rgba(255, 255, 255, 0.06); }
.chat-row__avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 28px;
  object-fit: cover;
  object-position: center 15%;
  background: #30223F;
}
.chat-row__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-row__title { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 22px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row__last { font-size: 13.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row__time { flex-shrink: 0; align-self: flex-start; margin-top: 6px; font-size: 12px; color: var(--text-faint); }

/* Edit page: his Home card, same component and width as on Home. */
.home-preview { display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.home-preview .card {
  flex-shrink: 0;
  width: calc((min(100vw, var(--app-width)) - 28px) / 2); /* one Home grid column */
}
