/* The frames each screen sits in: the demo's presenter bar, the desk, the phone, the lock screen. */
@layer shell {
  html, body { height: 100%; }
  body { overflow: hidden; display: flex; flex-direction: column; }
  #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }

  /* ---------- the presenter: the demo's controls, not the product's ---------- */
  .presenter {
    flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    padding: 7px 14px; background: #1A1812; color: #CFC6B2;
    font-size: 12px; font-weight: 600; border-bottom: 1px solid #2E2A20; z-index: var(--z-chrome);
  }
  .presenter > * { flex: none; }
  .presenter-mark { display: inline-flex; align-items: center; gap: 7px; color: #F0E8D6; margin-right: 6px; }
  .presenter-mark i { width: 7px; height: 7px; border-radius: 50%; background: var(--marigold); box-shadow: 0 0 0 3px rgba(232, 162, 43, 0.22); }
  .presenter-seg { display: inline-flex; padding: 2px; gap: 1px; border-radius: 5px; background: #29251C; }
  .presenter-seg button { padding: 4px 9px; border-radius: 3px; color: #B3AA95; }
  .presenter-seg button:hover { color: #F0E8D6; }
  .presenter-seg button[aria-checked="true"] { background: #F0E8D6; color: #1A1812; }
  .presenter-select { height: 26px; padding: 0 6px; border-radius: 4px; border: 1px solid #3A3427; background: #29251C; color: #F0E8D6; font-size: 12px; font-weight: 600; }
  .presenter-btn { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 4px; color: #B3AA95; border: 1px solid #3A3427; }
  .presenter-btn:hover { color: #F0E8D6; border-color: #57503F; }
  .presenter-btn.is-on { background: var(--st-blocked); color: #fff; border-color: transparent; }
  .presenter-switch { margin-left: auto; }

  /* ---------- the desk ---------- */
  .desk { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr); background: var(--board); }
  .desk--rail { grid-template-columns: 240px minmax(0, 1fr) 360px; }
  .desk-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
  .desk-page { flex: 1; min-height: 0; overflow: auto; scroll-behavior: smooth; }

  .side { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 12px 10px; background: var(--board-deep); border-right: var(--hair); }
  .side-farm { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
  .side-logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius); background: var(--ink); color: var(--marigold); }
  .side-farm-name { display: grid; line-height: 1.2; }
  .side-farm-name b { font-size: var(--f-4); font-weight: 800; letter-spacing: -0.01em; }
  .side-farm-name small { font-size: var(--f-2); color: var(--ink-soft); }
  .side-find { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--radius); background: var(--board-soft); border: var(--hair); color: var(--ink-soft); font-size: var(--f-3); }
  .side-find span { flex: 1; text-align: left; }
  .side-find:hover { border-color: var(--line-strong); color: var(--ink); }
  .side-group { display: grid; gap: 1px; }
  .side-head { padding: 6px 8px 4px; font-size: var(--f-1); font-weight: 750; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--ink-faint); }
  .side-item { position: relative; display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--radius); color: var(--ink-soft); font-size: var(--f-3); font-weight: 600; }
  .side-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
  .side-item[aria-current="page"] { background: var(--board-soft); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--veil); }
  .side-item[aria-current="page"] svg { color: var(--ink); }
  .side-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-count { min-width: 20px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--ink-soft); background: color-mix(in srgb, var(--ink) 8%, transparent); }
  .side-count--alarm { background: var(--alarm-field); color: var(--alarm-ink); }
  .side-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--marigold); }
  .side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 10px; border-top: var(--hair); }
  .side-me { display: flex; align-items: center; gap: 9px; padding: 4px 8px; }
  .side-me span:last-child { display: grid; line-height: 1.2; }
  .side-me b { font-size: var(--f-3); }
  .side-me small { font-size: var(--f-1); color: var(--ink-faint); }

  .pause { display: grid; gap: 8px; }
  .pause-btn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--radius); border: var(--edge); background: var(--board-soft); font-size: var(--f-3); font-weight: 650; box-shadow: var(--shadow-stamp); transition: transform var(--dur-1), box-shadow var(--dur-1); }
  .pause-btn:active { transform: translate(1px, 1px); box-shadow: var(--shadow-press); }
  .pause.is-paused .pause-btn { background: var(--marigold); color: var(--marigold-ink); }
  .pause-state { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius); background: var(--st-blocked-wash); color: var(--st-blocked-ink); font-size: var(--f-2); line-height: 1.35; }
  .pause-state svg { flex: none; margin-top: 1px; }
  .pause-why { display: grid; gap: 6px; font-size: var(--f-2); }
  .pause-why-options { display: flex; flex-wrap: wrap; gap: 4px; }
  .pause-why-options button { padding: 4px 8px; border-radius: var(--radius); border: var(--hair); background: var(--board-soft); font-size: var(--f-2); }
  .pause-why-options button:hover { border-color: var(--obj-line); }

  .bar { flex: none; display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 16px 0 20px; border-bottom: var(--hair); background: var(--board); }
  .bar-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: var(--f-3); color: var(--ink-faint); white-space: nowrap; overflow: hidden; }
  .bar-crumbs a { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-weight: 650; }
  .bar-crumbs a:hover { color: var(--ink); }
  .bar-crumbs > span { color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
  .bar-right { display: flex; align-items: center; gap: 6px; }
  .bar-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: var(--radius); font-size: var(--f-2); color: var(--ink-soft); white-space: nowrap; }
  .bar-chip:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
  .bar-chip b { color: var(--ink); }
  .bar-chip--warn { color: var(--st-blocked-ink); background: var(--st-blocked-wash); }
  .bar-led { width: 7px; height: 7px; border-radius: 50%; background: var(--st-running); }
  .bar-chip--warn .bar-led { background: var(--st-blocked); }
  .bar-snow { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 5px; margin-left: 4px; border-radius: 15px; font-size: var(--f-3); font-weight: 650; border: var(--hair); background: var(--board-soft); }
  .bar-snow[aria-pressed="true"] { border-color: var(--obj-line); }

  .rail { min-height: 0; display: flex; flex-direction: column; border-left: var(--hair); background: var(--board-soft); }
  .rail-head { flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 10px 0 14px; border-bottom: var(--hair); }
  .rail-head b { font-size: var(--f-4); }
  .rail-ctx { flex: 1; font-size: var(--f-2); color: var(--ink-faint); }

  .modeband { flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 20px; background: var(--st-blocked-wash); color: var(--st-blocked-ink); border-bottom: 1px solid color-mix(in srgb, var(--st-blocked) 30%, transparent); font-size: var(--f-3); }
  .modeband p { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .modeband-since { font-size: var(--f-2); opacity: 0.8; }
  .modeband-actions { display: flex; align-items: center; gap: 12px; font-weight: 650; white-space: nowrap; }
  .modeband-actions a { text-decoration: underline; text-underline-offset: 3px; }
  .modeband-actions button { padding: 4px 10px; border-radius: var(--radius); border: 1.5px solid currentColor; font-weight: 700; }
  .modeband--compact { padding: 8px 16px; font-size: var(--f-2); }
  .modeband--compact .modeband-since { display: none; }
  .offline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 20px; background: var(--st-blocked-wash); color: var(--st-blocked-ink); font-size: var(--f-3); }

  /* Every page shares one left edge and width, so moving between places never shifts the layout. Prose
     stays readable by its own measure (--w-prose), not by narrowing the page. */
  .page, .page--wide { width: 100%; max-width: 1240px; margin: 0; padding: 28px 32px 64px; }
  .page--narrow { max-width: 760px; }
  .device .page { padding: 0 0 24px; }
  .device .ph-title { font-size: var(--f-7); }

  /* ---------- the phone ---------- */
  .device-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 20px; overflow: auto; background: radial-gradient(ellipse at 50% 30%, var(--board-deep), var(--board) 70%); }
  .device {
    --f-3: 0.9375rem; --f-4: 1.0625rem; --f-5: 1.125rem; --f-6: 1.375rem; --f-7: 1.75rem; --row: 50px; --control: 44px;
    position: relative; width: 390px; height: min(844px, calc(100vh - 92px)); display: flex; flex-direction: column; overflow: hidden;
    border-radius: 46px; background: var(--board); box-shadow: 0 0 0 10px #1A1812, 0 0 0 11px #3A3427, 0 30px 80px rgba(0, 0, 0, 0.35);
  }
  .device--dark { background: radial-gradient(ellipse at 30% 0%, #3A3020, #12100B 70%); color: #F3ECDC; }
  .device-status { flex: none; position: relative; display: flex; align-items: center; justify-content: space-between; height: 50px; padding: 14px 30px 0 34px; font-size: 15px; z-index: 2; }
  .device-island { position: absolute; left: 50%; top: 11px; width: 120px; height: 34px; border-radius: 17px; background: #000; transform: translateX(-50%); }
  .device-icons { display: flex; gap: 6px; }
  @media (max-width: 520px) {
    .device-stage { padding: 0; place-items: stretch; background: var(--board); }
    .device { width: 100%; height: auto; border-radius: 0; box-shadow: none; }
    .device-island { display: none; }
    .device-status { height: 36px; padding-top: 6px; }
  }

  .phone-top { flex: none; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 2px 14px 6px 20px; }
  .phone-top--sub { min-height: 42px; }
  .phone-title { flex: 1; font-size: 1.875rem; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
  .phone-back { display: inline-flex; align-items: center; gap: 2px; margin-left: -8px; height: 40px; padding: 0 8px 0 2px; font-size: var(--f-4); font-weight: 600; color: var(--ink); }
  /* On the phone, Back lives in the header; a page's own back link is for the desk. */
  .device .phone-scroll .ph-back { display: none; }
  .phone-doors { margin-left: auto; display: flex; align-items: center; gap: 2px; }
  .phone-door { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-soft); }
  .phone-door[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
  .phone-door--snow.is-paused .snowmark { background: var(--st-blocked); color: #fff; }
  .phone-scroll { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 24px; overscroll-behavior: contain; scrollbar-width: none; }
  .phone-scroll::-webkit-scrollbar { display: none; }

  .snowbar { flex: none; display: flex; align-items: center; gap: 10px; height: 48px; margin: 0 12px 8px; padding: 0 14px 0 8px; border-radius: 24px; background: var(--board-soft); border: var(--edge); box-shadow: var(--shadow-stamp); font-size: var(--f-4); font-weight: 600; color: var(--ink-soft); }
  .snowbar > span:not(.snowmark) { flex: 1; }
  .tabbar { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); padding: 4px 6px 22px; border-top: var(--hair); background: color-mix(in srgb, var(--board) 92%, transparent); backdrop-filter: blur(12px); }
  .tab { display: grid; justify-items: center; gap: 2px; padding-top: 6px; font-size: 11px; font-weight: 650; color: var(--ink-faint); }
  .tab[aria-current="page"] { color: var(--ink); }
  .tab-icon { position: relative; }
  .tab-badge { position: absolute; top: -4px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; background: var(--ink); color: var(--ink-inv); font-size: 11px; font-weight: 750; box-shadow: 0 0 0 2px var(--board); }
  .tab-badge.is-alarm { background: var(--alarm-field); color: var(--alarm-ink); }
  @media (max-width: 520px) { .tabbar { padding-bottom: max(10px, env(safe-area-inset-bottom)); } }

  /* ---------- the lock screen ---------- */
  .lock { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 12px 28px; scrollbar-width: none; }
  .lock-time { display: grid; justify-items: center; padding: 10px 0 18px; }
  .lock-time span { font-size: 17px; font-weight: 600; opacity: 0.85; }
  .lock-time b { font-family: var(--font-display); font-size: 88px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-stretch: 85%; }
  .la, .note { display: grid; gap: 6px; padding: 14px 16px; border-radius: 22px; background: rgba(40, 34, 24, 0.66); backdrop-filter: blur(24px); color: #F3ECDC; }
  .la-top, .note-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; opacity: 0.92; }
  .la-top b { margin-left: auto; font-size: 22px; font-weight: 750; }
  .la-top b.is-soon { color: #F2C230; }
  .la-top b.is-late { color: #F0906A; }
  .note-top small { margin-left: auto; opacity: 0.6; font-weight: 500; }
  .la-mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--marigold); color: #211D15; }
  .la-title { font-size: 17px; font-weight: 700; line-height: 1.25; }
  .la-track { position: relative; height: 6px; margin: 6px 0 2px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); }
  .la-track span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: #F2C230; }
  .la-track i { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(242, 194, 48, 0.4); }
  .la-foot { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.75; }
  .note b { font-size: 15px; line-height: 1.3; }
  .note p { font-size: 14px; line-height: 1.35; opacity: 0.86; }
  .note--alarm { background: rgba(120, 44, 12, 0.82); }
  .note--alarm .la-mark { background: #FFF4EC; color: #A8420F; }
  .note-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-top: 4px; }
  .note-actions button { height: 38px; border-radius: 12px; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 14px; font-weight: 650; }
  .note-actions button:first-child { background: rgba(255, 255, 255, 0.92); color: #211D15; }
  .note-actions button.is-stop { background: rgba(240, 144, 106, 0.28); color: #FFD9C7; }
  .note--mode { background: rgba(168, 66, 15, 0.55); }
  .lock-calm { text-align: center; opacity: 0.7; font-size: 14px; padding: 20px; }

  /* ---------- Find ---------- */
  .find-scrim { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; background: rgba(21, 19, 14, 0.36); animation: fade var(--dur-2) var(--ease-snap); }
  .find { width: min(620px, 100%); display: flex; flex-direction: column; max-height: 70vh; background: var(--board-soft); border: var(--edge); border-radius: var(--radius-card); box-shadow: var(--shadow-kiosk); overflow: hidden; animation: rise var(--dur-3) var(--ease-stamp); }
  .find-bar { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: var(--hair); color: var(--ink-soft); }
  .find-input { flex: 1; height: 54px; border: 0; background: transparent; font-size: var(--f-5); outline: none; }
  .find-input:focus-visible { box-shadow: none; }
  .find-list { overflow: auto; padding: 6px; }
  .find-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
  .find-list li.is-on { background: var(--marigold-wash); }
  .find-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius); background: var(--tag); color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line); }
  .find-main { flex: 1; min-width: 0; display: grid; }
  .find-main b { font-size: var(--f-4); font-weight: 650; }
  .find-main small { font-size: var(--f-2); color: var(--ink-soft); }
  .find-kind { font-size: var(--f-1); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
  .find-none { padding: 18px; color: var(--ink-soft); cursor: default; }
  .find-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: var(--hair); font-size: var(--f-2); color: var(--ink-faint); }
  .find-foot span { display: inline-flex; align-items: center; gap: 4px; }

  @keyframes fade { from { opacity: 0; } }
  @keyframes rise { from { transform: translateY(8px) scale(0.99); opacity: 0; } }

  /* View transitions between places: a short cross-fade, nothing that slows a person down. */
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }

  @media (max-width: 900px) {
    .desk, .desk--rail { grid-template-columns: 200px minmax(0, 1fr); }
    .rail { display: none; }
  }
}
