/* =========================================================================
   Ask Gianfranco — device chrome
   The simulated phone: device frame, status bar, Live Activity structure,
   OS switch, notifications/poster/share-sheet structure, gesture nav.

   DISPLAY MODES (single source of truth):
     fullbleed (default, mobile-first) — the page runs on a real phone or a
       narrow window. NO simulated phone chrome: no fake clock, no signal/
       battery glyphs, no home-bar indicator (the real OS already draws
       those). The status bar collapses to a slim header that carries only
       the Live Activity pill and the story-progress hairline.
     framed (desktop ≥1080px) — the page floats as a phone mockup on the
       stage, and the full simulated status bar (clock, glyphs, nav
       indicator) renders inside the frame.
   js/os.js mirrors the same 1080px media query onto
   html[data-display="framed"|"fullbleed"]; the rules below pair the media
   query with :not([data-display="fullbleed"]) so the attribute and the
   query always agree — and without JS the attribute is absent, making the
   media query alone the fallback. Tablets (461–1079px) stay fullbleed.
   ========================================================================= */

/* ---------------------------------------------------------------- device */

.device {
  position: relative;
  z-index: 1;
  width: var(--col);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--line),
    0 2rem 4.5rem -2rem oklch(0.4 0.03 50 / 0.28);
  transition: background-color 1.3s var(--ease), border-radius 0.6s var(--ease);
}

/* the device surface also takes the story temperature, so mood reads on mobile */
body[data-mood="challenge"] .device { background: oklch(0.965 0.006 92); }
body[data-mood="setback"] .device { background: oklch(0.945 0.007 72); }
body[data-mood="payoff"] .device { background: oklch(0.978 0.011 82); }

/* ------------------------------------------------------------- statusbar */
/* Fullbleed default: a slim sticky header. Only the Live Activity (centered)
   and the story-progress hairline; the simulated clock and system glyphs are
   display:none until the framed block below re-enables them. */

.statusbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: center;
  gap: 0.5rem;
  padding: max(0.55rem, env(safe-area-inset-top)) 1rem 0.55rem;
  background: color-mix(in oklch, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
          backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}
.statusbar__time {
  display: none;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.statusbar__sys { display: none; justify-self: end; align-items: center; gap: 0.4rem; color: var(--text); }
.statusbar__sys svg { fill: currentColor; }
/* per-OS status glyph clusters: only the active platform's set shows */
.sys { display: none; align-items: center; gap: 0.42rem; }
.sys--android { gap: 0.32rem; }
body[data-os="ios"] .sys--ios { display: inline-flex; }
body[data-os="android"] .sys--android { display: inline-flex; }
.sys-pct { font-family: var(--font-ui); font-weight: 600; font-size: 0.74rem; letter-spacing: -0.02em; color: currentColor; }

/* story progress: a hairline that fills as the narrative advances */
.story-progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--line-soft);
  overflow: hidden;
}
.story-progress__fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.9s var(--ease);
  box-shadow: 0 0 0.6rem var(--accent);
}

/* Focus / Do Not Disturb (setback) */
body.is-focus .mood-dim { opacity: 1; }
body.is-focus .device { filter: saturate(0.9) brightness(0.985); transition: filter 0.9s var(--ease); }
.sysfocus { display: inline-flex; align-items: center; color: var(--text-muted); }
.sysfocus svg { width: 0.95rem; height: 0.95rem; }

/* ---- gesture nav indicator: iOS home bar / Android handle ---------------
   Framed only: a real phone draws its own. */
.navind { display: none; justify-content: center; align-items: center; padding-top: 0.5rem; }
.navind span { display: block; height: 5px; border-radius: 100px; background: var(--text); }
body[data-os="ios"]     .navind span { width: 38%; max-width: 9.5rem; opacity: 0.4; }
body[data-os="android"] .navind span { width: 25%; max-width: 7rem;  opacity: 0.5; }

/* ------------------------------------------------------------- os-switch */
.os-switch {
  --switch-pad: 0.18rem;
  --switch-gap: 0.1rem;
  --switch-row: 2.75rem;
  position: relative;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--switch-gap);
  margin: 0 auto 0.5rem;
  padding: var(--switch-pad);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-label);
}
.os-switch__btn {
  position: relative;
  z-index: 1;
  flex: 1 1 0;              /* equal columns so the thumb aligns under either */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
  min-width: 5.2rem;
  min-height: var(--switch-row);
  padding: 0.32rem 0.85rem;
  border: none;
  background: none;
  border-radius: 2rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.3s var(--ease);
}
.os-switch__btn[aria-pressed="true"] { color: var(--text); }
.os-switch__btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.os-switch__glyph { opacity: 0.9; }
.os-switch__thumb {
  position: absolute;
  z-index: 0;
  top: var(--switch-pad); bottom: var(--switch-pad); left: var(--switch-pad);
  width: calc((100% - (var(--switch-pad) * 2) - var(--switch-gap)) / 2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 0.2rem 0.5rem -0.25rem oklch(0.4 0.03 50 / 0.3);
  transition: transform 0.42s var(--ease);
}
body[data-os="android"] .os-switch__thumb { transform: translateX(calc(100% + var(--switch-gap))); }

/* desktop: lift the selector out of the phone, onto the stage (mirrors the
   wordmark on the left). Stacks vertically; the thumb slides top/bottom. */
@media (min-width: 1080px) {
  .os-switch {
    --switch-pad: 0.24rem;
    --switch-gap: 0rem;
    --switch-row: 2.62rem;
    position: fixed;
    z-index: 6;
    top: 50%;
    left: calc(50% + var(--col) / 2 + 2.2vw);
    transform: translateY(-50%);
    margin: 0;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, var(--switch-row));
    min-width: 9.7rem;
    overflow: hidden;
    padding: 0;
    background: var(--surface);
    border-radius: 2.15rem;
    box-shadow: 0 0.6rem 1.6rem -0.5rem oklch(0.35 0.03 50 / 0.4);
  }
  .os-switch__btn { width: 100%; justify-content: flex-start; padding-inline: 1rem; }
  .os-switch__btn:focus-visible { outline-offset: -4px; }
  .os-switch__thumb {
    top: 0; left: 0; right: 0;
    bottom: auto;
    width: auto;
    height: var(--switch-row);
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 2.15rem 2.15rem 1.05rem 1.05rem;
    transition: transform 0.42s var(--ease);
  }
  body[data-os="android"] .os-switch__thumb {
    transform: translateY(var(--switch-row));
    border-top: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 1.05rem 1.05rem 2.15rem 2.15rem;
  }
}
@media (min-width: 1320px) {
  .os-switch { left: calc(50% + var(--col) / 2 + 3.5vw); }
}

/* =========================================================================
   Live Activity: iOS Dynamic Island / Android Live Update status chip
   Structure only; the platform skins live in ios.css / android.css.
   ========================================================================= */
.liveact {
  position: relative;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  height: 1.9rem;
  max-width: min(72vw, 320px);
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.liveact__shape { position: absolute; inset: 0; z-index: 0; }
.liveact__bg {
  position: absolute; inset: 0;
  border-radius: 1.2rem;
  transition: background 0.45s var(--ease), border-radius 0.45s var(--ease);
  touch-action: manipulation;
}
.liveact:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 4px; }
.liveact__content {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 0.42rem;
  height: 100%; padding: 0 0.72rem;
  white-space: nowrap;
  transition: opacity 0.2s var(--ease);
}
.liveact__lead { display: inline-flex; align-items: center; }
.liveact__dot { width: 0.5rem; height: 0.5rem; }
.liveact__ic { display: none; }
.liveact__text { display: inline-flex; flex-direction: column; justify-content: center; line-height: 1.05; min-width: 0; }
.liveact__title { font-weight: 600; font-size: 0.8rem; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
.liveact__sub { font-family: var(--font-label); font-size: 0.64rem; opacity: 0.82; overflow: hidden; text-overflow: ellipsis; }
.liveact__trail { display: inline-flex; align-items: center; }
.liveact__ring { display: none; }
.liveact__ringtrack { stroke: currentColor; opacity: 0.28; }
.liveact__ringfill {
  stroke: var(--accent);
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--prog, 0) * 100);
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.85s var(--ease);
}
.liveact__bar { display: none; width: 2.4rem; height: 0.32rem; border-radius: 1rem; background: currentColor; opacity: 0.3; overflow: hidden; }
.liveact__barfill { display: block; height: 100%; width: calc(var(--prog, 0) * 100%); background: var(--accent); border-radius: inherit; transition: width 0.85s var(--ease); }

/* progress mode: glyph + progress replace the simple app dot */
.liveact--progress .liveact__dot { display: none; }
.liveact--progress .liveact__ic  { display: inline-flex; }
.liveact--progress .liveact__sub { display: inline; }

/* wake (hero): the activity comes alive */
@keyframes liveact-wake {
  0% { transform: scale(0.55); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.liveact--wake .liveact__shape { animation: liveact-wake 0.7s var(--ease); transform-origin: center; }

/* expanded (build beat): the detail card GROWS OUT OF the pill itself.
   Collapsed it is geometrically identical to the pill (100% × 100%, full
   rounding) stacked above it; expanding transitions width/border-radius in
   CSS while js/live-activity.js drives the height (px accordion — height:
   auto can't transition). It reads as the island/chip itself swelling into
   the card, matching how real expanded Live Activities behave. */
.liveact__expand {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100%;
  padding: 0.85rem 0.95rem;
  text-align: left;
  border-radius: 999px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition:
    width 0.45s var(--ease),
    height 0.45s var(--ease),
    border-radius 0.45s var(--ease),
    opacity 0.22s var(--ease);
}
.liveact--expanded .liveact__expand {
  width: min(21rem, calc(100vw - 1.5rem));
  border-radius: var(--la-expand-r, 1.6rem);
  opacity: 1;
  pointer-events: auto;
}
/* the compact content yields to the card while expanded */
.liveact--expanded .liveact__content { opacity: 0; }

.liveact__ehead { font-family: var(--font-label); font-size: 0.64rem; opacity: 0.7; margin-bottom: 0.45rem; display: flex; justify-content: space-between; }
.liveact__erow { display: flex; align-items: baseline; justify-content: space-between; gap: 0.7rem; font-size: 0.8rem; }
.liveact__erow + .liveact__erow { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid currentColor; border-color: color-mix(in oklch, currentColor 16%, transparent); }
.liveact__ev { font-weight: 600; }
.liveact__es { opacity: 0.7; font-family: var(--font-label); font-size: 0.7rem; }
.liveact__etitle {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.15;
  margin-bottom: 0.16rem;
}
.liveact__estate {
  font-family: var(--font-label);
  font-size: 0.72rem;
  opacity: 0.78;
  margin-bottom: 0.58rem;
}
.liveact__etrack {
  position: relative;
  height: 0.42rem;
  border-radius: 999px;
  margin-bottom: 0.7rem;
  background: color-mix(in oklch, currentColor 18%, transparent);
  overflow: hidden;
}
.liveact__etrack span {
  display: block;
  width: var(--pct, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.liveact__etrack::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.12rem;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  transform: translateY(-50%);
  background: oklch(0.975 0.006 86);
}

/* =========================================================================
   Notifications: conclusion cascade (MARQUEE) + setback silenced
   ========================================================================= */
.notif-stack { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.75rem; }
.notif {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.72rem 0.85rem;
  border-radius: 1.2rem;
  opacity: 0;
  transform: translateY(1rem) scale(0.97);
}
.notif.in { opacity: 1; transform: none; transition: opacity 0.5s var(--ease), transform 0.6s var(--ease); }
.notif__icon { width: 1.95rem; height: 1.95rem; border-radius: 0.55rem; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.notif__icon svg { width: 1.05rem; height: 1.05rem; }
.notif__main { min-width: 0; display: flex; flex-direction: column; gap: 0.04rem; }
.notif__app { font-family: var(--font-label); font-size: 0.64rem; color: var(--text-faint); }
.notif__title { font-weight: 600; font-size: 0.9rem; color: var(--text); line-height: 1.25; }
.notif__body { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.12rem; }
.notif__time { font-family: var(--font-label); font-size: 0.62rem; color: var(--text-faint); white-space: nowrap; }
.notif--silenced { opacity: 0.62; }
.notif--silenced .notif__icon { background: var(--surface-3); color: var(--text-faint); }
.notif--silenced .notif__title { color: var(--text-muted); }
.notif__hushed { font-family: var(--font-label); font-size: 0.62rem; color: var(--text-faint); display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.25rem; }
.notif__hushed svg { width: 0.85rem; height: 0.85rem; }

/* =========================================================================
   Contact poster (structure; iOS Contact Poster / Android Quick Share skins
   in the per-OS files)
   ========================================================================= */
.poster {
  position: relative; overflow: hidden;
  margin-bottom: 0.85rem;
  min-height: 11.5rem;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1.1rem;
  border-radius: 1.5rem;
  background: oklch(0.2 0.01 55);
  opacity: 0; transform: translateY(0.9rem) scale(0.985);
}
.poster.in { opacity: 1; transform: none; transition: opacity 0.55s var(--ease), transform 0.65s var(--ease); }
.poster__photo { position: absolute; inset: 0; z-index: 0; }
.poster__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transform: scale(-1.18, 1.18); transform-origin: 50% 22%; }
.poster__scrim { position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, oklch(0.15 0.02 40 / 0.88), oklch(0.15 0.02 40 / 0.12) 56%, transparent); }
.poster__id { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 0.1rem; }
.poster__name { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 12vw, 2.9rem); line-height: 0.88; letter-spacing: -0.03em; color: oklch(0.98 0.01 80); }
.poster__full { font-size: 0.85rem; color: oklch(0.9 0.012 80); margin-top: 0.25rem; }
.poster__sub { display: none; }

/* ---- composer material scaffold -----------------------------------------
   The glass lives on a ::before layer, NOT the composer itself: a
   backdrop-filter on .composer would make it a containing block and trap the
   fixed desktop OS-switch inside it. Skins paint this pseudo per OS. */
.composer::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-top: 1px solid transparent;
  transition: background 0.6s var(--ease), border-color 0.6s var(--ease);
}

/* =========================================================================
   SHARE SHEET (contact beat)
   A real bottom sheet: slides up over the phone, drag-to-dismiss, and the
   primary action calls the Web Share API (navigator.share) when present.
   Structure only; iOS (Liquid Glass share sheet: header ✕ + grouped action
   rows) and Android (Material bottom sheet: title + target grid) skins live
   in the per-OS files. Confined to the .device on desktop, fixed to the
   viewport on mobile.
   ========================================================================= */
/* the share affordance inside the contact answer */
.share-trigger {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 0.85rem; padding: 0.7rem 1.05rem;
  font-family: var(--font-ui); font-size: 0.95rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 2rem; cursor: pointer;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.share-trigger svg { width: 1.05rem; height: 1.05rem; }
.share-trigger:hover { background: color-mix(in oklch, var(--accent) 20%, transparent); transform: translateY(-0.1rem); }
.share-trigger:active { transform: translateY(0) scale(0.97); }
.share-trigger:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 3px; }

.sheet-scrim {
  position: fixed; inset: 0; z-index: 40;
  background: oklch(0.2 0.02 50 / 0.001);
  opacity: 0; pointer-events: none;
  transition: opacity 0.45s var(--ease), background 0.45s var(--ease);
}
.sheet-scrim.is-open { opacity: 1; pointer-events: auto; background: oklch(0.2 0.02 50 / 0.42); }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 41;
  width: var(--col);
  max-width: 460px;
  transform: translate(-50%, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.6rem 1.05rem max(1.1rem, env(safe-area-inset-bottom));
  touch-action: none;
}
.sheet.is-open { transform: translate(-50%, 0); }
/* promote to its own layer only while actually moving, not at rest */
.sheet.is-dragging, .sheet.is-animating { will-change: transform; }
.sheet:not(.is-dragging).is-animating { transition: transform 0.52s var(--ease); }
.sheet[hidden], .sheet-scrim[hidden] { display: none; }

.sheet__grip { align-self: center; width: 100%; max-width: 9rem; height: 1.5rem; border: none; background: none; cursor: grab; display: grid; place-items: center; padding: 0; }
.sheet__grip::before { content: ""; width: 2.4rem; height: 0.3rem; border-radius: 1rem; background: var(--text-faint); opacity: 0.55; }
.sheet.is-dragging .sheet__grip { cursor: grabbing; }

.sheet__head { display: flex; align-items: center; gap: 0.85rem; padding: 0.1rem 0.35rem 0.2rem; }
.sheet__avatar { flex: 0 0 auto; width: 3.1rem; height: 3.1rem; border-radius: 50%; overflow: hidden; box-shadow: 0 0.3rem 0.9rem -0.4rem oklch(0 0 0 / 0.5); }
.sheet__avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; transform: scaleX(-1); }
.sheet__id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sheet__name { font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.015em; line-height: 1.05; }
.sheet__sub { font-size: 0.85rem; color: var(--text-muted); }

/* circled ✕ in the header (iOS pattern; Android hides it) */
.sheet__close {
  flex: 0 0 auto;
  align-self: flex-start;
  width: 1.9rem; height: 1.9rem;
  border: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in oklch, var(--text) 9%, transparent);
  color: var(--text-muted);
  cursor: pointer;
}
.sheet__close svg { width: 0.8rem; height: 0.8rem; }
.sheet__close:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

.sheet__targets { display: flex; gap: 0.7rem; overflow-x: auto; scrollbar-width: none; padding: 0.3rem 0.35rem 0.2rem; scroll-snap-type: x proximity; }
.sheet__targets::-webkit-scrollbar { display: none; }
.sheet__target {
  flex: 0 0 auto; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  width: 4.1rem; padding: 0; border: none; background: none; cursor: pointer;
  font-family: var(--font-ui); font-size: 0.7rem; color: var(--text-muted);
}
.sheet__ticon {
  width: 3.3rem; height: 3.3rem; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent-ink); background: var(--accent);
  box-shadow: 0 0.4rem 1rem -0.5rem var(--accent-strong);
  transition: transform 0.4s var(--ease);
}
.sheet__ticon svg { width: 1.45rem; height: 1.45rem; }
.sheet__target:active .sheet__ticon { transform: scale(0.9); }
.sheet__target:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 3px; border-radius: 0.8rem; }
.sheet__target--copy .sheet__ticon  { background: var(--surface-3); color: var(--accent); border: 1px solid var(--line); }
.sheet__target--mail .sheet__ticon  { background: var(--surface-3); color: var(--accent); border: 1px solid var(--line); }
.sheet__target.is-done .sheet__tlabel { color: var(--accent); font-weight: 600; }

/* grouped inset action list (iOS pattern; Android hides it) */
.sheet__actions {
  display: flex;
  flex-direction: column;
  border-radius: 0.95rem;
  overflow: hidden;
}
.sheet__action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.82rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.97rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
}
.sheet__action + .sheet__action { border-top: 1px solid var(--line-soft); }
.sheet__action svg { flex: 0 0 auto; color: var(--text-muted); }
.sheet__action:focus-visible { outline: 2px solid var(--accent-line); outline-offset: -2px; }
.sheet__action.is-done { color: var(--accent); }
.sheet__action.is-done svg { color: var(--accent); }

/* on desktop the phone floats; pin the sheet to the device itself so it slides
   up *inside* the phone and clips to its rounded corners (.device overflow). */
@media (min-width: 1080px) {
  .sheet-scrim { position: absolute; z-index: 40; }
  .sheet { position: absolute; width: auto; left: 0; right: 0; max-width: none; transform: translateY(100%); }
  .sheet.is-open { transform: translateY(0); }
}

/* =========================================================================
   FRAMED MODE (desktop ≥1080px): the phone mockup, with full simulated
   chrome. html:not([data-display="fullbleed"]) keeps this in lockstep with
   js/os.js (and is a pure media-query fallback when JS is off).
   ========================================================================= */
@media (min-width: 1080px) {
  html:not([data-display="fullbleed"]) body { padding: 3vh 0; align-items: flex-start; }
  html:not([data-display="fullbleed"]) .device {
    height: min(820px, calc(100dvh - 6vh));
    min-height: min(680px, calc(100dvh - 6vh));
    margin: auto;
    border-radius: var(--radius-device, 2.4rem);
    overflow: clip;
    max-height: none;
    /* soft paper-cradle, a light bezel ring plus a long warm shadow */
    box-shadow: 0 0 0 1px var(--line), 0 0 0 0.5rem oklch(0.97 0.006 86), 0 0 0 0.55rem var(--line), 0 2.5rem 5.5rem -1.5rem oklch(0.4 0.03 50 / 0.32);
  }
  html:not([data-display="fullbleed"]) .thread { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

  /* the full simulated status bar, inside the frame only */
  html:not([data-display="fullbleed"]) .statusbar {
    grid-template-columns: 1fr auto 1fr;
    justify-items: stretch;
    padding: 0.7rem 1.25rem;
    border-radius: var(--radius-device, 2.4rem) var(--radius-device, 2.4rem) 0 0;
  }
  html:not([data-display="fullbleed"]) .statusbar__time { display: block; }
  html:not([data-display="fullbleed"]) .statusbar__sys  { display: inline-flex; }
  html:not([data-display="fullbleed"]) .navind          { display: flex; }
}

/* --------------------------------------------------- reduced motion (chrome) */

@media (prefers-reduced-motion: reduce) {
  .sheet-scrim, .sheet { transition: none !important; }
  .sheet.is-open { transform: translate(-50%, 0); }
  @media (min-width: 1080px) {
    .sheet.is-open { transform: translateY(0); }
  }
  .liveact__expand { transition: none !important; }
}
