/* The phone's own screens (native.js): a tab bar, a push-navigation stack per tab, sheets and
   menus over it. Aria, 2026-10-15: "the app of the phone ... has to have its own identity". */
#app { --bg: #f2f2f7; --surface: #ffffff; --surface-2: #e9e9ef; --ink: #1c1c1e; --ink-2: #6c6c72; --ink-3: #9a9aa1;
  --line: rgba(60, 60, 67, .16); --accent: #0a6cff; --accent-soft: rgba(10, 108, 255, .11);
  --good: #1f9d4c; --good-soft: rgba(31, 157, 76, .13); --warn: #c46a00; --warn-soft: rgba(255, 149, 0, .16);
  --bad: #e0332d; --bad-soft: rgba(255, 59, 48, .12); --chrome: rgba(249, 249, 251, .82); --scrim: rgba(0, 0, 0, .3);
  --paper: #ffffff; --field: rgba(118, 118, 128, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px -16px rgba(0, 0, 0, .25);
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --spring: cubic-bezier(.2, .9, .25, 1); color-scheme: light; }
:root[data-theme="dark"] #app { --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --ink: #f5f5f7; --ink-2: #a1a1a8; --ink-3: #75757c;
  --line: rgba(84, 84, 88, .6); --accent: #3b8bff; --accent-soft: rgba(59, 139, 255, .18);
  --good: #3fd17a; --good-soft: rgba(48, 209, 88, .16); --warn: #ffb340; --warn-soft: rgba(255, 159, 10, .17);
  --bad: #ff6961; --bad-soft: rgba(255, 69, 58, .17); --chrome: rgba(22, 22, 24, .82); --scrim: rgba(0, 0, 0, .55);
  --paper: #f4f4f1; --field: rgba(118, 118, 128, .24);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .8); color-scheme: dark; }

body.native-open { overflow: hidden; overscroll-behavior: none; background: var(--native-bg, #000); }
/* manipulation: no double-tap zoom (a double tap on blank space zoomed the page); pinch still works */
#app { touch-action: manipulation; position: fixed; inset: 0; height: var(--app-height, 100dvh); overflow: hidden; background: var(--bg); color: var(--ink);
  font: 400 17px/1.35 var(--ui); letter-spacing: -0.022em; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  isolation: isolate; user-select: none; -webkit-user-select: none; -webkit-text-size-adjust: 100%; }
#app[hidden] { display: none; }
#app *, #app *::before, #app *::after { box-sizing: border-box; }
#app button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; letter-spacing: inherit;
  text-align: inherit; width: auto; min-height: 0; border-radius: 0; }
#app button:focus-visible, #app [tabindex]:focus-visible, #app input:focus-visible, #app textarea:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 10px; }
#app input, #app textarea { font: inherit; padding: 0; margin: 0; width: auto; border: 0; background: none; color: var(--ink); }
#app .sel { -webkit-user-select: text; user-select: text; }
@media (min-width: 600px) { #app .stack, #app .tabbar, #app .sheet { max-width: 520px; margin: 0 auto; } #app .sheet { left: 0; right: 0; } }

/* stacks and views */
#app .stack { position: absolute; inset: 0; }
#app .stack[hidden] { display: none; }
#app .view { position: absolute; inset: 0; background: var(--bg); overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  will-change: transform; overscroll-behavior-y: contain; }
/* room under the content for the tab bar, as the last box in the view: a padding would also push
   every sticky dock and composer up by its height */
#app .view::after { content: ""; display: block; height: calc(var(--tb, 60px) + 36px); }
#app .view.pushed { box-shadow: -12px 0 30px -14px rgba(0,0,0,.35); }
#app .view.under { pointer-events: none; }
#app .navbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); min-height: 44px; transition: background-color .2s, box-shadow .2s; }
#app .navbar.solid { background: var(--chrome); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); box-shadow: 0 .5px 0 var(--line); }
#app .navbar .mini { grid-column: 2; font-weight: 600; font-size: 17px; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .25s var(--spring); white-space: nowrap; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; }
#app .navbar.solid .mini { opacity: 1; transform: none; }
#app .navbar .left { justify-self: start; display: flex; align-items: center; gap: 8px; min-width: 0; }
#app .navbar .right { justify-self: end; display: flex; align-items: center; gap: 14px; }
#app .back { display: flex; align-items: center; gap: 2px; color: var(--accent); font-size: 17px; margin-left: -6px; padding: 6px; white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
#app .back svg { width: 13px; height: 21px; flex: none; }
#app .icon-btn { width: 32px; height: 32px; display: grid; place-items: center; color: var(--accent); }
#app .icon-btn svg { width: 22px; height: 22px; }
#app .text-btn { color: var(--accent); font-size: 17px; }
#app .large { padding: 4px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
#app .large h1 { margin: 0; font: 700 34px/1.12 var(--display); letter-spacing: -0.03em; text-wrap: balance; overflow-wrap: anywhere; }
#app .large h1.small { font-size: 26px; }
#app .large p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }

#app .pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 9px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; white-space: nowrap; }
#app .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
#app .dot.armed { background: var(--good); }
#app .dot.run { background: var(--accent); animation: n-breathe 2.4s ease-in-out infinite; }
@keyframes n-breathe { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 6px transparent; } }
#app .cta { display: inline-grid; place-items: center; height: 32px; padding: 0 15px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; text-align: center; transition: transform .15s var(--spring), opacity .2s; }
#app .cta.big { width: 100%; height: 50px; border-radius: 14px; font-size: 17px; }
#app .cta.stop { background: var(--bad-soft); color: var(--bad); }
#app .cta.green { background: var(--good); }
#app .cta[disabled] { opacity: .45; }
#app .plain { display: block; width: 100%; height: 46px; margin-top: 6px; color: var(--accent); font-weight: 600; text-align: center; }
#app .plain.red { color: var(--bad); }
#app .press:active, #app .cta:active { transform: scale(.96); }

/* lists */
#app .section { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); margin-top: 24px; }
#app .section.tight { margin-top: 8px; }
#app .section > h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 4px 8px; font: 600 20px/1.2 var(--display); letter-spacing: -0.02em; }
#app .section > h2 button { font: 400 15px var(--ui); color: var(--accent); }
#app .caption { margin: 0 4px 7px; color: var(--ink-2); font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; }
#app .foot-note { margin: 7px 4px 0; color: var(--ink-2); font-size: 13px; line-height: 1.4; }
#app .group { background: var(--surface); border-radius: 14px; overflow: hidden; }
#app .row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 11px 16px; background: var(--surface); transition: background-color .15s; text-align: left; }
#app .row + .row::before, #app .swipe + .swipe::before, #app .row + .swipe::before, #app .swipe + .row::before { content: ""; position: absolute; z-index: 1; top: 0; left: var(--inset, 16px); right: 0; height: .5px; background: var(--line); }
#app button.row:active { background: var(--surface-2); }
#app .row .main { flex: 1; min-width: 0; }
#app .row .t { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
#app .row .t.sm { font-size: 15px; }
#app .row .s { color: var(--ink-2); font-size: 15px; line-height: 1.3; margin-top: 2px; overflow-wrap: anywhere; }
#app .row .s.sm { font-size: 13px; }
#app .row .end { color: var(--ink-3); font-size: 15px; display: flex; align-items: center; gap: 6px; flex: none; font-variant-numeric: tabular-nums; text-align: right; }
#app .row .end.col { flex-direction: column; align-items: flex-end; gap: 4px; }
#app .row .end b { color: var(--ink); font: 650 17px var(--rounded); }
#app .chev { width: 8px; height: 13px; color: var(--ink-3); flex: none; }
#app .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
#app .ico svg { width: 18px; height: 18px; }
#app .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 600 14px var(--rounded); letter-spacing: 0; flex: none; }
#app .avatar.sm { width: 32px; height: 32px; font-size: 12px; }
#app .avatar.lg { width: 56px; height: 56px; font-size: 19px; }
#app .search { display: flex; align-items: center; gap: 6px; margin: 2px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); height: 36px; padding: 0 10px; border-radius: 10px; background: var(--field); color: var(--ink-2); }
#app .search input { flex: 1; min-width: 0; font-size: 17px; outline: none; -webkit-user-select: text; user-select: text; }
#app .search input::-webkit-search-cancel-button { -webkit-appearance: none; }
#app .search svg { width: 16px; height: 16px; flex: none; }
#app .switch { position: relative; width: 51px; height: 31px; border-radius: 999px; background: var(--field); flex: none; transition: background-color .25s; }
#app .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 0 0 .5px rgba(0,0,0,.04); transition: transform .35s var(--spring); }
#app .switch[aria-checked="true"] { background: #34c759; }
#app .switch[aria-checked="true"]::after { transform: translateX(20px); }

#app .tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
#app .tag.blue { background: var(--accent-soft); color: var(--accent); }
#app .tag.green { background: var(--good-soft); color: var(--good); }
#app .tag.grey { background: var(--field); color: var(--ink-2); }
#app .tag.orange { background: var(--warn-soft); color: var(--warn); }
#app .tag.red { background: var(--bad-soft); color: var(--bad); }

/* today */
#app .hero { margin: 6px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 18px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; }
#app .hero .n { font: 700 54px/1 var(--rounded); letter-spacing: -0.04em; color: var(--accent); font-variant-numeric: tabular-nums; }
#app .hero .n.zero { color: var(--good); }
#app .hero .l { font-weight: 600; }
#app .hero .m { color: var(--ink-2); font-size: 15px; }
#app .hero .go { grid-row: 1 / span 3; grid-column: 2; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 15px; }
#app .live { margin: 12px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 16px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
#app .live .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; }
#app .live .top span { color: var(--ink-2); font-weight: 400; font-size: 15px; font-variant-numeric: tabular-nums; }
#app .live ol { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
#app .live li { display: flex; gap: 10px; align-items: center; color: var(--ink-3); font-size: 15px; }
#app .live li i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; flex: none; display: grid; place-items: center; }
#app .live li.done { color: var(--ink-2); }
#app .live li.done i { background: var(--good); border-color: var(--good); }
#app .live li.done i::after, #app .ntoast i.ok::after { content: ""; width: 6px; height: 3px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
#app .live li.now { color: var(--ink); font-weight: 600; }
#app .live li.now i { border-color: var(--accent); border-top-color: transparent; animation: n-spin .9s linear infinite; }
@keyframes n-spin { to { transform: rotate(360deg); } }
#app .bar { height: 4px; border-radius: 2px; background: var(--field); overflow: hidden; margin-top: 12px; }
#app .bar b { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .8s var(--spring); }
#app .stages { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
#app .stages::-webkit-scrollbar { display: none; }
#app .stage { flex: none; min-width: 100px; padding: 12px 14px; border-radius: 16px; background: var(--surface); scroll-snap-align: start; text-align: left; }
#app .stage b { display: block; font: 650 26px/1 var(--rounded); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#app .stage span { color: var(--ink-2); font-size: 13px; }
#app .meter { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
#app .ring { width: 52px; height: 52px; flex: none; }
#app .ring circle { fill: none; stroke-width: 6; }
#app .ring .track { stroke: var(--field); }
#app .ring .val { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1s var(--spring); }
#app .mini-bars { display: grid; gap: 8px; padding: 0 16px 14px; }
#app .mini-bars div { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
#app .mini-bars em, #app .hbar { height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; font-style: normal; display: block; }
#app .mini-bars em b, #app .hbar b { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
#app .hbar.warn b { background: var(--warn); }
#app .hbar.good b { background: var(--good); }
#app .feature { padding: 16px; border-radius: 20px; background: linear-gradient(140deg, #0a6cff, #5b5ff0); color: #fff; display: grid; gap: 4px; }
#app .feature.green { background: linear-gradient(140deg, #1f9d4c, #30b0c7); }
#app .feature small { opacity: .85; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
#app .feature b { font: 650 20px/1.2 var(--display); letter-spacing: -0.02em; overflow-wrap: anywhere; }
#app .feature span { opacity: .9; font-size: 15px; }
#app .feature button { justify-self: start; margin-top: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: rgba(255,255,255,.22); color: #fff; font-weight: 600; font-size: 15px; }
#app .feature + .feature { margin-top: 12px; }
#app .timeline { list-style: none; margin: 0; padding: 4px 16px 6px; }
#app .timeline li { position: relative; padding: 8px 0 8px 22px; }
#app .timeline li::before { content: ""; position: absolute; left: 4px; top: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); }
#app .timeline li::after { content: ""; position: absolute; left: 8px; top: 25px; bottom: -9px; width: 1px; background: var(--line); }
#app .timeline li:last-child::after { display: none; }
#app .timeline .t { font-size: 15px; overflow-wrap: anywhere; }
#app .timeline .s { color: var(--ink-2); font-size: 13px; margin-top: 1px; overflow-wrap: anywhere; }
#app .ptr { position: absolute; left: 0; right: 0; top: calc(6px + env(safe-area-inset-top, 0px)); z-index: 6; display: grid; justify-items: center; gap: 4px; pointer-events: none; opacity: 0; color: var(--ink-2); font-size: 13px; }
#app .ptr svg { width: 26px; height: 26px; }
#app .ptr circle { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
#app .ptr.busy svg { animation: n-spin .8s linear infinite; }
#app .ptr.fail { color: var(--bad); }

/* inbox */
#app .swipe { position: relative; overflow: hidden; background: var(--surface); }
#app .swipe .act { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 22px; color: #fff; font-weight: 600; font-size: 15px; visibility: hidden; }
#app .swipe .act.r { justify-content: flex-end; background: var(--accent); }
#app .swipe .act.l { justify-content: flex-start; background: #ff9f0a; }
#app .mail { --inset: 66px; align-items: flex-start; padding: 12px 16px; touch-action: pan-y; will-change: transform; }
#app .mail .who { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 16px; }
#app .mail .who time { color: var(--ink-3); font-weight: 400; font-size: 15px; flex: none; }
#app .mail .who span { display: flex; align-items: center; gap: 6px; min-width: 0; }
#app .mail .u { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; transition: transform .25s var(--spring); }
#app .mail.read .u { transform: scale(0); width: 0; margin-right: -6px; }
#app .mail .pin { color: #ff9f0a; font-size: 12px; }
#app .mail .sub { font-size: 15px; margin-top: 1px; overflow-wrap: anywhere; }
#app .mail.read .sub { color: var(--ink-2); }
#app .mail .pre { color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; overflow-wrap: anywhere; }
#app .thread { display: grid; gap: 10px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
#app .bubble { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 16px; line-height: 1.42; background: var(--surface); justify-self: start; border-bottom-left-radius: 6px; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
#app .bubble.me { white-space: pre-wrap; }
#app .bubble p { margin: 0 0 8px; } #app .bubble ul, #app .bubble ol { margin: 0 0 8px; padding-left: 20px; } #app .bubble h2, #app .bubble h3, #app .bubble h4 { font-size: 16px; margin: 8px 0 4px; }
#app .bubble code { font: 13px ui-monospace, Menlo, monospace; background: var(--field); padding: 1px 4px; border-radius: 4px; }
#app .bubble > :last-child { margin-bottom: 0; }
#app .bubble.me { justify-self: end; background: var(--accent); color: #fff; border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
#app .bubble small { display: block; margin-top: 4px; font-size: 12px; opacity: .7; white-space: normal; }
#app .day { text-align: center; color: var(--ink-3); font-size: 12px; font-weight: 600; margin: 8px 0 2px; }
#app .chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 8px; scrollbar-width: none; }
#app .chips::-webkit-scrollbar { display: none; }
#app .chip { flex: none; height: 32px; padding: 0 13px; border-radius: 999px; background: var(--surface); border: .5px solid var(--line); color: var(--accent); font-size: 15px; font-weight: 500; }
#app .composer { position: sticky; bottom: var(--tb, 60px); margin-top: 18px; padding: 8px 0; background: var(--chrome); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 -.5px 0 var(--line); z-index: 3; }
#app.kb .tabbar { display: none; }
#app.kb .composer, #app.kb .dock { bottom: 0; }
#app.kb .view::after { height: 12px; }
#app .composer .inp { display: flex; gap: 8px; align-items: flex-end; padding: 0 12px; }
#app .composer textarea { flex: 1; min-height: 36px; max-height: 140px; resize: none; padding: 7px 14px; border-radius: 18px; border: .5px solid var(--line); background: var(--surface); font-size: 16px; -webkit-user-select: text; user-select: text; line-height: 1.35; }
#app .send { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; margin-bottom: 2px; }
#app .send:disabled { background: var(--ink-3); }

/* segmented control */
#app .seg { display: flex; padding: 2px; margin: 8px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); border-radius: 9px; background: var(--field); position: relative; }
#app .seg.flush { margin: 0; }
#app .seg button { flex: 1; min-width: 0; height: 30px; border-radius: 7px; font-size: 13.5px; font-weight: 500; position: relative; z-index: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
#app .seg .thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; border-radius: 7px; background: var(--surface); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); transition: transform .35s var(--spring); }
:root[data-theme="dark"] #app .seg .thumb { background: #636366; }
#app .seg button[aria-selected="true"] { font-weight: 600; }

/* packets */
#app .cards { display: grid; gap: 14px; padding: 16px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
#app .card { position: relative; display: block; background: var(--surface); border-radius: 20px; padding: 16px; width: 100%; box-shadow: var(--shadow); transition: transform .25s var(--spring); -webkit-touch-callout: none; text-align: left; }
#app .card.held { transform: scale(.97); }
#app .card .co { color: var(--ink-2); font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#app .card .co span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#app .card .role { margin-top: 4px; font: 650 19px/1.25 var(--display); letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; }
#app .docs { display: flex; gap: 10px; margin-top: 14px; align-items: end; }
#app .thumbnail { width: 62px; height: 88px; border-radius: 6px; background: var(--paper); box-shadow: 0 1px 3px rgba(0,0,0,.2); overflow: hidden; flex: none; display: grid; gap: 3px; align-content: start; padding: 8px 7px; }
#app .thumbnail.img { padding: 0; }
#app .thumbnail img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
#app .thumbnail i { display: block; height: 3px; border-radius: 2px; background: #d5d7dd; }
#app .thumbnail i.h { height: 5px; width: 60%; background: #2f4a7a; }
#app .thumbnail i.s { width: 70%; }
#app .docs .lab { color: var(--ink-2); font-size: 13px; line-height: 1.35; }
#app .card .foot { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
#app .pages { display: grid; gap: 12px; padding: 12px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
#app .page { position: relative; display: block; width: 100%; aspect-ratio: 210 / 297; border-radius: 8px; background: var(--paper); box-shadow: 0 2px 10px rgba(0,0,0,.16); overflow: hidden; }
#app .page img { width: 100%; height: 100%; display: block; object-fit: contain; opacity: 0; transition: opacity .3s; }
#app .page img.on { opacity: 1; }
#app .page .wait { position: absolute; inset: 0; display: grid; place-items: center; color: #8a8a90; font-size: 14px; }
#app .page .n { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 600; }
#app .dock { position: sticky; bottom: calc(var(--tb, 60px) + 14px); display: flex; gap: 10px; padding: 14px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); z-index: 3; pointer-events: none; }
#app .dock > * { pointer-events: auto; }
#app .dock.static { position: static; pointer-events: auto; }
#app .dock .cta { height: 50px; flex: 1; font-size: 17px; border-radius: 14px; box-shadow: 0 8px 20px -10px var(--accent); }
#app .dock .ghost { height: 50px; flex: 1; border-radius: 14px; background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); text-align: center; }
#app .finding { display: flex; gap: 12px; padding: 12px 16px; position: relative; background: var(--surface); }
#app .finding + .finding::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; height: .5px; background: var(--line); }
#app .finding .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font-size: 13px; font-weight: 700; }
#app .finding .q { font-size: 15px; overflow-wrap: anywhere; } #app .finding .why { color: var(--ink-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
#app .prose { padding: 14px 16px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
#app .prose.pre { white-space: pre-wrap; }
#app .prose.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
#app .prose h1, #app .prose h2, #app .prose h3, #app .prose h4 { font: 650 17px/1.3 var(--display); margin: 16px 0 6px; }
#app .prose h1:first-child, #app .prose h2:first-child, #app .prose h3:first-child { margin-top: 0; }
#app .prose p { margin: 0 0 10px; } #app .prose ul, #app .prose ol { margin: 0 0 10px; padding-left: 20px; } #app .prose li { margin: 3px 0; }
#app .prose code { font: 13px ui-monospace, Menlo, monospace; background: var(--field); padding: 1px 5px; border-radius: 5px; }
#app .prose hr { border: 0; height: .5px; background: var(--line); margin: 14px 0; }
#app .more-link { display: block; padding: 0 16px 12px; color: var(--accent); font-size: 15px; }
#app .empty { padding: 40px 30px; text-align: center; color: var(--ink-2); }
#app .empty b { display: block; color: var(--ink); font: 600 20px var(--display); margin-bottom: 4px; }
#app .kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; padding: 14px 16px; background: var(--surface); border-radius: 14px; margin-bottom: 12px; font-size: 15px; }
#app .kv dt { color: var(--ink-2); } #app .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }

/* context menu */
#app .ctx-layer { position: absolute; inset: 0; z-index: 50; display: none; }
#app .ctx-layer.on { display: block; }
#app .ctx-blur { position: absolute; inset: 0; background: rgba(0,0,0,.18); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; transition: opacity .25s; }
#app .ctx-layer.show .ctx-blur { opacity: 1; }
#app .ctx-card { position: absolute; left: 16px; right: 16px; pointer-events: none; transition: transform .4s var(--spring); }
#app .ctx-card .card { box-shadow: 0 20px 50px -10px rgba(0,0,0,.4); }
#app .ctx-menu { position: absolute; left: 16px; width: 250px; background: var(--chrome); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px -10px rgba(0,0,0,.4); transform: scale(.6); opacity: 0; transform-origin: top left; transition: transform .38s var(--spring), opacity .2s; }
#app .ctx-layer.show .ctx-menu { transform: none; opacity: 1; }
#app .ctx-menu button { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 16px; font-size: 17px; position: relative; }
#app .ctx-menu button + button::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: .5px; background: var(--line); }
#app .ctx-menu button:active { background: var(--field); }
#app .ctx-menu .red { color: var(--bad); }

/* sheets */
#app .scrim { position: absolute; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; pointer-events: none; }
#app .scrim.on { pointer-events: auto; }
#app .sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 90%; display: flex; flex-direction: column; padding: 6px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--bg); border-radius: 22px 22px 0 0; transform: translateY(120%); box-shadow: 0 -10px 40px -10px rgba(0,0,0,.35); will-change: transform; }
#app .sheet .body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
#app .grab-area { touch-action: none; padding: 4px 0 12px; flex: none; }
#app .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--ink-3); opacity: .5; margin: 0 auto; }
#app .sheet h3 { margin: 0 4px 4px; font: 650 20px/1.2 var(--display); letter-spacing: -0.02em; overflow-wrap: anywhere; }
#app .sheet p.lead { margin: 0 4px 14px; color: var(--ink-2); font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
#app .sheet .group { margin-bottom: 12px; }

/* charts */
#app .chart { padding: 14px 16px 10px; }
#app .chart svg { width: 100%; height: 150px; display: block; }
#app .chart text { fill: var(--ink-3); font: 10px var(--ui); }
#app .chart .b { fill: var(--accent); }
#app .chart .b.z { fill: var(--field); }
#app .chart .grid { stroke: var(--line); stroke-width: .5; }
#app .big-number { padding: 16px 16px 0; }
#app .big-number b { font: 700 40px/1 var(--rounded); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#app .big-number span { display: block; color: var(--ink-2); font-size: 15px; margin-top: 4px; }
#app .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#app .tile { background: var(--surface); border-radius: 14px; padding: 12px 14px; }
#app .tile b { display: block; font: 650 24px/1.1 var(--rounded); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
#app .tile span { color: var(--ink-2); font-size: 13px; }

/* practice */
#app .qcard { margin: 12px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 22px 20px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); min-height: 240px; display: flex; flex-direction: column; gap: 12px; }
#app .qcard small { color: var(--accent); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
#app .qcard .q { font: 600 21px/1.3 var(--display); letter-spacing: -0.02em; text-wrap: pretty; -webkit-user-select: text; user-select: text; }
#app .qcard ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; line-height: 1.5; -webkit-user-select: text; user-select: text; }
#app .qcard ul[hidden] { display: none; }
#app .dots { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; padding: 0 30px; }
#app .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--field); transition: background-color .2s, transform .3s var(--spring); }
#app .dots i.on { background: var(--accent); transform: scale(1.25); }

/* tab bar */
#app .tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left)); background: var(--chrome);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); box-shadow: 0 -.5px 0 var(--line); }
#app .tab { position: relative; display: grid; justify-items: center; gap: 2px; padding: 5px 0 3px; color: var(--ink-3); font-size: 10.5px; font-weight: 500; letter-spacing: 0; transition: color .2s; text-align: center; }
#app .tab svg { width: 26px; height: 26px; transition: transform .3s var(--spring); }
#app .tab[aria-selected="true"] { color: var(--accent); }
#app .tab:active svg { transform: scale(.86); }
#app .badge { position: absolute; top: 1px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff;
  font: 600 12px/18px var(--ui); letter-spacing: 0; text-align: center; transition: transform .3s var(--spring); }
#app .badge.bump { transform: scale(1.3); }
@media (orientation: landscape) and (max-height: 500px) { #app .tab { grid-auto-flow: column; gap: 6px; align-items: center; font-size: 13px; } #app .tab svg { width: 22px; height: 22px; } #app .badge { left: calc(50% + 2px); } #app .large h1 { font-size: 28px; } }

#app .ntoast { position: absolute; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 60; transform: translate(-50%, -180%);
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--surface); box-shadow: 0 10px 30px -10px rgba(0,0,0,.4), 0 0 0 .5px var(--line);
  font-size: 15px; font-weight: 600; max-width: calc(100% - 32px); transition: transform .5s var(--spring); }
#app .ntoast span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#app .ntoast.on { transform: translate(-50%, 0); }
#app .ntoast i { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; }
#app .ntoast i.ok { background: var(--good); }
#app .ntoast i.bad { background: var(--bad); } #app .ntoast i.bad::after { content: "!"; color: #fff; font-size: 12px; font-weight: 800; }
#app .ntoast i.busy { border: 2px solid var(--accent); border-top-color: transparent; animation: n-spin .8s linear infinite; }
#app .note { margin: 26px 20px 0; color: var(--ink-3); font-size: 13px; text-align: center; line-height: 1.45; }
#app .hint { margin: 10px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 14px; }

/* the Mac's own panel, opened from More: a Done button over the frame */
#mac-done { position: fixed; z-index: 30; top: calc(env(safe-area-inset-top) + 8px); right: max(12px, env(safe-area-inset-right)); width: auto; margin: 0; min-height: 0;
  padding: 7px 14px; border-radius: 999px; font: 600 15px -apple-system, system-ui, sans-serif; background: rgba(28,28,30,.82); color: #fff;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 6px 20px rgba(0,0,0,.3); display: none; }
body.mac-open #mac-done { display: block; }

@media (prefers-reduced-motion: reduce) { #app *, #app *::before, #app *::after { transition-duration: 1ms !important; animation: none !important; } }
