/* public-site/home.css — the marketing HOME page (/). Loads after site.css.
 *
 * Two halves:
 *   1. the page sections (hero, steps, product cards, FAQ, ...), in the
 *      marketing palette from site.css;
 *   2. `.sm` — the live "Example stream" Stream Manager demo. This is a cropped
 *      recreation of the REAL Pyre.Stream cockpit (public/stream/sec-stream.js
 *      render(), styled by public/stream/shell.css + sections.css), so inside
 *      `.sm` the APP's tokens apply, copied from shared/design-tokens.json
 *      (home-page.test.js pins every value), and class names mirror the app's
 *      (stat-chip, qa-tile, card-head, chat-msg, pdot, activity-row, sec-row).
 */

/* ════════ 1. Page ════════ */
.home-hero { padding: 48px 0 0; }
.home-hero-copy { display: flex; flex-direction: column; gap: 22px; }
.home-h1 {
  margin: 0; font-family: var(--site-serif); font-weight: 600;
  font-size: clamp(52px, 7vw, 104px); line-height: .95; letter-spacing: -.01em;
  max-width: 980px; text-wrap: balance;
}
.home-sub { margin: 0; font-size: 20px; color: var(--site-dim); max-width: 660px; }
.home-ctas { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.site .home-how-link { color: var(--site-text); font-weight: 600; min-height: 48px; display: inline-flex; align-items: center; padding: 0 4px; }
.home-price-line { margin: 0; font-size: 14px; color: var(--site-faint); max-width: 760px; }

.home-demo-wrap { max-width: 1320px; margin: 0 auto; padding: 44px var(--site-gutter) 0; }

.home-platforms { padding-top: 56px; }
.home-platform-row {
  display: flex; flex-wrap: wrap; gap: 14px 36px; align-items: center; justify-content: center;
  color: var(--site-faint); font-size: 14px; margin: 0; padding: 0; list-style: none;
}
.home-plat { display: inline-flex; align-items: center; gap: 8px; color: var(--site-text); font-weight: 700; font-size: 19px; }
.home-plat svg { width: 22px; height: 22px; flex: none; }
.home-plat--custom { font-weight: 600; font-size: 17px; }
.home-plat--custom svg { color: var(--site-accent-soft); }
.home-plat-sep { width: 1px; height: 24px; background: var(--site-line-strong); }
.home-platform-note { margin: 14px auto 0; text-align: center; color: var(--site-faint); font-size: 15px; max-width: 640px; }

.home-section { padding-top: 128px; }
.home-section--tight { padding-top: 96px; }

.home-steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px; }
.home-steps li { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--site-line-strong); padding-top: 18px; }
.home-step-n { font-family: var(--site-mono); font-size: 14px; color: var(--site-accent-soft); }
.home-h3 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.25; }
.home-steps p, .home-product p { margin: 0; color: var(--site-dim); }

.home-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px 32px; }
.home-product { display: flex; flex-direction: column; gap: 12px; }
.home-shot {
  margin: 0; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden;
  background: var(--site-surface); border: 1px solid var(--site-line);
}
.home-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.home-product .home-h3 { font-size: 24px; margin-top: 4px; }
.site .home-product-link { font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; align-self: flex-start; }

.home-switch {
  border: 1px solid var(--site-accent-line); border-radius: 12px; padding: 26px 28px;
  display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: center; justify-content: space-between;
}
.home-switch h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.site .home-switch a { font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }

.home-faq { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px 48px; }
.home-faq > div { display: flex; flex-direction: column; gap: 6px; }
.home-faq dt { font-weight: 700; font-size: 19px; }
.home-faq dd { margin: 0; color: var(--site-dim); }

.home-trust {
  margin: 0; padding: 18px 0; list-style: none; display: flex; flex-wrap: wrap; gap: 10px 36px;
  justify-content: center; border-block: 1px solid var(--site-line); font-weight: 600; font-size: 17px;
}
.home-trust li:nth-child(2) { color: var(--site-accent-soft); }

.home-who { display: flex; flex-wrap: wrap; gap: 28px 48px; align-items: center; }
.home-who-photo { flex: none; width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 1px solid var(--site-line); }
.home-who-text { flex: 1 1 420px; min-width: 0; max-width: 720px; display: flex; flex-direction: column; gap: 10px; }
.home-who-text h2 { margin: 0; font-family: var(--site-serif); font-weight: 600; font-size: 38px; line-height: 1.05; }
.home-who-text p { margin: 0; color: var(--site-dim); font-size: 18px; }
.home-who-links { display: flex; flex-wrap: wrap; gap: 6px 22px; font-weight: 600; align-items: center; }
.site .home-who-links a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }

.home-cta { padding: 144px 0 120px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; }
.home-cta h2 {
  margin: 0; font-family: var(--site-serif); font-weight: 600;
  font-size: clamp(48px, 6.5vw, 96px); line-height: .95; text-wrap: balance;
}
.home-cta p { margin: 0; color: var(--site-faint); font-size: 15px; }

@media (max-width: 560px) {
  .home-hero { padding-top: 28px; }
  .home-sub { font-size: 18px; }
  .home-section { padding-top: 88px; }
  .home-section--tight { padding-top: 64px; }
  .home-cta { padding: 96px 0 80px; }
  .home-switch { padding: 22px 20px; }
  .home-platform-row { gap: 12px 24px; }
  .home-plat-sep { flex-basis: 100%; width: auto; height: 0; background: none; }
}

/* ════════ 2. The demo: a cropped REAL Stream Manager ════════ */
.home-demo {
  margin: 0; border-radius: 14px; border: 1px solid var(--site-line);
  background: #141110; box-shadow: 0 50px 140px rgba(0, 0, 0, .65); overflow: hidden;
}
.sm-chrome {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 14px;
  border-bottom: 1px solid var(--site-line); font-size: 13px; color: var(--site-faint);
  background: #100d0c;
}
.sm-chrome img { width: 18px; height: 18px; }
.sm-chrome-title { color: var(--site-text); font-weight: 600; }
.sm-example { border: 1px solid var(--site-line-strong); border-radius: 99px; padding: 2px 10px; }
.sm-chrome-gap { flex: 1; }
.sm-pause {
  font: inherit; font-size: 13px; color: var(--site-text); background: transparent; cursor: pointer;
  border: 1px solid var(--site-line-strong); border-radius: 8px; padding: 0 14px; min-height: 44px; min-width: 44px;
}
.sm-pause:hover { border-color: var(--site-dim); }

.sm {
  /* shared/design-tokens.json → the app's :root (public/omni-ui.css). */
  --bg: #141110;
  --surface: #1c1817;
  --surface-inset: #191615;
  --surface-2: #2a2422;
  --border: rgba(255,255,255,.14);
  --border-accent: rgba(255,157,77,.45);
  --accent: #ff9d4d;
  --accent-soft: #ffb673;
  --accent-2: #ffc79a;
  --accent-wash: rgba(255,157,77,.14);
  --on-strong: #26140a;
  --text: #f7f3ef;
  --text-dim: #cec5bd;
  --text-faint: #9b918a;
  --ok: #45d0a8;
  --danger: #f0505f;
  --p-twitch: #9147ff;
  --p-youtube: #ff0000;
  --p-kick: #53fc18;
  --font-display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  --r-sm: 9px;
  --r: 12px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;

  background: var(--bg); color: var(--text);
  font-family: var(--font-display); font-size: 13px; line-height: 1.45;
  padding: var(--space-4);
  -webkit-user-select: none; user-select: none;
}
.sm .dim { color: var(--text-dim); }

/* (1) stat bar — sections.css .stat-bar / .stat-chip */
.sm .stat-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.sm .stat-chip {
  display: flex; flex-direction: column; gap: var(--space-1); min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: var(--space-2) var(--space-4);
}
.sm .stat-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); }
.sm .stat-value { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.sm .stat-chip.is-live { border-color: var(--border-accent); }
.sm .stat-chip.is-live .stat-value { color: var(--accent-soft); }

/* (3) quick actions — sections.css .qa-strip .qa-tile */
.sm .qa-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.sm .qa-tile {
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); min-width: 0;
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text);
}
.sm .qa-tile.is-live { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.sm .qa-tile.is-live .qa-icon { color: var(--danger); }
.sm .qa-icon { font-size: 14px; line-height: 1; }
.sm .qa-label { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* cockpit grid: designable cards LEFT, My chat RIGHT (sections.css .cockpit-grid) */
.sm .cockpit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-4); align-items: stretch; }
.sm .cockpit-rest { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--space-4); align-content: start; }
/* A cockpit layout a user can build in the app's layout editor: the preview on
   the left, Activity and Destination health stacked beside it. */
.sm .cockpit-preview { grid-column: 1; grid-row: 1 / span 2; }
.sm .cockpit-activity { grid-column: 2; grid-row: 1; }
.sm .cockpit-dest { grid-column: 2; grid-row: 2; }

/* shell.css .card / .card-head / .pill / .badge / .btn */
.sm .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--space-4); min-width: 0; }
.sm .card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 0 var(--space-3); border-bottom: 1px solid var(--border); margin-bottom: var(--space-3); }
.sm .card-title { margin: 0; font-size: 14px; font-weight: 600; }
.sm .pill { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.sm .badge { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; padding: 2px 7px; border-radius: var(--r-sm); background: var(--accent-wash); color: var(--accent-2); border: 1px solid var(--border-accent); }
.sm .btn { font-family: var(--font-display); font-weight: 600; font-size: 12px; line-height: 1.45; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-inset); color: var(--text); white-space: nowrap; }
.sm .btn--primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; color: var(--on-strong); box-shadow: 0 6px 18px -8px var(--accent); }
.sm .btn--ghost { background: transparent; }
.sm .tools { display: flex; gap: var(--space-2); align-items: center; }

/* (2) stream preview — sections.css .preview-stage (square, no radius) */
.sm .preview-stage {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9; width: 100%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(60% 70% at 40% 60%, #3a2c25, #120d0b); border: 1px solid var(--border);
}
.sm .preview-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* OWNER SLOT: shown until the real clip replaces it (see the comment in index.html). */
.sm .sm-poster {
  border: 1px dashed rgba(255,255,255,.4); border-radius: 8px; padding: 10px 14px;
  color: var(--text-dim); font-size: 14px; background: rgba(11,9,8,.55);
}

/* platform marks: sections.css .pdot is a 12px platform-coloured square; the
   demo draws the platform's real mark inside it. */
.sm .pdot { width: 14px; height: 14px; border-radius: 3px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: #fff; margin-top: 2px; }
.sm .pdot svg { width: 9px; height: 9px; display: block; }
.sm .pdot.twitch { background: var(--p-twitch); }
.sm .pdot.youtube { background: var(--p-youtube); }
.sm .pdot.kick { background: var(--p-kick); color: #0b0908; }

/* (4) activity — sections.css .activity-feed / .activity-row (newest on top) */
.sm .activity-feed { display: flex; flex-direction: column; gap: var(--space-1); height: 92px; overflow: hidden; }
.sm .activity-row { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-1) var(--space-2); border-radius: var(--r-sm); font-size: 13px; }
.sm .activity-body { flex: 1; min-width: 0; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm .activity-label { font-weight: 600; }
.sm .activity-actor { font-weight: 600; color: var(--accent-2); margin-left: 4px; }
.sm .activity-detail { margin-left: 4px; font-size: 12px; }
.sm .activity-time { flex: none; margin-left: var(--space-2); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 2px; }

/* (7) destination health — sections.css .sec-row / .sec-health, shell.css .dot */
.sm .sec-row { display: flex; align-items: center; gap: var(--space-3); padding: 8px var(--space-2); border-bottom: 1px solid var(--border); }
.sm .sec-row:last-child { border-bottom: 0; }
.sm .sec-row .grow { flex: 1; min-width: 0; }
.sm .sec-row .t { font-weight: 600; display: block; }
.sm .sec-row .s { color: var(--text-dim); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.sm .sec-health { display: inline-flex; align-items: center; gap: var(--space-1); flex: none; }
.sm .sec-health-label { font-size: 11px; color: var(--text-dim); letter-spacing: .03em; }
.sm .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-faint); }
.sm .dot--ok { background: var(--ok); box-shadow: 0 0 8px color-mix(in srgb, var(--ok) 60%, transparent); }

/* (5) My chat — sections.css .cockpit-chat / .chat-feed.mini / .chat-msg / .chat-composer.
   FIXED HEIGHT: the card takes the row height (contain: size), so arriving
   messages never move the page. */
.sm .cockpit-chat { display: flex; flex-direction: column; contain: size; min-height: 0; }
.sm .chat-feed { flex: 1 1 0; min-height: 0; overflow: hidden; -webkit-mask-image: linear-gradient(transparent, #000 28px); mask-image: linear-gradient(transparent, #000 28px); display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-1); }
.sm .chat-msg { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-1) var(--space-2); border-radius: var(--r-sm); line-height: 1.4; flex: none; }
.sm .chat-msg .msg-time { flex: none; color: var(--text-faint); font-size: .82em; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.sm .chat-msg .msg-body { min-width: 0; word-break: break-word; }
.sm .chat-msg .msg-author { font-weight: 700; }
.sm .chat-msg .msg-author::after { content: ':'; color: var(--text-dim); font-weight: 400; margin-left: 1px; }
.sm .chat-msg .msg-text { color: var(--text); }
.sm .chat-msg.is-event { border-left: 2px solid var(--accent); background: var(--accent-wash); }
.sm .chat-msg .msg-event { color: var(--accent-2); }
.sm .chat-composer { display: flex; gap: var(--space-2); padding-top: var(--space-3); margin-top: var(--space-2); border-top: 1px solid var(--border); align-items: center; }
.sm .sm-select, .sm .sm-input {
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-inset);
  padding: 7px 10px; font-size: 12px; white-space: nowrap;
}
.sm .sm-select { color: var(--text); flex: none; }
.sm .sm-input { flex: 1 1 auto; min-width: 0; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; }

/* arrival motion (paused / removed under reduced motion) */
@keyframes sm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sm .is-new { animation: sm-in .3s ease-out both; }

@media (max-width: 1100px) {
  .sm .cockpit-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .sm .cockpit-rest { grid-template-columns: minmax(0, 1fr); }
  .sm .cockpit-preview, .sm .cockpit-activity, .sm .cockpit-dest { grid-column: 1; grid-row: auto; }
}
@media (max-width: 860px) {
  .sm { padding: var(--space-3); }
  .sm .stat-bar, .sm .qa-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
  .sm .stat-chip { padding: var(--space-2) var(--space-3); }
  .sm .stat-value { font-size: 15px; }
  .sm .cockpit-grid { grid-template-columns: minmax(0, 1fr); }
  /* single column: chat sits right under the preview, like the app on narrow */
  .sm .cockpit-rest { display: contents; }
  .sm .cockpit-preview { order: 1; }
  .sm .cockpit-chat { order: 2; contain: none; height: 300px; }
  .sm .cockpit-activity { order: 3; }
  .sm .cockpit-dest { order: 4; }
  .sm .chat-head-extra { display: none; }
}
@media (max-width: 480px) {
  .sm .qa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm .stat-chip { padding: var(--space-2); }
  .sm .stat-value { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .sm .is-new { animation: none; }
}

/* ════════ 3. Phones: an app-first hero ════════
 * Owner 2026-10-25: a visitor on a phone gets a home page that leads with the
 * Pyre app for Android instead of the desktop Stream Manager.
 *
 * THE PHONE BREAKPOINT is the media query below, repeated VERBATIM from
 * home-demo-data.js PHONE_MQ (home-page.test.js pins the two copies): phones up
 * to 760px wide, plus phones held sideways (coarse pointer, short screen).
 * Layout is CSS only; home-demo.js uses the same query to run ONE demo, and its
 * iPhone/iPad hint only swaps the order and wording of the store buttons.
 *
 * Swapped parts carry .home-only-desk / .home-only-phone; the hidden one is
 * display:none, so assistive tech reads one headline, one set of buttons and
 * one demo. The phone demo (.ph) recreates the app's Camera tab while live in
 * the app's own tokens (shared/design-tokens.json) and mockup measurements:
 * every size is "mockup px" (a 390 x 844 frame) times --px, so the whole phone
 * scales as one picture and never reflows when its numbers change. */
.home-only-phone { display: none; }

@media (max-width: 760px), (pointer: coarse) and (max-width: 940px) and (max-height: 520px) {
  .home-only-desk { display: none !important; }
  .home-only-phone.home-h1-phone { display: inline; }
  .home-only-phone.home-sub-phone { display: block; }
  .home-only-phone.home-ctas-phone { display: flex; }
  .home-only-phone.home-phone { display: flex; }
  .home-only-phone.home-phone-more { display: block; }
  .home-h1 { font-size: clamp(40px, 11vw, 56px); line-height: 1; }
  /* The phone comes right after the buttons; the price line moves under it.
     (.home-hero-copy dissolves so its children and the phone share one column;
     the price line holds no links, so focus order is unchanged.) */
  .home-hero { display: flex; flex-direction: column; gap: 22px; }
  .home-hero-copy { display: contents; }
  .home-hero-copy > * { margin-inline: var(--site-gutter); }
  .home-phone { order: 1; }
  .home-price-line { order: 2; }
}

/* One measure for the phone hero column (owner 2026-10-25: on a foldable the
   buttons stopped at 420px while the paragraph ran to 660px). The paragraph and
   the buttons share it, left-aligned, so they line up at every phone width. */
.home-sub-phone { font-size: 18px; max-width: 34rem; }
.home-ctas-phone { flex-direction: column; align-items: stretch; gap: 12px; max-width: 34rem; }
.home-ctas-phone .site-btn { width: 100%; }
.home-play svg { flex: none; }
.home-soon { margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--site-dim); font-size: 15px; }
/* A note, not a link: no App Store link exists, so nothing here is tappable. */
.home-soon-badge {
  display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--site-line-strong); background: var(--site-surface);
  color: var(--site-text); font-size: 13.5px; font-weight: 600;
}

.home-phone { margin: 0; padding: 4px var(--site-gutter) 0; flex-direction: column; align-items: center; gap: 14px; }
.home-phone-tag { margin: 0; border: 1px solid var(--site-line-strong); border-radius: 99px; padding: 2px 12px; font-size: 13px; color: var(--site-faint); }
.home-phone-cap { display: flex; justify-content: center; }
.home-phone-dests { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.home-phone-dests-l { color: var(--site-faint); font-size: 14px; margin-right: 2px; }
.home-dest {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--site-line-strong); font-size: 14px; font-weight: 600; color: var(--site-text);
}
.home-dest::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.home-dest--twitch::before { background: var(--site-twitch); }
.home-dest--youtube::before { background: var(--site-youtube); }
.home-dest--kick::before { background: var(--site-kick); }

.home-phone-more { padding-top: 88px; }
.home-phone-more .site-h2 { margin-bottom: 28px; }
.home-phone-feats { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 26px; }
.home-phone-feats li { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--site-line-strong); padding-top: 16px; }
.home-phone-feats p { margin: 0; color: var(--site-dim); }

/* ── the phone: CameraScreen.tsx while live (mockup values × --px) ── */
.ph {
  --pw: min(330px, 84vw);
  --px: calc(var(--pw) / 390);
  /* shared/design-tokens.json (the app's palette) */
  --bg: #141110; --surface: #1c1817; --text: #f7f3ef; --text-dim: #cec5bd; --text-faint: #9b918a;
  --accent: #ff9d4d; --accent-soft: #ffb673; --accent-wash: rgba(255,157,77,.14); --on-strong: #26140a;
  --ok: #45d0a8; --danger: #f0505f; --warn: #ffd166;
  --p-twitch: #9147ff; --p-youtube: #ff0000; --p-kick: #53fc18;
  --line: rgba(255,255,255,.14); --line2: rgba(255,255,255,.24); --scrim: rgba(20,17,16,.72);
  --font-display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;

  position: relative; width: var(--pw); aspect-ratio: 390 / 844; flex: none;
  border: calc(7 * var(--px)) solid #050404; border-radius: calc(38 * var(--px));
  background: #000; overflow: hidden; contain: layout paint;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .65), 0 0 0 1px var(--site-line);
  color: var(--text); font-family: var(--font-display); font-size: calc(14 * var(--px)); line-height: 1.35;
  -webkit-user-select: none; user-select: none;
}
.ph > * { position: absolute; }
.ph svg { display: block; }
.ph-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ph-cam { inset: 0; background: radial-gradient(120% 90% at 70% 30%, #6b5a4b 0%, #3a2f28 35%, #1e1916 70%), #1e1916; }
.ph-cam::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(40% 55% at 38% 55%, rgba(240,200,160,.35), transparent 70%),
    linear-gradient(180deg, rgba(0,0,0,.35), transparent 30%, transparent 65%, rgba(0,0,0,.55));
}
.ph-status {
  top: 0; left: 0; right: 0; height: calc(26 * var(--px)); padding: calc(6 * var(--px)) calc(20 * var(--px));
  display: flex; justify-content: space-between; font: calc(11 * var(--px)) / 1.3 var(--font-mono); color: var(--text-dim);
}
/* the live row: LIVE · elapsed · viewers ......... signal */
.ph-livebar { left: calc(12 * var(--px)); right: calc(12 * var(--px)); top: calc(34 * var(--px)); display: flex; align-items: center; gap: calc(6 * var(--px)); }
.ph-lp {
  display: inline-flex; align-items: center; gap: calc(5 * var(--px)); white-space: nowrap;
  padding: calc(5 * var(--px)) calc(9 * var(--px)); border-radius: 999px;
  background: var(--scrim); border: 1px solid var(--line); font-size: calc(11.5 * var(--px));
}
.ph-lp--live { background: var(--danger); border-color: transparent; color: #fff; font-weight: 700; letter-spacing: .04em; }
.ph-sig { margin-left: auto; }
.ph-bars { display: inline-flex; align-items: flex-end; gap: calc(2 * var(--px)); height: calc(10 * var(--px)); }
.ph-bars i { width: calc(3 * var(--px)); border-radius: 1px; background: var(--ok); }
.ph-bars i:nth-child(1) { height: 40%; }
.ph-bars i:nth-child(2) { height: 70%; }
.ph-bars i:nth-child(3) { height: 90%; }
.ph-bars i:nth-child(4) { height: 100%; }
/* mic meter, right edge while live */
.ph-mic {
  right: calc(10 * var(--px)); top: calc(300 * var(--px)); width: calc(6 * var(--px)); height: calc(90 * var(--px));
  border-radius: calc(3 * var(--px)); background: var(--scrim); border: 1px solid var(--line); overflow: hidden;
}
.ph-mic i {
  display: block; width: 100%; height: 100%; transform-origin: 50% 100%; transform: scaleY(.46);
  background: linear-gradient(0deg, var(--ok) 0 70%, var(--warn) 70%); transition: transform .45s ease-out;
}
/* the Preview mini player (TestPlayer.tsx, "What viewers see"), snapped top-right */
.ph-pv { right: calc(12 * var(--px)); top: calc(78 * var(--px)); display: flex; flex-direction: column; align-items: flex-end; gap: calc(4 * var(--px)); }
.ph-frame {
  position: relative; width: calc(164 * var(--px)); height: calc(92 * var(--px)); border-radius: calc(10 * var(--px));
  overflow: hidden; border: 1px solid var(--line2); background: #000; box-shadow: 0 calc(10 * var(--px)) calc(26 * var(--px)) rgba(0,0,0,.6);
}
.ph-prog { position: absolute; inset: 0; background: radial-gradient(120% 90% at 65% 35%, #6b5a4b 0%, #3a2f28 38%, #1e1916 72%); }
.ph-prog::after { content: ''; position: absolute; inset: 0; background: radial-gradient(38% 60% at 40% 58%, rgba(240,200,160,.32), transparent 70%); }
.ph-alert {
  position: absolute; z-index: 1; left: 50%; top: 34%; transform: translateX(-50%); white-space: nowrap;
  background: var(--accent); color: var(--on-strong); font-weight: 700; font-size: calc(7 * var(--px));
  padding: calc(2 * var(--px)) calc(5 * var(--px)); border-radius: calc(7 * var(--px)); box-shadow: 0 0 calc(12 * var(--px)) rgba(255,157,77,.5);
  animation: ph-alert 7s ease-in-out infinite;
}
@keyframes ph-alert {
  0%, 12% { opacity: 0; transform: translateX(-50%) scale(.85); }
  18%, 62% { opacity: 1; transform: translateX(-50%) scale(1); }
  70%, 100% { opacity: 0; transform: translateX(-50%) scale(1); }
}
.ph-brand {
  position: absolute; z-index: 1; right: 4%; top: 36%; font: calc(5.5 * var(--px)) / 1.3 var(--font-mono);
  padding: calc(1 * var(--px)) calc(3 * var(--px)); border-radius: calc(5 * var(--px)); background: rgba(14,12,11,.7); color: var(--text-dim);
}
.ph-cbox {
  position: absolute; z-index: 1; left: 4%; bottom: 7%; width: 44%; display: flex; flex-direction: column; gap: 1px;
  font-size: calc(5.6 * var(--px)); padding: calc(3 * var(--px)) calc(4 * var(--px)); border-radius: calc(6 * var(--px)); background: rgba(14,12,11,.7);
}
.ph-c1 { color: #b38bff; }
.ph-c2 { color: #53fc18; }
.ph-c3 { color: #ff6b6b; }
.ph-lab {
  position: absolute; z-index: 2; left: calc(6 * var(--px)); top: calc(6 * var(--px)); max-width: 62%;
  font-size: calc(10 * var(--px)); font-weight: 600; padding: calc(2 * var(--px)) calc(6 * var(--px)); border-radius: calc(6 * var(--px));
  background: var(--scrim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ph-btn {
  position: absolute; z-index: 2; width: calc(26 * var(--px)); height: calc(26 * var(--px)); border-radius: 50%;
  background: var(--scrim); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text);
}
.ph-btn svg { width: calc(13 * var(--px)); height: calc(13 * var(--px)); }
.ph-btn--close { right: calc(6 * var(--px)); top: calc(6 * var(--px)); }
.ph-btn--exp { right: calc(36 * var(--px)); top: calc(6 * var(--px)); }
.ph-btn--mute { right: calc(6 * var(--px)); bottom: calc(6 * var(--px)); }
.ph-hint { font-size: calc(10 * var(--px)); color: var(--text-dim); background: var(--scrim); border-radius: calc(6 * var(--px)); padding: calc(1 * var(--px)) calc(6 * var(--px)); }
/* chat on camera (public/stream/chat-overlay.css): newest at the bottom, bottom-left.
   Fixed box, so arriving lines never move anything. */
.ph-chat {
  left: calc(12 * var(--px)); right: calc(12 * var(--px)); bottom: calc(196 * var(--px)); height: calc(150 * var(--px));
  overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: calc(4 * var(--px));
  font-size: calc(12 * var(--px)); line-height: 1.35;
  -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%);
}
.ph .co-line { flex: none; max-width: 100%; padding: calc(4 * var(--px)) calc(8 * var(--px)); border-radius: calc(6 * var(--px)); background: rgba(14,12,11,.62); overflow-wrap: anywhere; }
.ph .co-dot { display: inline-block; width: calc(7 * var(--px)); height: calc(7 * var(--px)); margin-right: calc(5 * var(--px)); border-radius: 50%; vertical-align: 1px; background: var(--text-faint); }
.ph .co-dot--twitch { background: var(--p-twitch); }
.ph .co-dot--youtube { background: var(--p-youtube); }
.ph .co-dot--kick { background: var(--p-kick); }
.ph .co-name { font-weight: 700; margin-right: calc(4 * var(--px)); }
.ph .co-line.is-new { animation: sm-in .3s ease-out both; }
/* the dock: scene pill above; mute · flip · pause · chat · Preview ...... End */
.ph-dock { left: calc(12 * var(--px)); right: calc(12 * var(--px)); bottom: calc(76 * var(--px)); display: flex; flex-direction: column; gap: calc(10 * var(--px)); }
.ph-scene {
  align-self: flex-start; display: inline-flex; align-items: center; gap: calc(6 * var(--px)); white-space: nowrap;
  padding: calc(7 * var(--px)) calc(11 * var(--px)); border-radius: 999px; background: var(--scrim); border: 1px solid var(--line); font-size: calc(12 * var(--px));
}
.ph-ctrls { display: flex; align-items: center; gap: calc(6 * var(--px)); }
.ph-ic {
  flex: none; width: calc(38 * var(--px)); height: calc(38 * var(--px)); border-radius: 50%;
  background: var(--scrim); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text);
}
.ph-ic svg { width: calc(18 * var(--px)); height: calc(18 * var(--px)); }
.ph-ic--on, .ph-prev { background: var(--accent-wash); border-color: rgba(255,157,77,.6); color: var(--accent-soft); }
.ph-prev {
  width: auto; display: inline-flex; gap: calc(6 * var(--px)); padding: 0 calc(10 * var(--px)); border-radius: 999px;
  font-size: calc(12.5 * var(--px)); font-weight: 600;
}
.ph-end {
  margin-left: auto; white-space: nowrap; padding: calc(10 * var(--px)) calc(14 * var(--px)); border-radius: 999px;
  background: rgba(240,80,95,.16); border: 1px solid rgba(240,80,95,.6); color: #ffb3ba; font-weight: 600;
}
.ph-tabs {
  left: 0; right: 0; bottom: 0; height: calc(64 * var(--px)); display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
}
.ph-tabs span { display: flex; align-items: center; justify-content: center; font-size: calc(11.5 * var(--px)); color: var(--text-faint); }
.ph-tabs .is-on { color: var(--accent-soft); }

/* Paused demo (the Pause button, or reduced motion before Play): the CSS loop holds still too. */
.ph.is-paused .ph-alert { animation: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .ph-alert { animation: none; opacity: 1; }
  .ph-mic i { transition: none; }
  .ph .co-line.is-new { animation: none; }
}
