:root {
  --hdr: 64px;
  --foot: 82px;
  --page-gutter: clamp(16px, 3.2vw, 56px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html,body { width:100%; height:100%; margin:0; overflow:hidden; background:var(--bg); }
body { height:100dvh; isolation:isolate; font:450 16px/1.6 var(--font-ui); color:var(--ink); }
button,input,select,textarea { font:inherit; }
button,select { cursor:pointer; }
button:disabled { cursor:default; }
:focus-visible { outline:3px solid var(--focus); outline-offset:3px; }
::selection { background:var(--selected-bg); color:var(--selected-ink); }
.icon-bank { position:absolute; width:0; height:0; pointer-events:none; }
.film-header svg,.film-footer svg,.opening-title svg,.dlg-btn svg,.dialog-head svg,.bubble-file svg {
  width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; flex:none;
}
#stage { position:absolute; inset:var(--hdr) 0 var(--foot); isolation:isolate; overflow:hidden; }

.film-header,.film-footer { position:absolute; width:100%; z-index:7; background:var(--surface); color:var(--ink); }
.film-header {
  inset:0 0 auto; height:var(--hdr); border-block-end:1px solid var(--line); padding-inline:var(--page-gutter);
  display:flex; align-items:center; justify-content:space-between; gap:var(--space-2);
}
.wordmark,.film-header nav,.film-header button,.primary,.controls,.dialog-head { display:flex; align-items:center; }
.wordmark { gap:var(--space-4); }
.wordmark > span { border-inline-start:1px solid var(--line); padding-inline-start:var(--space-4); color:var(--muted); font-size:13px; font-weight:560; }
.wordmark-art { --lock-height:31px; height:var(--lock-height); aspect-ratio:272.55/68; position:relative; }
.wordmark-art img { width:100%; height:100%; display:block; }
/* The native animated glyph occupies exactly the mark's box in the approved lockup. */
.wordmark-art:has(mr-brand-motion:defined) img { clip-path:inset(0 24.45% 0 0); }
.wordmark-art mr-brand-motion { position:absolute; right:.735%; top:2.94%; --mr-motion-size:calc(var(--lock-height) * .9412); }
.film-header nav { display:flex; align-items:center; gap:var(--space-2); }
.film-header button,.controls > button,.dlg-btn {
  border:1px solid var(--line); border-radius:var(--radius); color:var(--ink); background:var(--surface);
  font-size:14px; line-height:1.25; font-weight:650;
}
.film-header button { min-height:var(--touch); padding:6px 12px; gap:7px; justify-content:center; }
.film-header svg { width:17px; height:17px; }
.film-header button:hover,.controls > button:not(.primary):hover { border-color:var(--border); background:var(--surface-alt); }
.film-header button[aria-pressed=true] { color:var(--selected-ink); background:var(--selected-bg); border-color:var(--focus); }
.primary,.controls > .primary,.dlg-btn {
  justify-content:center; gap:var(--space-3); color:var(--on-accent); background:var(--accent); border:1px solid var(--accent);
  border-radius:var(--radius); padding:8px 17px; min-height:var(--touch); font-weight:720;
}
.primary:hover,.controls > .primary:hover,.dlg-btn:not(.secondary):hover { background:color-mix(in srgb,var(--accent) 86%,var(--on-accent)); }

body[data-view=opening] { --cover-wash:var(--bg); }
body[data-view=opening] #stage { inset:var(--hdr) 0 0; }
body[data-view=opening] #stage::after {
  content:""; position:absolute; inset:0; z-index:2; pointer-events:none;
  background:linear-gradient(270deg,var(--cover-wash) 0 17%,color-mix(in srgb,var(--cover-wash) 96%,transparent) 25%,color-mix(in srgb,var(--cover-wash) 86%,transparent) 31%,transparent 51%);
}
.opening-title {
  position:absolute; z-index:3; inset-inline-start:var(--page-gutter); top:50%; transform:translateY(-48%);
  width:min(33vw,520px); display:none;
}
body[data-view=opening] .opening-title { display:block; }
body[data-view=opening] .wordmark-art { display:none; }
body[data-view=opening] .wordmark > span { display:block; border:0; padding:0; color:var(--ink); }
.cover-brand { width:fit-content; margin-block-end:clamp(12px,2.5vh,24px); }
.cover-brand mr-brand-motion { --mr-motion-size:clamp(30px,3vw,48px); display:flex; --mr-motion-word-ink:var(--ink); }
.cover-brand img { height:clamp(30px,3vw,48px); width:auto; }
.cover-brand mr-brand-motion:not(:defined),.cover-brand mr-brand-motion:defined + img { display:none; }
.opening-title h1 { margin:0; font:400 clamp(43px,5.2vw,88px)/1.18 var(--font-display); color:var(--ink); }
.opening-title h1 em { color:var(--heading-accent); font-style:normal; white-space:nowrap; }
.opening-title p { color:var(--ink); line-height:1.8; font-weight:530; font-size:clamp(16px,1.3vw,22px); margin:var(--space-4) 0 var(--space-5); }
.opening-title .primary { width:fit-content; font-size:16px; }
body[data-view=opening] .film-footer { background:transparent; border:0; pointer-events:none; height:52px; }
body[data-view=opening] .film-footer :is(.controls,.narration) { display:none; }
body[data-view=opening] .chapter-position { color:var(--ink); }

.film-footer { inset:auto 0 0; height:var(--foot); border-block-start:1px solid var(--line); }
.footer-inner { height:100%; display:grid; align-items:center; grid-template-columns:auto minmax(0,1fr) auto; gap:clamp(15px,2.5vw,46px); padding-inline:var(--page-gutter); }
.chapter-position { display:flex; align-items:flex-start; flex-direction:column; gap:6px; white-space:nowrap; color:var(--muted); font-size:12px; }
#chapterBars { display:flex; gap:4px; }
#chapterBars i { width:14px; height:3px; background:var(--line); }
#chapterBars i.past { background:var(--border); }
#chapterBars i.current { width:26px; background:var(--accent); }
.narration { border-inline-start:1px solid var(--line); padding-inline-start:clamp(14px,2vw,32px); min-width:0; line-height:1.6; }
.narration strong,.narration span { display:block; }
.narration strong { font-size:17px; font-weight:780; }
.narration span { color:var(--muted); font-size:13px; }
.controls { gap:var(--space-2); }
.controls > button { min-width:var(--touch); height:var(--touch); padding-inline:11px; display:grid; place-items:center; }
.controls > .primary { display:flex; padding-inline:16px; }
.controls > button:disabled { opacity:.45; }
body[data-view=flow] { --foot:124px; }
#flowTools { height:40px; padding:2px var(--page-gutter); display:flex; align-items:center; gap:10px; background:var(--bg); border-bottom:1px solid var(--line); }
#flowTools:not([hidden]) + .footer-inner { height:calc(100% - 40px); }
#flowTools button { border:1px solid var(--border); color:var(--accent-ink); background:var(--surface); border-radius:var(--radius-sm); padding:1px 10px; line-height:1.55; font-size:13px; white-space:nowrap; }
#flowTools input { width:min(260px,35vw); accent-color:var(--accent); cursor:pointer; }
#flowTools output { color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }

/* The chat is presented as source evidence, with separate paper and screen colors. */
.phone-app { height:100%; display:flex; flex-direction:column; background:var(--bg); color:var(--ink); direction:rtl; overflow:hidden; text-align:right; font-family:var(--font-ui); }
.phone-status,.conversation-head { color:var(--band-ink); background:var(--band-bg); }
.phone-status { display:flex; justify-content:space-between; align-items:center; padding:5px 15px 3px; font-size:10px; line-height:17px; direction:ltr; }
.conversation-head { display:flex; gap:10px; align-items:center; padding:8px 13px 11px; border-bottom:1px solid var(--border); z-index:1; }
.conversation-head b { display:block; font-size:18px; font-weight:800; }
.conversation-head small { display:block; font-size:11px; color:var(--band-muted); }
.group-avatar { border:1px solid var(--band-muted); background:var(--case-bg); color:var(--case-ink); border-radius:50%; width:38px; height:38px; display:grid; place-items:center; font-weight:800; }
.chat-feed {
  position:relative; flex:1; overflow-y:auto; overscroll-behavior:contain; padding:10px 10px 12px; scrollbar-width:thin;
  background:radial-gradient(color-mix(in srgb,var(--border) 13%,transparent) 1px,transparent 1px) 0 0/11px 11px,var(--bg);
  display:flex; flex-direction:column; align-items:flex-start; gap:7px;
}
.chat-day { align-self:center; color:var(--muted); background:var(--surface-alt); border-radius:var(--radius-pill); padding:1px 9px; font-size:10px; }
.msg { max-width:92%; padding:7px 10px; border-radius:11px 3px 11px 11px; color:var(--ink); background:var(--surface); border:1px solid var(--line); font-size:15px; line-height:1.5; flex:none; text-align:right; position:relative; overflow-wrap:anywhere; }
.msg.mine { align-self:flex-end; border-radius:3px 11px 11px 11px; color:var(--selected-ink); background:var(--selected-bg); }
.msg b { display:block; font-size:11px; font-weight:750; color:var(--accent-ink); }
.msg.mine b { color:inherit; }
.msg .bubble-file { display:flex; align-items:center; justify-content:flex-end; gap:5px; font:600 12px/1.5 var(--font-en); direction:ltr; min-height:23px; }
.bubble-file svg { width:15px; }
.msg.active { outline:2px solid var(--focus); outline-offset:1px; }
.chat-filename { font-family:var(--font-en); font-size:.9em; display:inline-block; padding:0 3px; background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:var(--radius-sm); }
.phone-foot { display:flex; justify-content:space-between; align-items:center; gap:6px; border-top:1px solid var(--line); color:var(--muted); background:var(--surface); font-size:11px; padding:5px 11px; flex:none; }
.phone-locked,.laptop-standby { width:100%; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; color:var(--screen-ink); background:var(--screen-bg); text-align:center; }
.phone-locked { justify-content:flex-start; gap:40px; padding:47px 13px; }
.phone-locked time { font-size:53px; font-weight:700; line-height:1.1; }
.phone-locked div { width:100%; background:color-mix(in srgb,var(--screen-ink) 9%,transparent); border:1px solid color-mix(in srgb,var(--screen-ink) 27%,transparent); border-radius:var(--radius); text-align:right; padding:11px 13px; }
.phone-locked span { display:block; font-size:13px; margin-top:5px; }
.laptop-standby { color:var(--ink); background:var(--surface-alt); }
.laptop-standby img { width:36%; height:auto; }
#traceLayer { position:fixed; inset:0; z-index:5; pointer-events:none; direction:ltr; overflow:hidden; }
#traceLayer svg { width:100%; height:100%; fill:none; overflow:visible; }
#traceLayer path { stroke-linecap:round; stroke-width:2.8; }
#traceLayer .trace-shadow { stroke:var(--screen-bg); stroke-width:5; opacity:.8; }
#traceLayer .trace-ink { stroke:var(--trace); }
#traceLayer:not(.moving) * { opacity:0; }
.trace-tag { position:absolute; transform:translate(-50%,-50%); direction:rtl; white-space:nowrap; padding:5px 14px; background:var(--screen-bg); color:var(--screen-ink); border:1px solid var(--trace); border-radius:var(--radius-pill); font:650 14px/1.5 var(--font-en); box-shadow:var(--shadow-2); }
#traceLayer.parcel-flying .trace-tag { background:var(--feature-bg); color:var(--feature-ink); border-color:var(--feature-muted); }
#laptopSurface[data-registering] { pointer-events:none; }
#laptopSurface .film-demo-action { outline:3px solid var(--focus); outline-offset:4px; }
@keyframes receiving-field {
  0%,52% { background:var(--selected-bg); outline:3px solid var(--focus); outline-offset:3px; }
  100% { outline-color:transparent; }
}
.inbox-arrival,#laptopSurface .film-receiving-field { animation:receiving-field 1s ease-out; }

#filmDialog { padding:0; border:1px solid var(--border); border-radius:var(--radius-lg); width:min(610px,calc(100vw - 26px)); max-height:calc(100dvh - 36px); overflow:auto; color:var(--ink); background:var(--surface); box-shadow:var(--shadow-2); }
#filmDialog::backdrop { background:var(--scrim); backdrop-filter:blur(3px); }
#dialogContent { padding:clamp(20px,3vw,34px); }
.dialog-head { justify-content:space-between; gap:12px; margin-bottom:20px; }
.dialog-head h2 { font-size:clamp(23px,3vw,32px); font-weight:780; margin:0; line-height:1.45; }
.dialog-head button { width:var(--touch); height:var(--touch); display:grid; place-items:center; flex:none; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--ink); }
.detail-card { border-inline-start:3px solid var(--accent); margin:0 0 12px; padding:10px 16px; background:var(--bg); }
.detail-card small,.detail-caption { color:var(--muted); font-size:13px; }
.detail-card p { margin:4px 0; font-size:17px; line-height:1.8; }
.detail-card bdi { font-family:var(--font-en); font-size:.92em; overflow-wrap:anywhere; }
.detail-card details { font-size:14px; color:var(--accent-ink); padding:5px 0; }
.detail-card summary { cursor:pointer; }
.dialog-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:18px; }
.dialog-actions .secondary { background:var(--surface); border-color:var(--border); color:var(--accent-ink); }
.map-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.map-list button { display:flex; align-items:center; gap:12px; text-align:start; background:var(--bg); color:var(--ink); border:1px solid var(--line); border-radius:var(--radius); padding:10px 12px; min-height:var(--touch); }
.map-list button[aria-current=true] { border-color:var(--focus); color:var(--selected-ink); background:var(--selected-bg); }
.map-list button b { font-size:13px; color:var(--accent-ink); }
.map-list button:hover { border-color:var(--border); }

@media (min-width:900px) {
  #filmDialog[data-kind=source] { inset:0 auto 0 clamp(25px,5vw,115px); margin:auto 0; width:min(38vw,515px); }
  #filmDialog[data-kind=source]::backdrop { background:linear-gradient(90deg,var(--scrim),color-mix(in srgb,var(--scrim) 30%,transparent)); backdrop-filter:none; }
}
@media (max-width:760px) {
  :root { --hdr:54px; --foot:86px; --page-gutter:12px; }
  .wordmark-art { --lock-height:26px; }
  .wordmark > span { display:none; }
  .film-header nav { gap:4px; }
  .film-header button { padding-inline:7px; font-size:12px; }
  .opening-title { width:min(86vw,365px); top:auto; bottom:9%; inset-inline-start:6%; transform:none; }
  .opening-title h1 { font-size:clamp(40px,10.6vw,62px); }
  .opening-title p { margin:8px 0 14px; font-size:16px; }
  .cover-brand { margin-block-end:9px; }
  .cover-brand mr-brand-motion { --mr-motion-size:28px; }
  body[data-view=opening] #stage::after { background:linear-gradient(0deg,var(--cover-wash) 2%,color-mix(in srgb,var(--cover-wash) 98%,transparent) 32%,color-mix(in srgb,var(--cover-wash) 94%,transparent) 42%,transparent 63%); }
  .footer-inner { grid-template-columns:minmax(0,1fr) auto; gap:8px; }
  .chapter-position { display:none; }
  body[data-view=opening] .chapter-position { display:flex; }
  .narration { padding:0; border:0; }
  .narration strong { font-size:14px; }
  .narration span { font-size:12px; line-height:1.5; }
  .controls { gap:4px; }
  .controls > .primary { padding:6px 9px; gap:5px; }
  .controls svg { width:16px; }
  .map-list button { font-size:14px; padding:8px; gap:7px; }
  .trace-tag { font-size:12px; }
  body[data-view=flow] { --foot:119px; }
  #flowTools { gap:6px; }
  .flow-phone .phone-status { display:none; }
  .flow-phone .conversation-head { padding:3px 8px; gap:6px; }
  .flow-phone .group-avatar { width:24px; height:24px; font-size:12px; }
  .flow-phone .conversation-head b { font-size:14px; }
  .flow-phone .conversation-head small { font-size:10px; }
  .flow-phone .chat-feed { padding:4px 7px; gap:4px; }
  .flow-phone .msg { padding:4px 8px; font-size:13px; }
  .flow-phone .phone-foot { padding:1px 7px; }
}
@media (max-width:560px) {
  .film-header nav > button { width:var(--touch); padding:0; }
  .film-header nav > button span { position:absolute; clip-path:inset(50%); width:1px; height:1px; overflow:hidden; white-space:nowrap; }
}
@media (max-height:510px) and (min-width:560px) {
  :root { --hdr:46px; --foot:52px; }
  body[data-view=flow] { --foot:91px; }
  .opening-title { inset-inline-start:var(--page-gutter); width:36%; bottom:auto; top:52%; transform:translateY(-45%); }
  .opening-title h1 { font-size:clamp(32px,5vw,46px); }
  .opening-title p { margin:4px 0 8px; font-size:13px; }
  .cover-brand { margin-block-end:6px; }
  .cover-brand mr-brand-motion { --mr-motion-size:24px; }
  .narration strong { font-size:14px; }
  .narration span { font-size:11px; }
  body[data-view=opening] #stage::after { background:linear-gradient(270deg,var(--cover-wash) 0 22%,color-mix(in srgb,var(--cover-wash) 90%,transparent) 33%,transparent 53%); }
}
@container phone-display (min-height:475px) {
  .flow-phone .chat-feed { gap:4px; padding-top:5px; }
  .flow-phone .msg { padding:5px 9px; }
  .flow-phone .chat-day { line-height:1.35; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; }
  .inbox-arrival,#laptopSurface .film-receiving-field { animation:none; }
}
