/* app.css: layout per docs/IOS-LAYOUT-STANDARD.md. 390x844 first; desktop centred at 480px. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--cloud); overflow-x: clip; overscroll-behavior-y: none; height: 100%; }
body { margin: 0; background: var(--cloud); color: var(--ink); font: 17px/1.4 var(--font-ui); min-height: 100%; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font-family: var(--font-ui); font-size: 16px; color: var(--ink); }
input, select, textarea { font-size: 16px; }
textarea { resize: vertical; }
a { color: var(--ink); }
[hidden] { display: none !important; }
img, video { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 15px; }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* frame */
#app { max-width: var(--max); margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
#top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: rgba(251, 250, 255, 0.88); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--hair); padding-top: var(--safe-t); }
#top .in { max-width: var(--max); margin: 0 auto; height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 var(--gutter); }
#top h1 { font-size: 22px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance { height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--mint); color: var(--ink); font-weight: 700; font-size: 14px !important; white-space: nowrap; cursor: pointer; position: relative; font-family: inherit; }
.balance.low { background: var(--blush); }
.balance::after { content: ""; position: absolute; inset: -6px; }
.iconbtn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink); position: relative; }
.iconbtn:active { background: var(--mist); }
.iconbtn svg { width: 24px; height: 24px; }
.iconbtn .badge { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--butter); color: var(--ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
#screen { padding: calc(52px + var(--safe-t) + 12px) var(--gutter) calc(var(--tabbar) + var(--safe-b) + 24px); min-height: 100vh; min-height: 100dvh; }
#screen.full { padding-left: 0; padding-right: 0; padding-bottom: calc(var(--tabbar) + var(--safe-b)); }

/* tab bar */
#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: rgba(251, 250, 255, 0.88); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-top: 1px solid var(--hair); padding-bottom: var(--safe-b); }
#tabs .in { max-width: var(--max); margin: 0 auto; display: flex; height: var(--tabbar); }
#tabs button { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 16px; font-weight: 600; cursor: pointer; padding: 0; min-width: 0; }
#tabs button span { font-size: 11px; }
#tabs button svg { width: 24px; height: 24px; }
#tabs button.on { color: var(--ink); }
#tabs button.on svg { filter: drop-shadow(0 0 6px var(--sky)); }
#tabs button .dot { position: absolute; }

/* buttons + fields */
.btn { min-height: 46px; padding: 10px 18px; border-radius: var(--r); border: 1px solid var(--hair); background: var(--mist); color: var(--ink); font-size: 16px; font-weight: 600; cursor: pointer; transition: transform var(--dur-snap) var(--ease-spring), background var(--dur-snap); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--sky); border-color: transparent; }
.btn.mint { background: var(--mint); border-color: transparent; }
.btn.danger { background: var(--blush); border-color: transparent; }
.btn.butter { background: var(--butter); border-color: transparent; }
.btn.lilac { background: var(--lilac); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 44px; padding: 6px 12px; font-size: 16px; }
.btn.sm.change { min-height: 36px; position: relative; }
.btn.sm.change::after, .toggle::after, .ask .compose .suggest::after, .photos .ph button::after { content: ""; position: absolute; inset: -6px; }   /* 44px-ish tap areas on the small controls */
.btn.block { width: 100%; }
.field { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--hair); background: var(--cloud); font-size: 16px; color: var(--ink); outline: none; }
.field:focus { border-color: var(--ink); }
textarea.field { min-height: 96px; line-height: 1.4; }
label.lbl { display: block; font-size: 15px; color: var(--muted); margin: 12px 0 6px; }
.err { color: var(--ink); background: var(--blush); border-radius: 10px; padding: 8px 12px; font-size: 15px; min-height: 1.4em; margin-top: 8px; }
.err:empty { display: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--mist); border-radius: var(--r-lg); padding: 14px 16px; }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--mist); font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0; min-width: fit-content; }
.row > .chip { min-width: fit-content; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills .btn { white-space: nowrap; flex: none; min-width: fit-content; }
.seg { display: flex; background: var(--mist); border-radius: var(--r); padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 11px; background: transparent; font-size: 16px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--cloud); color: var(--ink); box-shadow: 0 1px 4px var(--shadow); }
.toggle { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 16px; background: var(--mist); border: 1px solid var(--hair); position: relative; cursor: pointer; font-size: 16px; flex: none; margin: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--cloud); box-shadow: 0 1px 3px var(--shadow); transition: transform var(--dur) var(--ease-spring); }
.toggle:checked { background: var(--mint); }
.toggle:checked::after { transform: translateX(20px); }
input[type=range] { width: 100%; height: 44px; accent-color: var(--ink); font-size: 16px; margin: 0; }
.setting { padding: 12px 0; border-bottom: 1px solid var(--hair); }
.setting .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.setting .head b { font-weight: 600; }
.setting .val { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.section { margin: 24px 0 8px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; font-size: 15px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--hair); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { position: fixed; top: calc(52px + var(--safe-t)); left: 0; right: 0; z-index: 25; text-align: center; font-size: 13px; padding: 6px; background: var(--butter); }

/* login */
#login { position: fixed; inset: 0; z-index: 40; background: var(--cloud); display: flex; align-items: center; justify-content: center; padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b)); overflow-y: auto; }
#login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
#login h1 { font-size: 34px; margin-bottom: 6px; }
#login input { font-size: 16px; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity var(--dur); }
.sheet.in { opacity: 1; }
.sheet-card { width: 100%; max-width: var(--max); max-height: calc(100dvh - var(--safe-t) - 24px); overflow-y: auto; background: var(--cloud); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 10px var(--gutter) calc(var(--safe-b) + 20px); transform: translateY(40px); transition: transform var(--dur) var(--ease-spring); -webkit-overflow-scrolling: touch; }
.sheet.in .sheet-card { transform: none; }
.sheet-card.drag { transition: none; }
.sheet-head { touch-action: none; cursor: grab; padding: 4px 0 2px; margin: -10px calc(-1 * var(--gutter)) 0; padding-left: var(--gutter); padding-right: var(--gutter); -webkit-user-select: none; user-select: none; }
.sheet-head:active { cursor: grabbing; }
.sheet-card .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--hair); margin: 6px auto 12px; }
.sheet-card h2 { font-size: 20px; margin-bottom: 8px; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-card { border-radius: var(--r-lg); padding-bottom: 20px; max-height: calc(100vh - 48px); } }

/* gates (copied from Payload app.html, retokenised) */
.gate { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; touch-action: manipulation; }
.gate.in { opacity: 1; }
.gate-card { width: 100%; max-width: var(--max); max-height: calc(100dvh - var(--safe-t) - 12px); overflow-y: auto; background: var(--cloud); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 22px var(--gutter) calc(var(--safe-b) + 22px); transform: translateY(30px); transition: transform .25s var(--ease-spring); }
.gate.in .gate-card { transform: none; }
@media (min-width: 700px) { .gate { align-items: center; } .gate-card { border-radius: var(--r-lg); padding-bottom: 22px; } }
.gate-kicker { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.gate-title { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.gate-body { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.gate-label { display: block; color: var(--muted); margin: 6px 0 10px; }
.gate-label code { font-family: var(--font-mono); background: var(--mist); padding: 2px 6px; border-radius: 4px; color: var(--ink); }
.gate-opts { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.gate-opt { display: block; text-align: left; width: 100%; border: 1px solid var(--hair); border-radius: 12px; background: var(--mist); color: var(--ink); padding: 10px 12px; cursor: pointer; font-size: 16px; }
.gate-opt b { display: block; font-weight: 600; }
.gate-opt small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.gate-opt.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.gate-row { display: flex; gap: 10px; margin-top: 18px; }
.gate-row .btn { flex: 1; text-align: center; }
.hold { width: 140px; height: 140px; margin: 6px auto 0; position: relative; display: grid; place-items: center; touch-action: none; cursor: pointer; }
.hold-ring { width: 140px; height: 140px; transform: rotate(-90deg); position: absolute; inset: 0; }
.hold-track { fill: none; stroke: var(--hair); stroke-width: 6; }
.hold-fill { fill: none; stroke: var(--blush); stroke-width: 6; stroke-linecap: round; }
.hold-txt { font-size: 13px; letter-spacing: .2em; color: var(--muted); position: relative; }
.hold.active .hold-txt, .hold.done .hold-txt { color: var(--ink); }
.hold.done .hold-fill { stroke: var(--ink); }
.hold:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 50%; }
.btn:focus-visible, .iconbtn:focus-visible, #tabs button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 16px); transform: translate(-50%, 20px); background: var(--ink); color: var(--cloud); padding: 12px 16px 14px; border-radius: 14px; width: min(92vw, 420px); font-size: 15px; line-height: 1.35; z-index: 70; opacity: 0; transition: all .25s var(--ease-spring); pointer-events: none; display: flex; gap: 12px; align-items: center; box-shadow: 0 10px 30px var(--shadow); }
#toast.in { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast > span { flex: 1; min-width: 0; }
#toast button { flex: none; background: var(--butter); color: var(--ink); border: 0; border-radius: 10px; padding: 8px 12px; font-size: 16px; font-weight: 700; min-height: 38px; }
#toast .bar { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 3px; border-radius: 2px; background: var(--butter); transform-origin: left; }

/* deck */
/* deck screens: the card takes whatever height is left after the purpose line, the three buttons and the hint, so those never fall under the tab bar */
#screen.deckscreen { display: flex; flex-direction: column; height: 100dvh; box-sizing: border-box; min-height: 0; overflow-y: auto; }
.deck { position: relative; flex: 1; min-height: 240px; margin: 0 var(--gutter); touch-action: none; }
.decide { display: flex; gap: 8px; justify-content: center; margin: 10px var(--gutter) 0; }
.decide .btn { flex: 1; min-height: 40px; padding: 6px 4px; font-size: 16px; border-color: transparent; white-space: nowrap; min-width: 0; }
.decide .btn.trash { background: var(--blush); } .decide .btn.redo { background: var(--butter); } .decide .btn.keep { background: var(--mint); }
.decide .btn kbd { display: none; font-family: var(--font-ui); font-size: 12px; color: var(--muted); font-weight: 600; }
@media (min-width: 821px) { .decide { margin-top: 14px; } .decide .btn { min-height: 48px; font-size: 17px; } .decide .btn kbd { display: inline; } }
.deck-card { position: absolute; inset: 0; background: var(--mist); border-radius: var(--r-lg); box-shadow: 0 8px 30px var(--shadow); overflow: hidden; display: flex; flex-direction: column; will-change: transform; user-select: none; -webkit-user-select: none; }
.deck-card.anim { transition: transform var(--dur) var(--ease-spring), opacity var(--dur); }
.deck-card .glow { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity 80ms; z-index: 2; }
.deck-card .glow.keep { background: var(--mint); } .deck-card .glow.trash { background: var(--blush); } .deck-card .glow.redo { background: var(--butter); }
.deck-card .glow b { position: absolute; top: 24px; font-size: 22px; letter-spacing: .12em; padding: 6px 14px; border: 3px solid var(--ink); border-radius: 12px; }
.deck-card .glow.keep b { left: 24px; } .deck-card .glow.trash b { right: 24px; } .deck-card .glow.redo b { left: 50%; transform: translateX(-50%); }
.deck-card .media { flex: 1; min-height: 0; background: var(--ink); display: grid; place-items: center; position: relative; overflow: hidden; }
.deck-card .media img, .deck-card .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }   /* absolute so the picture can never grow the box past its cap */
.deck-card .media .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; background: var(--cloud); display: grid; place-items: center; opacity: .92; }
.deck-card .body { padding: 12px 16px 14px; overflow-y: auto; flex: none; max-height: 45%; touch-action: none; -webkit-overflow-scrolling: touch; }
.deck-card.cap .media { flex: 0 0 auto; height: 55%; max-height: 55%; }
.deck-card.cap .body { flex: 1; min-height: 0; max-height: none; }
.deck-card.cap .strip { flex: 0 0 auto; height: 55%; max-height: 55%; align-items: stretch; }
.deck-card.cap .strip img { width: auto; height: 100%; aspect-ratio: auto; max-width: 85%; object-fit: contain; background: var(--ink); }
.deck-card .head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.deck-card .head h3 { font-size: 17px; font-weight: 700; }
.deck-card .why { color: var(--muted); font-size: 14px; line-height: 1.4; margin: 0 0 10px; }
.deck-card .blk { margin-top: 12px; }
.deck-card .blk .lbl2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.deck-card .body p { white-space: pre-wrap; word-break: break-word; }
.deck-card .idea { flex: 1; padding: 20px 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; touch-action: none; }
.deck-card .idea h2 { font-size: 26px; line-height: 1.2; }
.deck-card .stage { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.deck-card .lines { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.deck-card .lines span { display: inline-block; background: var(--butter); padding: 4px 10px; border-radius: 8px; font-weight: 700; align-self: flex-start; white-space: pre-wrap; }
.deck-card .strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px; scroll-snap-type: x mandatory; flex: 1; align-items: center; }
.deck-card .strip img { width: 78%; flex: none; aspect-ratio: 4/5; object-fit: cover; border-radius: 12px; scroll-snap-align: center; }
.deck-card.making { display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.deck-card .progress { height: 4px; border-radius: 2px; background: var(--hair); overflow: hidden; width: 70%; margin: 14px auto 0; }
.deck-card .progress i { display: block; height: 100%; width: 40%; background: var(--sky); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.deck-hint { display: flex; justify-content: space-between; gap: 8px; margin: 8px var(--gutter) 0; font-size: 13px; color: var(--muted); }
body.deck #toast { bottom: calc(var(--tabbar) + var(--safe-b) + 110px); }   /* above the three buttons and the hint */
.selact { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(var(--tabbar) + var(--safe-b) + 8px); z-index: 21; padding: 10px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 30px var(--shadow); }
.graph-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(80%, 320px); text-align: center; color: var(--muted); font-size: 15px; line-height: 1.4; pointer-events: none; }
.deck-card .zoomhint { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; background: var(--cloud); display: grid; place-items: center; opacity: .9; z-index: 3; pointer-events: none; }
.deck-card .zoomhint svg { width: 16px; height: 16px; }
.deck-hint span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.deck-hint .l::before { background: var(--blush); } .deck-hint .u::before { background: var(--butter); } .deck-hint .r::before { background: var(--mint); }

/* ask composer */
.ask { display: flex; flex-direction: column; gap: 12px; }
.ask .q { font-size: 20px; font-weight: 700; line-height: 1.3; }
.ask .opts { display: flex; flex-direction: column; gap: 8px; }
.ask .opts .btn { justify-content: flex-start; text-align: left; background: var(--sky); border-color: transparent; }
.ask .compose { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ask .compose .tabox { position: relative; width: 100%; }
.ask .compose textarea { width: 100%; min-height: 104px; max-height: 260px; font-size: 16px; line-height: 1.4; }
.ask .compose .tabox textarea { padding-top: 46px; }   /* clears the Suggest pill in the top right corner */
.ask .compose .suggest { position: absolute; top: 7px; right: 7px; min-height: 32px; padding: 4px 12px 4px 10px; border-radius: 999px; background: var(--lilac); border-color: transparent; font-size: 16px; gap: 6px; }
.ask .compose .suggest svg { width: 18px; height: 18px; }
.ask .compose .suggest.busy { background: var(--butter); }
.ask .compose .tools { display: flex; gap: 8px; align-items: center; width: 100%; }
.ask .compose .tools .btn.primary { margin-left: auto; min-width: 110px; }
.ask .qhead { font-size: 20px; font-weight: 700; line-height: 1.3; }
.ask .qsub { color: var(--muted); font-size: 15px; }
.ask .files { display: flex; gap: 6px; flex-wrap: wrap; }
.ask .files span { font-size: 13px; background: var(--lilac); padding: 4px 8px; border-radius: 8px; }

/* persona graph */
.graph { position: fixed; inset: 0; z-index: 1; touch-action: none; background: var(--cloud); }
.graph canvas { display: block; width: 100%; height: 100%; }
.graph .fab { position: fixed; right: calc(16px + var(--safe-r)); bottom: calc(var(--tabbar) + var(--safe-b) + 16px); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--sky); box-shadow: 0 8px 24px var(--shadow); font-size: 30px; color: var(--ink); cursor: pointer; z-index: 5; }
.graph .legend { position: fixed; left: calc(16px + var(--safe-l)); bottom: calc(var(--tabbar) + var(--safe-b) + 16px); display: flex; flex-wrap: wrap; gap: 4px; max-width: 60%; z-index: 5; }
.graph .legend .chip { font-size: 11px !important; padding: 2px 8px; white-space: nowrap; cursor: pointer; line-height: 1.6; font-family: inherit; color: var(--ink); position: relative; }
.graph .legend .chip::after { content: ""; position: absolute; inset: -6px; }   /* tap area */
.photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.photos .ph { aspect-ratio: 1; border-radius: 12px; overflow: hidden; position: relative; background: var(--mist); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .ph.doc { display: grid; place-items: center; background: var(--lilac); }
.photos .ph .file { text-align: center; padding: 6px; font-size: 11px; line-height: 1.3; overflow: hidden; }
.photos .ph .file b { display: block; font-size: 14px; margin-bottom: 2px; }
.photos .ph .file span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.photos .ph button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--blush); color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer; }
.photos .add { aspect-ratio: 1; border-radius: 12px; border: 1px dashed var(--hair); background: transparent; font-size: 28px; color: var(--muted); cursor: pointer; }

/* queue */
.qrow { position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--mist); }
.qrow .under { position: absolute; inset: 0; background: var(--blush); display: flex; align-items: center; justify-content: flex-end; padding-right: 20px; font-weight: 700; }
.qrow .face { position: relative; background: var(--mist); display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 8px; will-change: transform; user-select: none; -webkit-user-select: none; }
.qrow .face.anim { transition: transform var(--dur) var(--ease-spring); }
.qrow .handle { width: 32px; align-self: stretch; display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none; flex: none; }
.qrow .txt { flex: 1; min-width: 0; }
.qrow .txt b { display: block; font-weight: 600; }
.qrow .txt p { margin: 2px 0 0; color: var(--muted); font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.qrow .thumbs { display: flex; gap: 4px; margin-top: 6px; }
.qrow .thumbs img, .qrow .thumbs video { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.qrow .check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex: none; margin-top: 4px; display: grid; place-items: center; }
.qrow.sel .check { background: var(--lilac); border-color: var(--ink); }
.qrow.dragging { opacity: .6; }
.qlist { display: flex; flex-direction: column; gap: 10px; }
.selbar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + var(--safe-b)); z-index: 21; background: var(--lilac); padding: 8px var(--gutter); display: flex; gap: 8px; justify-content: center; }
.selbar .btn { flex: 1; max-width: 200px; }

/* vault + lists */
.vrow { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.vrow .th { width: 64px; height: 80px; border-radius: 10px; background: var(--mist); object-fit: cover; flex: none; display: grid; place-items: center; font-size: 22px; overflow: hidden; }
.vrow .th img { width: 100%; height: 100%; object-fit: cover; }
.vrow .txt { flex: 1; min-width: 0; }
.vrow .txt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrow .txt p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.vrow .txt .bad { color: var(--ink); background: var(--blush); padding: 4px 8px; border-radius: 8px; display: inline-block; margin-top: 4px; font-size: 13px; word-break: break-word; }
.vrow .acts { display: flex; flex-direction: column; gap: 6px; flex: none; }
.vrow .acts .btn.sm { min-height: 44px; padding: 4px 10px; font-size: 16px; white-space: nowrap; }
.vrow.tap { cursor: pointer; } .vrow.tap:active { background: var(--mist); }
.vrow .txt .st { display: inline-block; background: var(--butter); padding: 2px 8px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-top: 4px; }
.group summary { cursor: pointer; padding: 10px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
.group summary::-webkit-details-marker { display: none; }
.group summary::after { content: "+"; color: var(--muted); }
.group[open] summary::after { content: "-"; }
.tabs2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px 0 8px; margin-bottom: 8px; }
.tabs2 .hb { display: flex; min-width: 0; }
.tabs2 .hb > .btn { padding-right: 12px; }
.tabs2 button.tab { flex: 1; min-width: 0; min-height: 44px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--hair); background: transparent; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs2 button.tab.on { background: var(--lilac); color: var(--ink); border-color: transparent; }
.tabs2 .hb > .help.xs { top: -2px; right: 6px; }
.subhead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.subhead h2 { font-size: 22px; flex: 1; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; border: 0; background: transparent; font-size: 16px; color: var(--ink); cursor: pointer; }
.tokenbox { font-family: var(--font-mono); font-size: 13px; word-break: break-all; background: var(--mist); padding: 10px 12px; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { * { transition-duration: 1ms !important; animation-duration: 1ms !important; } }

/* purpose lines + help */
.purpose { color: var(--muted); font-size: 15px; line-height: 1.4; margin: 0 0 12px; }
.hrow { display: flex; align-items: center; gap: 6px; }
.hrow h2 { font-size: 22px; } .hrow h3 { font-size: 17px; } .hrow .section { margin: 0; }
.hrow.sect { margin: 24px 0 8px; }
.help { width: 18px; height: 18px; min-width: 18px; padding: 0; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1; display: inline-grid; place-items: center; cursor: pointer; flex: none; vertical-align: middle; -webkit-user-select: none; user-select: none; position: relative; }
.help::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; }   /* 24px tap target */
.help.xs { width: 14px; height: 14px; min-width: 14px; font-size: 10px; border-width: 1px; opacity: .75; }
.help.xs::after { inset: -5px; }
.hb { position: relative; display: inline-flex; flex: none; }
.hb > .help.xs { position: absolute; top: -3px; right: -3px; background: var(--cloud); z-index: 1; }
.hb > .btn { padding-right: 20px; }
.hb > .iconbtn + .help.xs { top: 4px; right: 2px; }
.help:active, .help:focus-visible { background: var(--sky); border-color: var(--ink); color: var(--ink); outline: none; }
.help.light { border-color: var(--cloud); color: var(--cloud); } .help.light:active { background: var(--sky); color: var(--ink); }
.pop-scrim { position: fixed; inset: 0; z-index: 80; background: transparent; }
.pop { position: fixed; z-index: 81; background: var(--cloud); color: var(--ink); border-radius: var(--r); padding: 12px 14px; box-shadow: 0 10px 30px var(--shadow), 0 0 0 1px var(--hair); font-size: 15px; line-height: 1.45; opacity: 0; transform: translateY(4px); transition: opacity var(--dur-snap), transform var(--dur-snap) var(--ease-spring); }
.pop.above { transform: translateY(-4px); } .pop.in { opacity: 1; transform: none; } .pop p { margin: 0; }

/* lightbox */
.zoomable { cursor: zoom-in; }
.lb { position: fixed; inset: 0; z-index: 90; background: var(--cloud); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(56px + var(--safe-t)) 12px calc(24px + var(--safe-b)); opacity: 0; transition: opacity var(--dur); touch-action: pan-y; }
.lb.in { opacity: 1; }
.lb-stage { flex: 1; min-height: 0; width: 100%; max-width: 900px; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); place-items: center; overflow: hidden; } /* definite track so the media's max-height:100% resolves; clip so it can never spill under the caption */
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 12px; box-shadow: 0 8px 30px var(--shadow); background: var(--mist); }
.lb-cap { flex: none; max-width: 640px; width: 100%; margin-top: 12px; text-align: center; font-size: 15px; line-height: 1.45; color: var(--ink); white-space: pre-wrap; max-height: 28vh; overflow-y: auto; }
.lb-dots { display: flex; gap: 6px; margin-top: 10px; } .lb-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--hair); } .lb-dots i.on { background: var(--ink); }
.lb-x { position: fixed; top: calc(8px + var(--safe-t)); right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--mist); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.lb-x svg { width: 22px; height: 22px; }
.lb-count { position: fixed; top: calc(20px + var(--safe-t)); left: 16px; font-size: 13px; color: var(--muted); }
.lb-arrow { position: fixed; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--mist); color: var(--ink); display: grid; place-items: center; cursor: pointer; opacity: .9; }
.lb-arrow.prev { left: 8px; } .lb-arrow.next { right: 8px; } .lb-arrow svg { width: 22px; height: 22px; }
.vrow .th.zoomable img, .vrow .th.zoomable video { pointer-events: none; }
.qrow .thumbs .zoomable, .photos .ph.zoomable img { cursor: zoom-in; }
.graph .purpose { position: fixed; left: 0; right: 0; top: calc(52px + var(--safe-t)); z-index: 4; margin: 0; padding: 8px var(--gutter); max-width: var(--max); margin: 0 auto; background: rgba(251, 250, 255, 0.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 14px; }
.settings-blurb { color: var(--muted); font-size: 14px; margin: 0 0 6px; line-height: 1.4; }
.failed-prev { display: flex; gap: 6px; margin: 6px 0; } .failed-prev img, .failed-prev video { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.graph .fabhelp { position: fixed; right: calc(12px + var(--safe-r)); bottom: calc(var(--tabbar) + var(--safe-b) + 62px); z-index: 6; background: var(--cloud); }
