/* SmileBot flight – theme and copy layouts over the scrollcraft engine (engine untouched).
   Colours and type from the SmileBot brand kit (2026-11-06): Navy Ink ground, SmileBot orange for the
   AI and the main action, Be Vietnam Pro for text, Lexend for display. */

/* ───────── Tokens ───────── */
:root {
  --sc-canvas: #1A1A2E;  --sc-surface: #23233B;
  --sc-ink: #EEE7DF;     --sc-ink-soft: #A39E98;
  /* buttons use the kit's deeper Action Orange: white text on the dark-ground step (#E2601C) is only
     3.6:1, under the 4.5:1 a 15px label needs */
  --sc-accent: #CC4410;  --sc-accent-ink: #FFFFFF;
  --accent-hover: #A8380C;
  /* small orange text on Navy Ink: SmileBot orange clears 5.7:1 here */
  --accent-text: #FF6B35;
  --sc-shadow-color: 240 28% 6%;
  --sc-font-display: 'Lexend', 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  --sc-font-text: 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
  --bar-h: 64px;
  color-scheme: dark;
}

html { background: var(--sc-canvas); }
/* Lenis owns the wheel; native smooth-scroll on top of it would fight it */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0;
  background: var(--sc-canvas);
  color: var(--sc-ink);
  font-family: var(--sc-font-text);
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--sc-accent); color: var(--sc-accent-ink); text-decoration: none;
  transform: translateY(-160%); transition: transform 180ms var(--sc-ease-out);
}
.skip-link:focus { transform: none; }

/* the world canvas fills the one fixed stage */
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.no-webgl #world { display: none; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 24px; border-radius: 999px;
  background: var(--sc-accent); color: var(--sc-accent-ink);
  font-weight: 600; font-size: 15px; white-space: nowrap; text-decoration: none;
  box-shadow: 0 10px 24px -12px hsl(18 85% 42% / 0.75), inset 0 1px 0 hsl(0 0% 100% / 0.18);
  transition: background-color 160ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
.btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--accent-hover); } }
.btn--sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn--lg { height: 56px; padding: 0 32px; font-size: 16px; }

/* ───────── Bar + route map ───────── */
.bar {
  position: fixed; inset: 0 0 auto; z-index: var(--sc-z-chrome);
  height: var(--bar-h);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  padding: 0 var(--sc-gutter);
  background: linear-gradient(to bottom, color-mix(in oklab, var(--sc-canvas) 88%, transparent), transparent);
}
.bar__logo { display: inline-flex; align-items: center; color: var(--sc-ink); text-decoration: none; padding: 6px 0; }
/* the full logo at 134px (the kit asks for 120px or more), the bare symbol on phones */
.bar__wordmark { width: 134px; height: auto; }
.bar__symbol { display: none; width: 32px; height: 32px; }
.bar__tools { display: flex; align-items: center; gap: 8px; }
.tool {
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--sc-hairline-strong); color: var(--sc-ink-soft); font-size: 13px; font-weight: 600;
  transition: color 160ms var(--sc-ease-out), border-color 160ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .tool:hover { color: var(--sc-ink); border-color: var(--accent-text); } }
/* the inactive language stays readable (ink-soft, 6.7:1); the active one is orange */
.tool [data-lang] { color: var(--sc-ink-soft); }
:root:not([lang="en"]) .tool [data-lang="vi"],
:root[lang="en"] .tool [data-lang="en"] { color: var(--accent-text); }

/* press feedback on everything pressable in the bar; hover stays gated to real pointers */
.tool, .route__legs button {
  transition: color 160ms var(--sc-ease-out), border-color 160ms var(--sc-ease-out),
              background-color 160ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
.tool:active, .route__legs button:active { transform: scale(0.96); }
.btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.mail { transition: color 160ms var(--sc-ease-out); }
@media (hover: hover) and (pointer: fine) { .mail:hover { color: var(--sc-ink); } }
@media (pointer: coarse) {
  .tool { height: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool svg { transition: opacity 200ms ease; @starting-style { opacity: 0; transform: none; } }
}

.route { position: relative; justify-self: center; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.route__legs { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.route__legs button {
  padding: 6px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--sc-ink-soft);
  transition: color 160ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .route__legs button:hover { color: var(--sc-ink); } }
.route__legs button[aria-current] { color: var(--sc-ink); background: color-mix(in oklab, var(--sc-ink) 9%, transparent); }
.route__here { display: none; font-size: 13px; font-weight: 600; color: var(--sc-ink); }
.route__track { position: relative; height: 1px; background: var(--sc-hairline); overflow: hidden; }
.route__fill { position: absolute; inset: 0; background: var(--accent-text); transform-origin: 0 50%; transform: scaleX(0); }

/* ───────── Scrims (siblings of the copy, never children) ───────── */
.scrim {
  background:
    radial-gradient(60% 55% at 0% 100%, color-mix(in oklab, var(--sc-canvas) 80%, transparent), transparent 70%),
    radial-gradient(60% 55% at 100% 100%, color-mix(in oklab, var(--sc-canvas) 80%, transparent), transparent 70%),
    linear-gradient(to top, color-mix(in oklab, var(--sc-canvas) 62%, transparent), transparent 42%);
}
.col-scrim { position: absolute; inset: 0; pointer-events: none; }
.col-scrim--lead  { background: linear-gradient(to right, color-mix(in oklab, var(--sc-canvas) 86%, transparent) 0%, color-mix(in oklab, var(--sc-canvas) 60%, transparent) 34%, transparent 52%); }
.col-scrim--trail { background: linear-gradient(to left,  color-mix(in oklab, var(--sc-canvas) 86%, transparent) 0%, color-mix(in oklab, var(--sc-canvas) 60%, transparent) 34%, transparent 52%); }
.col-scrim--centre { background: radial-gradient(52% 40% at 50% 50%, color-mix(in oklab, var(--sc-canvas) 74%, transparent), transparent 100%); }

/* ───────── Copy blocks ───────── */
.cp { position: absolute; z-index: 1; max-width: min(34rem, 40vw); }
.cp--lead  { left: var(--sc-gutter); bottom: clamp(3rem, 11vh, 8rem); }
.cp--trail { right: var(--sc-gutter); bottom: clamp(3rem, 11vh, 8rem); }

.cp--hero {
  left: 50%; translate: -50% 0; bottom: clamp(3rem, 9vh, 7rem);
  /* an absolutely placed block at left:50% only gets half the frame to wrap in: give it its width */
  width: min(66rem, 92vw); max-width: none; text-align: center;
}
.hero__title {
  margin: 0 0 18px;
  font-family: var(--sc-font-display); font-weight: 700;
  /* Lexend runs wide: at this size each sentence holds one line on a laptop (two lines in all) */
  font-size: clamp(2.3rem, 1.2rem + 2.6vw, 3.8rem); line-height: 1.08; letter-spacing: -0.03em;
}
.ht { display: block; text-wrap: balance; }
.ht--accent { color: var(--accent-text); }
.hero__lead { margin: 0 auto 28px; max-width: 42ch; font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.2rem); line-height: 1.6; color: var(--sc-ink-soft); text-wrap: balance; }

.cp--quote {
  left: 50%; top: 50%; translate: -50% -50%; margin: 0;
  width: min(54rem, 88vw); max-width: none; text-align: center;
}
.cp--quote blockquote { margin: 0; }
.cp--quote p {
  margin: 0; font-family: var(--sc-font-display); font-weight: 700;
  font-size: clamp(1.8rem, 1.1rem + 2.2vw, 3.1rem); line-height: 1.14; letter-spacing: -0.02em; text-wrap: balance;
}
.cp--quote p::before { content: '“'; color: var(--accent-text); }
.cp--quote p::after  { content: '”'; color: var(--accent-text); }
.cp--quote figcaption { margin-top: 22px; font-size: 15px; line-height: 1.6; color: var(--sc-ink-soft); }

/* the section term opens its own heading ("Tầm nhìn. Một hạ tầng tri thức…") rather than sitting
   above it as a separate label */
.claim__lead { color: var(--accent-text); }
.claim__lead::after { content: "."; }
.spec__title { margin: 0 0 6px; font-family: var(--sc-font-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; }
.claim {
  margin: 0 0 16px; font-family: var(--sc-font-display); font-weight: 700;
  font-size: clamp(1.55rem, 1.1rem + 1.4vw, 2.5rem); line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance;
}
.claim--xl { font-size: clamp(1.9rem, 1.2rem + 2.2vw, 3.3rem); line-height: 1.06; margin-bottom: 20px; }
.body { margin: 0; max-width: 58ch; font-size: clamp(0.98rem, 0.94rem + 0.2vw, 1.075rem); line-height: 1.68; color: var(--sc-ink-soft); text-wrap: pretty; }

.principles { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin: 26px 0 0; }
.principles dt { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.principles dd { margin: 0; font-size: 14px; line-height: 1.6; color: var(--sc-ink-soft); }
.cp--principles { max-width: min(44rem, 52vw); }

.channels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; margin: 26px 0 0; }
.channels div { border-top: 1px solid var(--sc-hairline-strong); padding-top: 10px; }
.channels dt { font-size: 13px; font-weight: 600; color: var(--accent-text); margin-bottom: 4px; }
.channels dd { margin: 0; font-size: 15px; font-weight: 500; }

.cp--arch { max-width: min(40rem, 46vw); }
.cp--flow { left: var(--sc-gutter); right: var(--sc-gutter); bottom: clamp(2.5rem, 8vh, 6rem); max-width: none; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; list-style: none; margin: 0; padding: 0; }
.flow li { border-top: 1px solid var(--sc-hairline-strong); padding-top: 16px; }
.flow b { display: block; font-family: var(--sc-font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.02em; }
.flow .layer { display: block; margin: 2px 0 10px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.flow .fn { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: var(--sc-ink-soft); }
.flow .io { margin: 0; font-size: 13px; line-height: 1.6; color: var(--sc-ink); }
.flow .io__k { color: var(--sc-ink-soft); margin-right: 4px; }
.loop { margin: 24px 0 0; max-width: 78ch; font-size: 14px; line-height: 1.6; color: var(--sc-ink-soft); }
.loop b { color: var(--sc-ink); font-weight: 600; }

/* products: the brief on one side, the real screen on the side where the station glows */
.cp--product {
  left: var(--sc-gutter); right: var(--sc-gutter); top: 50%; translate: 0 -44%;
  max-width: none;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 4vw, 72px); align-items: center;
}
.cp--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.cp--flip .brief { order: 2; }
.pname { margin: 0; font-family: var(--sc-font-display); font-weight: 700; font-size: clamp(3rem, 2rem + 3vw, 5.2rem); line-height: 0.95; letter-spacing: -0.035em; }
.pkind { margin: 6px 0 18px; font-size: 15px; font-weight: 600; color: var(--accent-text); }
.points { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--sc-hairline-strong); }
.points li { padding: 10px 0; border-bottom: 1px solid var(--sc-hairline); font-size: 15px; font-weight: 500; }
.has-world .cp--product .screen { visibility: hidden; }
.screen img {
  width: 100%; height: auto; border-radius: 14px;
  border: 1px solid var(--sc-hairline-strong);
  box-shadow: 0 2px 4px hsl(var(--sc-shadow-color) / 0.25), 0 30px 60px -24px hsl(var(--sc-shadow-color) / 0.7);
}

.steps { list-style: none; counter-reset: step; margin: 22px 0 0; padding: 0; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; column-gap: 14px; padding: 12px 0; border-top: 1px solid var(--sc-hairline); }
.steps li::before {
  content: counter(step); grid-row: span 2;
  width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--accent-text); color: var(--accent-text); font-size: 13px; font-weight: 600;
}
.steps b { font-weight: 600; }
.steps span { font-size: 14px; line-height: 1.55; color: var(--sc-ink-soft); }

.cp--spec { max-width: min(26rem, 36vw); }
.cp--spec dl { margin: 0; }
.cp--spec dl div { padding: 12px 0; border-top: 1px solid var(--sc-hairline); }
.cp--spec dt { font-size: 13px; color: var(--sc-ink-soft); margin-bottom: 3px; }
.cp--spec dd { margin: 0; font-size: 15px; font-weight: 600; }

/* the finale sits just above the footer */
:root { --foot-h: 122px; }
.cp--finale {
  left: 50%; translate: -50% 0; bottom: calc(var(--foot-h) + clamp(1.5rem, 5vh, 3.5rem));
  width: min(50rem, 90vw); max-width: none; text-align: center;
}
.finale__act { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 28px; margin: 8px 0 0; }
.mail { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.fine { margin: 0; font-size: 13px; color: var(--sc-ink-soft); }

/* footer: brand, office, support along the bottom edge of the last frame */
.cp--footer {
  left: 0; right: 0; bottom: 0; max-width: none; min-height: var(--foot-h);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px clamp(28px, 5vw, 72px);
  padding: 18px var(--sc-gutter) max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--sc-hairline-strong);
  background: linear-gradient(to top, color-mix(in oklab, var(--sc-canvas) 96%, transparent), color-mix(in oklab, var(--sc-canvas) 78%, transparent));
}
.foot__brand { display: grid; gap: 6px; }
.foot__brand img { width: 112px; height: auto; }
.foot__col { display: grid; gap: 3px; font-style: normal; min-width: 0; }
.cp--footer address.foot__col { justify-self: center; }
.foot__k { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--sc-ink-soft); }
.foot__v { font-size: 14.5px; font-weight: 500; color: var(--sc-ink); text-decoration: none; text-wrap: balance; }
.foot__v:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .foot__v:hover { color: var(--accent-text); } }
.foot__note { grid-column: 1 / -1; font-size: 12px; }

/* ───────── Short desktop screens (laptops at 720-860 px tall): the product brief must fit between the
   bar and the bottom edge, so the type steps down and the description keeps to four lines ───────── */
@media (min-width: 861px) and (max-height: 860px) {
  .cp--product { translate: 0 -46%; }
  .pname { font-size: clamp(2.4rem, 1.6rem + 2.4vw, 3.6rem); }
  .pkind { margin: 4px 0 10px; }
  .cp--product .claim { font-size: clamp(1.25rem, 1rem + 0.9vw, 1.6rem); }
  .cp--product .body {
    font-size: 15px; line-height: 1.55;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
  }
  .points { margin-top: 12px; }
  .points li { padding: 7px 0; font-size: 14px; }
}

/* ───────── Narrow: the rail collapses to "where am I" + the progress line ───────── */
@media (max-width: 1180px) {
  .route__legs { display: none; }
  .route__here { display: block; text-align: center; }
  .route { width: min(220px, 40vw); }
}

/* ───────── Phones: the world on top, the copy anchored to the bottom over a band ───────── */
@media (max-width: 860px) {
  :root { --bar-h: 56px; }
  .bar { gap: 12px; }
  .bar__wordmark { display: none !important; }
  .bar__symbol { display: block; }
  .bar__tools .btn--sm { display: none; }
  .route { width: auto; justify-self: stretch; }

  .scrim {
    background: linear-gradient(to top,
      color-mix(in oklab, var(--sc-canvas) 94%, transparent) 0%,
      color-mix(in oklab, var(--sc-canvas) 82%, transparent) 30%,
      color-mix(in oklab, var(--sc-canvas) 40%, transparent) 52%,
      transparent 66%);
  }
  .col-scrim--lead, .col-scrim--trail { background: none; }

  .cp, .cp--lead, .cp--trail, .cp--arch, .cp--principles, .cp--spec {
    left: var(--sc-gutter); right: var(--sc-gutter); bottom: max(1.5rem, 3svh); max-width: none;
  }
  /* the centred blocks keep their own centring (the rule above resets left/right for every block) */
  .cp--hero, .cp--quote, .cp--finale { left: 50%; right: auto; width: calc(100% - 2 * var(--sc-gutter)); }
  .cp--hero { bottom: max(2rem, 5svh); }
  .cp--quote { bottom: auto; }
  .hero__title { font-size: clamp(2.05rem, 9.4vw, 2.8rem); line-height: 1.08; }
  .cp--quote p { font-size: clamp(1.45rem, 6.4vw, 1.9rem); }
  .claim { font-size: clamp(1.35rem, 5.8vw, 1.7rem); }
  .claim--xl { font-size: clamp(1.6rem, 7vw, 2.1rem); }
  .body { font-size: 15px; line-height: 1.6; }
  .principles { grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-top: 16px; }
  .principles dt { font-size: 13.5px; }
  .principles dd { font-size: 12.5px; line-height: 1.5; }
  .channels { margin-top: 16px; gap: 10px 18px; }
  .flow { grid-template-columns: 1fr 1fr; gap: 14px 18px; }
  .flow li { padding-top: 10px; }
  /* the four layers read as names and roles; their inputs and outputs are desktop detail, and the
     closed loop keeps to three lines, so the block leaves the branching scene above it in view */
  .flow .fn, .flow .io { display: none; }
  .flow b { font-size: 1.25rem; }
  .flow .layer { margin-bottom: 0; }
  .loop {
    font-size: 13px; margin-top: 14px;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  }
  .cp--spec dl div { padding: 7px 0; }
  .cp--spec dt { font-size: 12px; margin-bottom: 1px; }
  .cp--spec dd { font-size: 14px; }

  .cp--product, .cp--flip {
    top: auto; bottom: max(1.25rem, 2.5svh); translate: none;
    grid-template-columns: 1fr; gap: 14px;
  }
  .cp--flip .brief { order: 0; }
  .screen { order: -1; }
  /* with the 3D world the product screen is shown in the world: the hidden fallback must not keep
     its 22svh of layout and push the copy up over it */
  .has-world .cp--product .screen { display: none; }
  .screen img { height: 22svh; object-fit: cover; object-position: top left; }
  .pname { font-size: 2.3rem; }
  .pkind { margin-bottom: 8px; }
  /* the product screen is the subject: the long description keeps to three lines under it */
  .cp--product .body {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  }
  .points { margin-top: 12px; }
  .points li { padding: 7px 0; font-size: 14px; }

  .steps li { padding: 7px 0; }
  .steps span { font-size: 13px; line-height: 1.45; }

  /* the footer stacks; the finale keeps clear of it (the rule above resets every block's bottom) */
  :root { --foot-h: 206px; }
  .cp--finale { bottom: calc(var(--foot-h) + 1.25rem); }
  /* the footer right under it already carries the support address */
  .cp--finale .mail { display: none; }
  .cp--footer > .foot__col:not(address) { display: flex; align-items: baseline; gap: 10px; }
  .cp--footer {
    left: 0; right: 0; bottom: 0;
    grid-template-columns: 1fr; gap: 10px; padding: 14px var(--sc-gutter) max(14px, env(safe-area-inset-bottom));
  }
  .foot__brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .foot__brand img { width: 96px; }
  .cp--footer address.foot__col { justify-self: stretch; }
  .foot__v { font-size: 14px; }
}

/* ───────── Mira: chat card, click target, menu ─────────
   The page knows where she is on screen (--mx, --my, --mr from the world) and keeps these on her. */
.mira-ui { position: fixed; inset: 0; z-index: calc(var(--sc-z-chrome) - 1); pointer-events: none; }
.mira-ui.is-away .mira-card, .mira-ui.is-away .mira-hit { visibility: hidden; }
/* everything that follows her moves by translate, never left/top: it changes every frame, and a
   translate is composited without re-running layout */
.mira-hit {
  position: fixed; pointer-events: auto; cursor: pointer;
  left: 0; top: 0; translate: calc(var(--mx, -999px) - var(--mr, 0px)) calc(var(--my, -999px) - var(--mr, 0px));
  width: calc(var(--mr, 0px) * 2); height: calc(var(--mr, 0px) * 2);
  border-radius: 50%; background: transparent;
}
.mira-hit:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }

.mira-card {
  position: fixed; left: 0; top: 0; translate: -999px -999px; margin: 0;
  width: max-content; max-width: min(320px, 78vw);
  padding: 12px 14px 14px;
  color: var(--sc-ink);
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--sc-accent) 9%, transparent), transparent 46px),
    color-mix(in oklab, var(--sc-surface) 96%, transparent);
  border: 1px solid var(--sc-hairline-strong);
  border-radius: 18px;
  box-shadow: var(--sc-edge), 0 2px 6px hsl(var(--sc-shadow-color) / 0.25), 0 22px 48px -18px hsl(var(--sc-shadow-color) / 0.7);
}
/* the tail, pointing down at her (hidden when the card opens beside her) */
.mira-card::after {
  content: ''; position: absolute; left: calc(var(--tail, 30px) - 7px); bottom: -7px;
  width: 14px; height: 14px; rotate: 45deg;
  background: var(--sc-surface);
  border-right: 1px solid var(--sc-hairline-strong); border-bottom: 1px solid var(--sc-hairline-strong);
}
.mira-card.is-beside::after { display: none; }
.mira-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mira-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #FFF8F0; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--sc-accent) 30%, transparent);
}
.mira-avatar img { width: 28px; height: 28px; }
.mira-who { display: grid; line-height: 1.2; }
.mira-who b { font-family: var(--sc-font-display); font-weight: 600; font-size: 15px; }
.mira-who span { font-size: 12px; color: var(--sc-ink-soft); }
.mira-online { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; margin-left: auto; box-shadow: 0 0 0 3px color-mix(in oklab, #4ADE80 22%, transparent); }
.mira-msg { margin: 0; font-size: 14.5px; line-height: 1.55; text-wrap: pretty; }
/* typing: three dots before the line */
.mira-typing { display: none; gap: 4px; padding: 4px 0; }
.mira-bubble.is-typing .mira-typing { display: inline-flex; }
.mira-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--sc-ink-soft); animation: miraDot 1s var(--sc-ease-in-out) infinite; }
.mira-typing i:nth-child(2) { animation-delay: 0.15s; }
.mira-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes miraDot { 0%, 60%, 100% { opacity: 0.35; translate: 0 0; } 30% { opacity: 1; translate: 0 -3px; } }

.mira-bubble {
  max-width: min(300px, 74vw);
  opacity: 0; scale: 0.96; transform-origin: var(--tail, 30px) 100%;
  transition: opacity 220ms var(--sc-ease-out), scale 220ms var(--sc-ease-out);
}
.mira-ui.is-talking:not(.is-open) .mira-bubble { opacity: 1; scale: 1; }
.mira-menu { pointer-events: auto; width: 300px; max-width: min(300px, 86vw); }
.mira-menu[hidden] { display: none; }
.mira-close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--sc-ink-soft);
  transition: background-color 140ms var(--sc-ease-out), color 140ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .mira-close:hover { background: color-mix(in oklab, var(--sc-ink) 9%, transparent); color: var(--sc-ink); } }
.mira-menu .mira-msg {
  display: inline-block; padding: 9px 12px; margin-bottom: 12px;
  background: color-mix(in oklab, var(--sc-ink) 7%, transparent); border-radius: 4px 14px 14px 14px;
}
.mira-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mira-chips button {
  padding: 7px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  border: 1px solid color-mix(in oklab, var(--accent-text) 45%, transparent); color: var(--accent-text);
  transition: background-color 140ms var(--sc-ease-out), color 140ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .mira-chips button:hover { background: color-mix(in oklab, var(--accent-text) 14%, transparent); } }
.mira-chips button:active, .mira-cta:active, .mira-close:active { transform: scale(0.96); }
.mira-cta {
  width: 100%; height: 42px; border-radius: 999px; font-weight: 600; font-size: 14px;
  background: var(--sc-accent); color: var(--sc-accent-ink);
  transition: background-color 140ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .mira-cta:hover { background: var(--accent-hover); } }
.mira-card button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
@media (max-width: 860px) { .mira-msg { font-size: 13.5px; } }
/* on a phone her speech is a small bubble pointing at her, not a card that covers the scene: the
   tail already says who is talking, so the name row goes */
@media (max-width: 720px) {
  .mira-bubble { max-width: min(240px, 64vw); padding: 9px 12px 10px; border-radius: 16px; }
  .mira-bubble .mira-card__head { display: none; }
  .mira-bubble .mira-msg { font-size: 13px; line-height: 1.45; }
}
@media (pointer: coarse) { .mira-chips button { min-height: 40px; } .mira-cta { height: 46px; } }
@media (prefers-reduced-motion: reduce) {
  .mira-bubble { scale: 1; transition: opacity 200ms ease; }
  .mira-typing i { animation: none; opacity: 0.7; }
}
