/* Supernova — mahogany, leather, cigar and brandy. The whole app lives
   inside the senior partner's office: a mahogany frame with brass
   fittings runs around the entire viewport, brandy-warm light pools in
   the glass and the polished wood, corners are finished like furniture,
   and every forty-five seconds a slow sweep of warm light wipes across
   the whole room. The materials are PHOTOGRAPHIC plates (public/textures/):
   real mahogany grain, real leather, real brass — gradients now only
   shade, pool light, and seat the plates in the room; they no longer
   pretend to be the material. Every view fades in slowly. All motion is
   transform/opacity, and all of it stops under .rm (reduced motion,
   from the OS setting or the Settings toggle). */

:root {
  --ink: #f0e7d7;
  --ink-soft: #b3a186;
  --steel-1: #32261c;
  --steel-2: #241a13;
  --steel-3: #17100c;
  --line: #4d3a28;
  --gold-1: #f3d18b;
  --gold-2: #cf9a44;
  --gold-3: #96682a;
  /* The photographic plates. One mahogany plate serves every wooden
     surface, cropped differently per surface so no two boards match. */
  --wood-panel: url("/textures/mahogany-panel.webp");
  --wood-rail-h: url("/textures/mahogany-rail-h.webp");
  --wood-rail-v: url("/textures/mahogany-rail-v.webp");
  --leather: url("/textures/leather.webp");
  --brass: url("/textures/brass.webp");
  --glass-reflect: url("/textures/glass-reflect.webp");
  /* Leather-backed panel: real full-grain leather under a dark tonal
     glaze, so the grain reads as material, not wallpaper. */
  --card: linear-gradient(165deg, rgba(64, 48, 33, 0.80) 0%, rgba(43, 31, 21, 0.88) 55%, rgba(28, 19, 13, 0.94) 100%), var(--leather) center / 360px repeat, #221810;
  --metal-btn: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 52%, var(--gold-3) 100%);
  --shadow: 0 18px 40px rgba(10, 5, 2, 0.6), 0 2px 8px rgba(10, 5, 2, 0.5);
  --radius: 20px;
  /* Rolled-glass sheen: a curved highlight that sits on top of a surface
     stack, the way light rolls over thick vintage glass. */
  --glass-roll: radial-gradient(130% 95% at 50% -35%, rgba(255, 236, 200, 0.13), transparent 55%);
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  min-height: 100vh;
  box-sizing: border-box;
  /* The room inside the frame: the app column clears the mahogany rails
     on every side, the way a desk sits inside an office. */
  padding: 30px 20px 36px;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(207, 154, 68, 0.16), transparent 60%),
    radial-gradient(900px 700px at 110% 10%, rgba(122, 84, 50, 0.16), transparent 55%),
    radial-gradient(760px 520px at 50% 112%, rgba(232, 160, 70, 0.15), transparent 60%),
    linear-gradient(165deg, #2a1d13 0%, #1d140e 52%, #120c08 100%);
  background-attachment: fixed;
}
/* A vignette over the whole room, so the background itself has depth
   instead of reading as flat paper. (The wall carries light, not a
   faked material — the wood and leather live in the plates.) */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 42%, transparent 58%, rgba(0, 0, 0, 0.46) 100%);
}
/* The office frame: rails cut from the photographic mahogany plate —
   a wide strip for the top and bottom, a tall strip for the sides,
   each rail cropped from a different stretch of the board (oversized
   background, opposed positions) so the grain never repeats its story.
   Directional shade sits over each rail so the room's light falls
   unevenly, the way it does on real joinery; a dark gap line and the
   brass pinstripe run just inside the rails, and the frame stands
   PROUD of the wall: the inset shadows along its inner edge are the
   shadow it casts into the room. The corner bosses are real elements
   (.boss) wearing the brass plate. */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 40;
  box-shadow:
    inset 0 0 90px rgba(0, 0, 0, 0.5),
    inset 0 24px 20px -16px rgba(0, 0, 0, 0.62),
    inset 0 -24px 20px -16px rgba(0, 0, 0, 0.62),
    inset 24px 0 20px -16px rgba(0, 0, 0, 0.62),
    inset -24px 0 20px -16px rgba(0, 0, 0, 0.62);
  background:
    /* brass pinstripe, inset 17px — a slice of the real metal plate */
    var(--brass),
    var(--brass),
    var(--brass),
    var(--brass),
    /* the shadow gap between pinstripe and rail */
    linear-gradient(180deg, rgba(8, 4, 2, 0.85), rgba(8, 4, 2, 0.85)),
    linear-gradient(180deg, rgba(8, 4, 2, 0.85), rgba(8, 4, 2, 0.85)),
    linear-gradient(90deg, rgba(8, 4, 2, 0.85), rgba(8, 4, 2, 0.85)),
    linear-gradient(90deg, rgba(8, 4, 2, 0.85), rgba(8, 4, 2, 0.85)),
    /* room light falling unevenly across each rail */
    linear-gradient(180deg, rgba(10, 5, 2, 0.34) 0%, transparent 45%, rgba(255, 224, 175, 0.10) 88%, rgba(10, 5, 2, 0.30) 100%),
    linear-gradient(0deg, rgba(10, 5, 2, 0.34) 0%, transparent 45%, rgba(255, 224, 175, 0.10) 88%, rgba(10, 5, 2, 0.30) 100%),
    linear-gradient(90deg, rgba(10, 5, 2, 0.34) 0%, transparent 45%, rgba(255, 224, 175, 0.10) 88%, rgba(10, 5, 2, 0.30) 100%),
    linear-gradient(-90deg, rgba(10, 5, 2, 0.34) 0%, transparent 45%, rgba(255, 224, 175, 0.10) 88%, rgba(10, 5, 2, 0.30) 100%),
    /* the mahogany rails themselves */
    var(--wood-rail-h),
    var(--wood-rail-h),
    var(--wood-rail-v),
    var(--wood-rail-v),
    /* dark underlay so no gap can ever show wall */
    linear-gradient(180deg, #17100c, #17100c),
    linear-gradient(180deg, #17100c, #17100c),
    linear-gradient(90deg, #17100c, #17100c),
    linear-gradient(90deg, #17100c, #17100c);
  background-size:
    calc(100% - 34px) 2px, calc(100% - 34px) 2px, 2px calc(100% - 34px), 2px calc(100% - 34px),
    calc(100% - 30px) 2px, calc(100% - 30px) 2px, 2px calc(100% - 30px), 2px calc(100% - 30px),
    100% 15px, 100% 15px, 15px 100%, 15px 100%,
    135% 15px, 135% 15px, 15px 135%, 15px 135%,
    100% 15px, 100% 15px, 15px 100%, 15px 100%;
  background-position:
    50% 17px, 50% calc(100% - 17px), 17px 50%, calc(100% - 17px) 50%,
    50% 15px, 50% calc(100% - 15px), 15px 50%, calc(100% - 15px) 50%,
    0 0, 0 100%, 0 0, 100% 0,
    0% 0, 100% 100%, 0 0%, 100% 100%,
    0 0, 0 100%, 0 0, 100% 0;
  background-repeat: no-repeat;
}
/* The corner bosses: small brass discs seated over the pinstripe
   corners, wearing a tight crop of the photographed brass — each one
   cropped from a different patch of the metal — domed by shading and
   seated with a real contact shadow. */
.boss {
  position: fixed; width: 19px; height: 19px; border-radius: 50%;
  z-index: 41; pointer-events: none;
  background: var(--brass) center / 190% no-repeat, #6b4a1f;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(16, 9, 3, 0.65),
    inset 0 1px 2px rgba(255, 246, 220, 0.6),
    inset 0 -3px 5px rgba(40, 22, 4, 0.6);
}
.boss::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 34% 27%, rgba(255, 250, 230, 0.55), transparent 48%);
}
.boss-tl { top: 13px; left: 13px; background-position: 22% 30%; }
.boss-tr { top: 13px; right: 13px; background-position: 72% 18%; }
.boss-bl { bottom: 13px; left: 13px; background-position: 30% 76%; }
.boss-br { bottom: 13px; right: 13px; background-position: 78% 68%; }
/* The forty-five-second shine: a slow, soft wipe of brandy-warm light
   across the whole app — polished mahogany, glass, and all — then a
   long rest. A sheen passing over; it never asks for attention. */
.app-shine {
  position: fixed; inset: -25% -15%; z-index: 42; pointer-events: none;
  background: linear-gradient(102deg,
    transparent 40%,
    rgba(255, 205, 130, 0.07) 46%,
    rgba(255, 238, 200, 0.15) 50%,
    rgba(255, 205, 130, 0.07) 54%,
    transparent 60%);
  transform: translateX(-78%);
  animation: app-shine 45s ease-in-out infinite;
}
@keyframes app-shine {
  0% { transform: translateX(-78%); animation-timing-function: ease-in-out; }
  14%, 100% { transform: translateX(78%); }
}
#app { max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; position: relative; z-index: 1; }

/* Views fade in slowly; nothing pops. */
.view { opacity: 0; transform: translateY(6px); transition: opacity 0.6s ease, transform 0.6s ease; }
.view.in { opacity: 1; transform: none; }
body.rm .view { transition: none; }

h1 { font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; }
.tagline { color: var(--ink-soft); line-height: 1.5; }
.error { color: #ff9a7a; }
.fineprint, .hint { color: var(--ink-soft); font-size: 0.82rem; }
/* The local-preview notice in the chat view: small, quiet, honest — a
   leather card in her office's own materials. */
.notice {
  margin: 0 0 10px; padding: 9px 13px; border-radius: 14px;
  background: var(--glass-roll), var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 236, 200, 0.10), 0 4px 10px rgba(0, 0, 0, 0.35);
  color: var(--ink-soft); font-size: 0.85rem; line-height: 1.45;
}

/* The emblem: a brass disc — the photographed metal, shaded into a
   dome — around a dark mahogany heart, the tier initial in gold. */
.emblem {
  width: 84px; height: 84px; margin: 26px auto 10px; border-radius: 50%;
  background:
    linear-gradient(150deg, rgba(255, 244, 214, 0.22), rgba(60, 35, 8, 0.28) 70%),
    var(--brass) 30% 40% / 230% no-repeat, #6b4a1f;
  display: grid; place-items: center;
  box-shadow: var(--shadow), inset 0 2px 6px rgba(255, 255, 255, 0.35), inset 0 -8px 14px rgba(0, 0, 0, 0.6);
}
.emblem span {
  width: 66px; height: 66px; border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(146, 106, 62, 0.55), rgba(30, 18, 10, 0.55) 62%),
    var(--wood-panel) 20% 60% / 320% no-repeat, #241610;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 2rem; color: var(--gold-2);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.55), inset 0 1px 3px rgba(255, 240, 200, 0.25);
}
.emblem.small { width: 60px; height: 60px; margin-top: 6px; }
.emblem.small span { width: 46px; height: 46px; font-size: 1.4rem; }

/* Buttons: molten gold with a lit top edge; ghosts in brushed steel. */
.btn {
  font: 600 0.98rem var(--sans);
  border: 1px solid rgba(207, 154, 68, 0.3);
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  color: var(--ink);
  background: var(--glass-roll), var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -3px 7px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
  text-decoration: none; display: inline-block; text-align: center;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4); }
.btn.primary {
  /* The photographed brass under a molten glaze: the metal's own grain
     and patina carry through the tint. */
  background:
    linear-gradient(180deg, rgba(243, 209, 139, 0.74) 0%, rgba(207, 154, 68, 0.68) 52%, rgba(150, 104, 42, 0.80) 100%),
    var(--brass) 50% 35% / cover no-repeat, #96682a;
  color: #241a02;
  border-color: rgba(90, 60, 5, 0.6);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 246, 214, 0.9), inset 0 -6px 12px rgba(120, 75, 5, 0.35), 0 8px 18px rgba(0, 0, 0, 0.5);
}
.btn.ghost { background: transparent; box-shadow: none; }
.btn.wide { width: 100%; }

/* Sign-in */
.signin { text-align: center; padding-top: 5vh; }
.signin h1 { font-size: 2.4rem; margin: 8px 0 4px; }
.dev-form { margin-top: 22px; text-align: left; display: grid; gap: 12px; }
.dev-form label, .settings label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
input, textarea {
  font: 400 1rem var(--sans); color: var(--ink);
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(46, 33, 23, 0.92), rgba(30, 21, 14, 0.96)),
    var(--leather) center / 300px repeat, #1e150e;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--gold-2); outline-offset: 1px; }

/* Choose at open: identities, not looks. The one face sits above the
   list as a small round mark; the twelve are name, brief, and voice. */
.choose h1 { text-align: center; margin: 10px 0 6px; }
.choose .tagline { text-align: center; max-width: 46ch; margin: 0 auto 20px; }
.choose-face {
  width: 92px; height: 92px; margin: 14px auto 4px; border-radius: 50%;
  padding: 3px;
  background:
    linear-gradient(150deg, rgba(255, 244, 214, 0.20), rgba(60, 35, 8, 0.26) 70%),
    var(--brass) 66% 24% / 240% no-repeat, #6b4a1f;
  box-shadow: var(--shadow), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}
.choose-face img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 22%;
  display: block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  text-align: left; cursor: pointer; padding: 14px 14px 15px; overflow: hidden;
  border-radius: var(--radius); border: 1px solid rgba(207, 154, 68, 0.22);
  background: var(--glass-roll), var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -8px 14px rgba(0, 0, 0, 0.35), 0 10px 22px rgba(0, 0, 0, 0.45);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  font-family: var(--sans); color: var(--ink);
  display: flex; flex-direction: column; gap: 5px;
}
.card:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -8px 14px rgba(0, 0, 0, 0.35), 0 16px 30px rgba(0, 0, 0, 0.6); }
.card.picked { outline: 3px solid var(--gold-2); }
.card-name { font-family: var(--serif); font-size: 1.12rem; }
.card-tag { font-weight: 600; font-size: 0.86rem; color: var(--gold-2); }
.card-focus { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.45; }
.card-intro { font-size: 0.84rem; font-style: italic; color: var(--ink-soft); line-height: 1.45; border-top: 1px solid rgba(207, 154, 68, 0.16); padding-top: 7px; margin-top: 3px; }

/* The stage: the face, big and centred in the top third, in a softly
   lit room of its own. A pool of gold light behind the window, a glow
   pooled on the floor beneath it, the chat flowing below. */
.shell { padding-top: 4px; }
.stage {
  position: relative; text-align: center;
  padding: 20px 14px 14px; margin-bottom: 14px;
  border-radius: 30px;
  /* A real mahogany panel, glazed down into the room's register: the
     brandy light pools over the photographed grain, and the panel sits
     recessed — bevel light on its top edge, shade gathered at its foot. */
  background:
    radial-gradient(340px 250px at 50% 6%, rgba(232, 176, 92, 0.28), transparent 70%),
    radial-gradient(500px 340px at 50% 118%, rgba(176, 100, 44, 0.18), transparent 65%),
    linear-gradient(172deg, rgba(46, 31, 19, 0.52) 0%, rgba(29, 19, 12, 0.66) 52%, rgba(20, 13, 8, 0.78) 100%),
    var(--wood-panel) center / cover no-repeat,
    #1d140e;
  border: 1px solid rgba(207, 154, 68, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 2px 3px rgba(255, 235, 200, 0.13),
    inset 0 -16px 28px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(232, 176, 92, 0.06),
    0 14px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
/* The joinery bead: a recessed moulding line inset from the panel's
   edge, the way a cabinetmaker frames a fielded panel — a dark groove
   with a caught-light lip below it. */
.stage::before {
  content: ""; position: absolute; inset: 9px; border-radius: 22px;
  pointer-events: none; z-index: 0;
  border: 1px solid rgba(10, 5, 2, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 232, 190, 0.10),
    inset 0 0 22px rgba(0, 0, 0, 0.32),
    0 1px 0 rgba(255, 232, 190, 0.06);
}
.stage-floor {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 0;
  width: 250px; height: 34px; border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(207, 130, 58, 0.30), transparent 70%);
  filter: blur(7px); pointer-events: none;
}
.stage-meta { position: relative; z-index: 1; margin-top: 12px; }
.stage-meta .who { margin: 0; font-size: 1.55rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.stage-meta .role { margin: 4px auto 0; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.45; max-width: 42ch; }

/* The face window: a layered bezel — outer conic ring, a recessed
   channel, then the glass — with the loop playing under a moving sheen. */
.face-frame {
  position: relative; z-index: 1; margin: 0 auto;
  padding: 7px; border-radius: 36px;
  /* The bezel is a frame of the real mahogany, cropped tight from a
     different stretch of the board than the stage behind it — two
     boards from the same tree, never the same slice twice. */
  background:
    linear-gradient(160deg, rgba(255, 226, 180, 0.12), rgba(0, 0, 0, 0.26) 55%, rgba(0, 0, 0, 0.44)),
    var(--wood-panel) 68% 30% / 265% no-repeat, #2a1a10;
  box-shadow:
    0 24px 44px rgba(0, 0, 0, 0.65),
    0 4px 12px rgba(0, 0, 0, 0.55),
    inset 0 2px 3px rgba(255, 246, 214, 0.6),
    inset 0 -3px 6px rgba(0, 0, 0, 0.6);
}
.face-frame::before {
  /* The recessed channel between bezel and glass. */
  content: ""; position: absolute; inset: 3px; border-radius: 33px;
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.75), inset 0 -1px 2px rgba(255, 240, 200, 0.3);
  pointer-events: none; z-index: 3;
}
.face-frame::after {
  /* A slow light sweep across the metal itself. */
  content: ""; position: absolute; inset: 0; border-radius: 36px; overflow: hidden;
  background: linear-gradient(115deg, transparent 44%, rgba(255, 240, 200, 0.30) 50%, transparent 56%);
  transform: translateX(-70%); animation: bezel-sheen 13s ease-in-out infinite;
  pointer-events: none; z-index: 4;
}
@keyframes bezel-sheen {
  0%, 58% { transform: translateX(-70%); }
  88%, 100% { transform: translateX(70%); }
}
.face-frame.hero { width: min(302px, 76vw); aspect-ratio: 4 / 5; }
.face-glass {
  position: relative; width: 100%; height: 100%;
  border-radius: 29px; overflow: hidden; isolation: isolate;
  background: #0d0906;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), inset 0 -22px 34px rgba(0, 0, 0, 0.55), inset 0 12px 22px rgba(0, 0, 0, 0.4);
}
.face-glass::before {
  /* A real reflection in the glass: the photographed office window —
     golden mullions, a lamp's glow, shelves in the dark — laid over
     her at screen blend, so only its light survives and the room
     seems to stand on the viewer's side of the pane. */
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit;
  background: var(--glass-reflect) center / cover no-repeat;
  mix-blend-mode: screen; opacity: 0.32;
}
.face-glass::after {
  /* Rolled glass: a curved brandy-warm highlight bowed across the top
     of the pane and a faint amber return at the sill, the way light
     bends through thick old glass over a snifter. */
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(115% 52% at 50% -12%, rgba(255, 230, 175, 0.20), transparent 58%),
    radial-gradient(150% 80% at 50% 118%, rgba(232, 150, 60, 0.10), transparent 55%);
  box-shadow: inset 0 10px 18px -8px rgba(255, 232, 185, 0.18);
}
.face-img, .face-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
  display: block;
}
/* The light shift: a slow sheen crossing the glass, like light moving in the room. */
.face-sheen {
  position: absolute; inset: -20%; z-index: 2;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 224, 150, 0.14) 50%, transparent 58%);
  transform: translateX(-65%);
  animation: sheen 11s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen {
  0%, 55% { transform: translateX(-65%); }
  85%, 100% { transform: translateX(65%); }
}
.face-vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(120% 90% at 50% 38%, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
}
.face-live {
  position: absolute; right: 16px; bottom: 14px; z-index: 5;
  display: flex; align-items: center; gap: 5px;
  font: 600 0.66rem var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  color: #ffe9a8; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.face-live .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold-2); box-shadow: 0 0 8px var(--gold-2);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* The opening film: her office door, full-screen over the room, the
   film set in a mahogany door frame. It fades in slowly, plays once,
   and fades out over the chat; a tap dismisses it at any moment. */
.intro {
  position: fixed; inset: 0; z-index: 80;
  background: radial-gradient(120% 90% at 50% 42%, #1d140e 0%, #120c08 70%);
  display: grid; place-items: center;
  opacity: 0; transition: opacity 0.7s ease;
  cursor: pointer;
}
.intro.in { opacity: 1; }
.intro.out { opacity: 0; transition: opacity 0.95s ease; }
.intro-frame {
  width: min(100vw, 64vh); max-height: 100vh;
  padding: 7px; border-radius: 34px;
  background:
    linear-gradient(160deg, rgba(255, 226, 180, 0.12), rgba(0, 0, 0, 0.26) 55%, rgba(0, 0, 0, 0.44)),
    var(--wood-panel) 30% 72% / 265% no-repeat, #2a1a10;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), inset 0 2px 3px rgba(255, 246, 214, 0.6), inset 0 -3px 6px rgba(0, 0, 0, 0.6);
}
.intro-video {
  width: 100%; aspect-ratio: 2 / 3; max-height: calc(100vh - 14px);
  object-fit: cover; display: block; border-radius: 27px;
  background: #0d0906;
}
.intro-hint {
  position: absolute; left: 50%; bottom: max(5vh, 40px); transform: translateX(-50%);
  font: 600 0.78rem var(--sans); letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(240, 231, 215, 0.78); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  animation: pulse 3.2s ease-in-out infinite; pointer-events: none;
}

/* Tabs: a leather-wrapped segmented bar — the real hide under a dark
   glaze — seated deep in the panel. */
.tabs {
  display: flex; gap: 4px; padding: 4px; border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(52, 37, 24, 0.88), rgba(30, 20, 12, 0.94)),
    var(--leather) center / 300px repeat, #20150d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 6px rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.35);
  margin-bottom: 16px;
}
.tabs button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  font: 600 0.92rem var(--sans); color: var(--ink-soft);
  padding: 9px 4px; border-radius: 999px;
  transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}
.tabs button.on {
  background: var(--card); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -2px 5px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* Chat */
.thread { display: flex; flex-direction: column; gap: 10px; padding: 6px 2px 14px; }
.msg { display: flex; animation: rise 0.55s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 86%; padding: 11px 15px; border-radius: 19px; line-height: 1.55; font-size: 0.98rem;
  background: var(--glass-roll), var(--card);
  border: 1px solid rgba(207, 154, 68, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -6px 10px rgba(0, 0, 0, 0.35),
    0 6px 14px rgba(0, 0, 0, 0.45),
    0 1.5px 3px rgba(0, 0, 0, 0.4);
  border-bottom-left-radius: 6px;
}
.msg.user .bubble {
  /* Brandy over brass: the photographed metal warms the pour from beneath. */
  background:
    linear-gradient(180deg, rgba(232, 176, 92, 0.88), rgba(176, 110, 40, 0.91)),
    var(--brass) 40% 30% / 230% no-repeat, #b06e28;
  color: #241a02; border-color: rgba(90, 60, 5, 0.55);
  border-bottom-left-radius: 18px; border-bottom-right-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 220, 0.8),
    inset 0 -6px 10px rgba(120, 75, 5, 0.30),
    0 6px 14px rgba(0, 0, 0, 0.45),
    0 1.5px 3px rgba(0, 0, 0, 0.4);
}
.bubble.typing span {
  display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%;
  background: var(--gold-2); animation: pulse 1.1s ease-in-out infinite;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
.composer { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 26px; }
.composer textarea {
  flex: 1; resize: none; max-height: 120px; border-radius: 20px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55), 0 6px 16px rgba(0, 0, 0, 0.4);
}
.composer .send { border-radius: 18px; padding: 12px 18px; }

/* Conversations */
#conv-search { margin-top: 12px; }
.conv-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.conv {
  display: flex; gap: 8px; align-items: stretch;
  border-radius: var(--radius); border: 1px solid rgba(207, 154, 68, 0.2);
  background: var(--glass-roll), var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -6px 10px rgba(0, 0, 0, 0.3), 0 6px 14px rgba(0, 0, 0, 0.4);
  padding: 8px;
}
.conv.on { outline: 2px solid var(--gold-2); }
.conv-open { flex: 1; text-align: left; background: none; border: 0; cursor: pointer; display: grid; gap: 3px; padding: 6px 8px; font-family: var(--sans); min-width: 0; }
.conv-title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { font-size: 0.8rem; color: var(--ink-soft); }
.conv-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.conv-ren {
  border: 1px solid rgba(207, 154, 68, 0.3); background: transparent;
  color: var(--gold-2); border-radius: 999px; padding: 7px 12px; cursor: pointer; font: 600 0.8rem var(--sans);
}
.conv-del {
  align-self: center; border: 1px solid rgba(255, 140, 100, 0.35); background: transparent;
  color: #ff9a7a; border-radius: 999px; padding: 7px 12px; cursor: pointer; font: 600 0.8rem var(--sans);
}
.conv-del.confirm { background: #a02c1d; color: #fff; }
.conv-rename-input { flex: 1; min-width: 0; }
.empty { color: var(--ink-soft); text-align: center; padding: 22px 0; }

/* Settings */
.settings { display: grid; gap: 16px; }
.settings label.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.settings label.check input { width: auto; }
.settings-actions { display: grid; gap: 10px; margin-top: 18px; }
.saved { color: var(--gold-2); font-weight: 600; margin: 0; }

/* Reduced motion: the face rests as a still, views snap, nothing drifts. */
body.rm .face-sheen, body.rm .face-frame::after, body.rm .face-live .dot,
body.rm .bubble.typing span, body.rm .msg, body.rm .app-shine { animation: none !important; }
body.rm .app-shine { opacity: 0; }
body.rm .face-video { display: none; }
@media (prefers-reduced-motion: reduce) {
  .face-sheen, .face-frame::after, .face-live .dot, .msg, .app-shine { animation: none !important; }
  .app-shine { opacity: 0; }
  .face-video { display: none; }
  .view { transition: none; }
}

@media (max-width: 420px) {
  .face-frame.hero { width: min(272px, 78vw); }
  .stage-meta .who { font-size: 1.32rem; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}
