/* P. 04 Read anything: the live Sift-OCR app window.
   Layout: switcher bar, then a dark glass window (rail | page viewer | output) with a status foot. */

.demo { --demo-h: clamp(500px, calc(100vh - 300px), 640px); position: relative; isolation: isolate; }
.demo::before { content: ""; position: absolute; z-index: -1; top: -8%; bottom: -14%; left: calc(-1 * var(--gut)); right: calc(-1 * var(--gut)); pointer-events: none;
  background: radial-gradient(42% 46% at 62% 52%, rgba(183, 57, 31, 0.16), transparent 70%), radial-gradient(34% 40% at 24% 60%, rgba(47, 111, 192, 0.09), transparent 72%); }
.demo-head { margin-bottom: clamp(36px, 5vw, 64px); }

/* ---------- sample switcher ---------- */
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px 28px; margin-bottom: 18px; flex-wrap: wrap; }
.demo-switch { position: relative; display: flex; gap: 2px; padding: 5px; border-radius: 18px; background: rgba(255, 255, 255, 0.035); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.04); max-width: 100%; }
.demo-switch__ind { position: absolute; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 13px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.06)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 10px 24px -12px rgba(0, 0, 0, 0.8); transition: transform 0.6s var(--ease-out), width 0.6s var(--ease-out); pointer-events: none; }
.demo-switch__btn { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px 8px 12px; border-radius: 13px; color: var(--fg-3); text-align: left; transition: color 0.35s; flex: none; overflow: hidden; }
.demo-switch__btn:hover { color: var(--fg-2); }
.demo-switch__btn[aria-pressed="true"] { color: var(--fg); }
.demo-switch__btn:focus-visible { outline-offset: -2px; border-radius: 13px; }
.demo-switch__ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
.demo-switch__btn[aria-pressed="true"] .demo-switch__ic { stroke: var(--red-lift); opacity: 1; }
.demo-switch__t { display: flex; flex-direction: column; gap: 3px; font: 500 0.9rem/1.1 var(--f-ui); letter-spacing: -0.005em; white-space: nowrap; }
.demo-switch__t small { font: 400 0.75rem/1.1 var(--f-ui); color: var(--fg-3); letter-spacing: 0; }
.demo-switch__auto { position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px; border-radius: 2px; background: var(--red-lift); transform-origin: left; transform: scaleX(var(--auto, 0)); opacity: 0; transition: opacity 0.3s; }
.demo-switch__btn.is-next .demo-switch__auto { opacity: 0.9; }
.demo-hint { display: flex; align-items: center; gap: 10px; margin: 0; font: 400 0.85rem/1.3 var(--f-ui); color: var(--fg-3); }
.demo-hint__k { width: 18px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px rgba(242, 184, 75, 0.85); background: rgba(242, 184, 75, 0.14); flex: none; }

/* ---------- window ---------- */
.demo-win { position: relative; border-radius: var(--r-lg); background: linear-gradient(180deg, #1C2027, #13161B 34%, #101216);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.075), 0 1px 0 rgba(0, 0, 0, 0.6), 0 50px 120px -40px rgba(0, 0, 0, 0.95), 0 24px 48px -28px rgba(0, 0, 0, 0.7); }
.demo-win::before { content: ""; position: absolute; left: 8%; right: 8%; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent); pointer-events: none; border-radius: 1px; }
.demo-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.demo-ws { display: flex; align-items: center; gap: 0 10px; min-width: 0; font: 500 0.95rem/1.25 var(--f-ui); color: var(--fg); flex-wrap: wrap; }
.demo-ws__av { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font: 600 0.72rem/1 var(--f-ui); letter-spacing: 0.02em; color: var(--fg-2); background: var(--char-2); box-shadow: inset 0 0 0 1px var(--line-2); flex: none; }
.demo-ws__av svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.demo-ws__team { color: var(--fg-3); font-weight: 400; margin-left: -4px; }
.demo-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 13px 0 11px; border-radius: 999px; font: 500 0.84rem/1 var(--f-ui); color: #8DE2C3; background: rgba(35, 134, 107, 0.14); box-shadow: inset 0 0 0 1px rgba(70, 199, 156, 0.32); white-space: nowrap; flex: none; }
.demo-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green-lift); box-shadow: 0 0 0 0 rgba(70, 199, 156, 0.6); animation: demo-live 2.4s infinite; }
@keyframes demo-live { 0% { box-shadow: 0 0 0 0 rgba(70, 199, 156, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(70, 199, 156, 0); } 100% { box-shadow: 0 0 0 0 rgba(70, 199, 156, 0); } }

.demo-body { --pagew: calc((var(--demo-h) - 68px) / 1.29333); display: grid; grid-template-columns: 70px calc(var(--pagew) + 40px) minmax(0, 1fr); gap: 14px; height: var(--demo-h); padding: 14px; }

/* rail */
.demo-rail { position: relative; overflow: hidden; border-radius: 12px; -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent); }
.demo-rail__track { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.demo-thumb { height: 82px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding-top: 6px; }
.demo-thumb__p { position: relative; width: 44px; height: 57px; border-radius: 3px; background: #E9E7E2 center / cover no-repeat; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 14px -6px rgba(0, 0, 0, 0.8); opacity: 0.55; transition: opacity 0.3s, box-shadow 0.3s; }
.demo-thumb__p.is-photo { background-size: cover; }
.demo-thumb span { font: 500 0.72rem/1 var(--f-mono); color: var(--fg-3); font-variant-numeric: tabular-nums; transition: color 0.3s; }
.demo-thumb.is-cur .demo-thumb__p { opacity: 1; box-shadow: 0 0 0 2px var(--red-lift), 0 8px 18px -6px rgba(226, 85, 60, 0.5); }
.demo-thumb.is-cur span { color: var(--fg); }

/* viewer */
.demo-view { position: relative; border-radius: 16px; background: radial-gradient(120% 80% at 50% 0%, #15181E, #0C0E12 70%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 20px 60px -30px rgba(0, 0, 0, 0.9); overflow: hidden; }
.demo-stage { position: absolute; inset: 0; }
.demo-page { position: absolute; left: 0; top: 0; width: 0; height: 0; background: #F4F2EE; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 24px 48px -18px rgba(0, 0, 0, 0.85), 0 6px 14px -6px rgba(0, 0, 0, 0.5); opacity: 0; transform: scale(0.975); transition: opacity 0.5s var(--ease-out), transform 0.7s var(--ease-out); }
.demo-page.is-on { opacity: 1; transform: none; }
.demo-page.is-xfade { transform: none; transition: opacity 0.6s var(--ease-out); }
.demo-page.is-out { opacity: 0; transform: translateY(-10px) scale(0.985); transition-duration: 0.28s; }
.demo-page__img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 2px; }
.demo-page__flick { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; transition: opacity 0.35s; background: #0C0E12; }
.demo-page__flick.is-on { opacity: 1; transition: none; }
.demo-boxes { position: absolute; inset: 0; }

/* highlight boxes on the page */
.demo-box { --c: 21, 23, 27; position: absolute; left: calc(var(--x) * 100% - 3px); top: calc(var(--y) * 100% - 2px); width: calc(var(--w) * 100% + 6px); height: calc(var(--h) * 100% + 4px); border-radius: 3px; padding: 0; background: transparent; opacity: 0; transition: opacity 0.35s, background 0.3s, box-shadow 0.3s; cursor: pointer; }
.demo-box.is-red { --c: 183, 57, 31; }
.demo-box.is-blue { --c: 47, 111, 192; }
.demo-box.is-gold { --c: 205, 140, 22; }
.demo-box.is-neu { --c: 40, 44, 52; }
.demo-box.is-hit { opacity: 1; background: rgba(var(--c), 0.075); box-shadow: inset 0 0 0 1.25px rgba(var(--c), 0.6); animation: demo-hit 1s var(--ease-out); }
.demo-box.is-neu.is-hit { background: rgba(var(--c), 0.035); box-shadow: inset 0 0 0 1px rgba(var(--c), 0.28); }
.demo-box.is-gold.is-hit { background: rgba(242, 184, 75, 0.16); }
@keyframes demo-hit { 0% { background: rgba(var(--c), 0.34); box-shadow: inset 0 0 0 1.5px rgba(var(--c), 1), 0 0 0 5px rgba(var(--c), 0.14); } 100% { } }
.demo-box.is-link, .demo-box:focus-visible { z-index: 3; opacity: 1; background: rgba(var(--c), 0.2); box-shadow: inset 0 0 0 2px rgba(var(--c), 0.95), 0 0 0 4px rgba(var(--c), 0.16); outline: none; }
.demo-box.is-gold.is-link { background: rgba(242, 184, 75, 0.34); }
.demo-box.is-neu.is-link, .demo-box.is-neu:focus-visible { background: rgba(21, 23, 27, 0.1); box-shadow: inset 0 0 0 2px rgba(21, 23, 27, 0.8), 0 0 0 4px rgba(226, 85, 60, 0.18); }
.demo-box.is-pulse::after { content: ""; position: absolute; inset: -2px; border-radius: 5px; box-shadow: 0 0 0 2px rgba(var(--c), 0.95); animation: demo-pulse 0.9s var(--ease-out) 2; pointer-events: none; }
@keyframes demo-pulse { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.08, 1.5); } }
.demo-box__tag { position: absolute; left: -1px; bottom: calc(100% + 4px); padding: 4px 7px; border-radius: 5px; font: 500 0.7rem/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: rgb(var(--c)); white-space: nowrap; opacity: 0; transform: translateY(3px); transition: opacity 0.2s, transform 0.3s var(--ease-out); pointer-events: none; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.5); }
.demo-box.is-gold .demo-box__tag { color: #1B1406; background: #F2B84B; }
.demo-box.is-neu .demo-box__tag { background: #2A2E36; }
.demo-box.is-tagdown .demo-box__tag { bottom: auto; top: calc(100% + 4px); }
.demo-box.is-tagright .demo-box__tag { left: auto; right: -1px; }
.demo-box.is-link .demo-box__tag, .demo-box:focus-visible .demo-box__tag { opacity: 1; transform: none; }

/* reading order (multi-column report) */
.demo-order { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.demo-order__path { fill: none; stroke: rgba(183, 57, 31, 0.5); stroke-width: 1.1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.demo-ord { position: absolute; z-index: 4; width: 17px; height: 17px; margin: -8.5px 0 0 -8.5px; border-radius: 50%; display: grid; place-items: center; font: 600 0.62rem/1 var(--f-mono); color: #fff; background: #B7391F; box-shadow: 0 0 0 2px #F4F2EE, 0 3px 8px -2px rgba(0, 0, 0, 0.4); pointer-events: none; transform: scale(0); transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.demo-ord.is-on { transform: scale(1); }

/* scan line */
.demo-scan { position: absolute; left: 0; top: 0; width: 100%; height: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s; z-index: 5; will-change: transform; }
.demo-scan.is-on { opacity: 1; }
.demo-scan::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--trail, 64px); background: linear-gradient(to top, rgba(226, 85, 60, 0.2), rgba(226, 85, 60, 0)); }
.demo-scan i { position: absolute; left: -9px; right: -9px; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(226, 85, 60, 0.65), #FF6F55 12%, #FF6F55 88%, rgba(226, 85, 60, 0.65)); box-shadow: 0 0 10px rgba(226, 85, 60, 0.9), 0 0 26px rgba(226, 85, 60, 0.45); }
.demo-scan i::before, .demo-scan i::after { content: ""; position: absolute; top: -5px; width: 2px; height: 12px; border-radius: 1px; background: #FF6F55; }
.demo-scan i::before { left: 0; }
.demo-scan i::after { right: 0; }

/* receipt photo + straightening */
.demo-photo { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; transition: opacity 0.5s var(--ease-out); pointer-events: none; }
.demo-photo.is-on { opacity: 1; }
.demo-photo__img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; border-radius: 3px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); transition: clip-path 0.5s var(--ease-out), filter 0.5s; box-shadow: 0 24px 48px -18px rgba(0, 0, 0, 0.85); }
.demo-photo__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.demo-photo__shade { fill: rgba(9, 10, 13, 0.62); opacity: 0; transition: opacity 0.5s; }
.demo-photo.is-shade .demo-photo__shade { opacity: 1; }
.demo-photo__quad { fill: rgba(226, 85, 60, 0.06); stroke: #FF6F55; stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.demo-corner { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; box-shadow: inset 0 0 0 2px #FF6F55, 0 0 0 4px rgba(226, 85, 60, 0.22), 0 0 18px rgba(226, 85, 60, 0.6); background: rgba(11, 13, 16, 0.25); transform: scale(0); opacity: 0; transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s; }
.demo-corner::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: #fff; }
.demo-corner.is-on { transform: scale(1); opacity: 1; }
.demo-corner.is-gone { opacity: 0; transform: scale(0.6); }
.demo-chip { position: absolute; left: 14px; bottom: 14px; z-index: 8; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 9px; border-radius: 999px; font: 500 0.8rem/1 var(--f-ui); color: var(--fg); background: rgba(14, 16, 20, 0.9); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 24px -12px rgba(0, 0, 0, 0.8); opacity: 0; transform: translateY(-6px); transition: opacity 0.35s, transform 0.5s var(--ease-out); pointer-events: none; }
.demo-chip.is-on { opacity: 1; transform: none; }
.demo-chip svg { width: 15px; height: 15px; fill: none; stroke: var(--fg-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 16; transition: stroke-dashoffset 0.5s var(--ease-out) 0.1s, stroke 0.3s; }
.demo-chip.is-ok svg { stroke: var(--green-lift); stroke-dashoffset: 0; }
.demo-chip.is-busy svg { display: none; }
.demo-chip.is-busy::before { content: ""; width: 7px; height: 7px; margin: 0 2px 0 3px; border-radius: 50%; background: var(--red-lift); animation: demo-live-r 1.4s infinite; }
@keyframes demo-live-r { 0% { box-shadow: 0 0 0 0 rgba(226, 85, 60, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(226, 85, 60, 0); } 100% { box-shadow: 0 0 0 0 rgba(226, 85, 60, 0); } }

/* ---------- output ---------- */
.demo-out { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.022); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; container-type: inline-size; }
.demo-tabs { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 12px 0 10px; border-bottom: 1px solid var(--line); }
.demo-tabs__list { position: relative; display: flex; align-self: stretch; }
.demo-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; min-height: 48px; font: 500 0.9rem/1 var(--f-ui); color: var(--fg-3); transition: color 0.25s; }
.demo-tab:hover { color: var(--fg-2); }
.demo-tab[aria-selected="true"] { color: var(--fg); }
.demo-tab:focus-visible { outline-offset: -6px; }
.demo-tab__n { display: none; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 999px; font: 600 0.68rem/18px var(--f-mono); text-align: center; color: var(--fg-2); background: rgba(255, 255, 255, 0.08); font-variant-numeric: tabular-nums; }
.demo-tab__n.is-on { display: inline-block; }
.demo-tab__n.is-bump { animation: demo-bump 0.5s var(--ease-out); }
@keyframes demo-bump { 0% { transform: scale(1.35); background: rgba(242, 184, 75, 0.4); color: #fff; } 100% { transform: none; } }
.demo-tabs__ind { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; border-radius: 2px; background: var(--red-lift); box-shadow: 0 0 10px rgba(226, 85, 60, 0.6); transition: transform 0.5s var(--ease-out), width 0.5s var(--ease-out); }
.demo-aside [hidden] { display: none !important; }
.demo-aside { display: flex; align-items: center; gap: 8px; flex: none; }
.demo-aside__fmt { font: 500 var(--t-label)/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); }
.demo-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px var(--line); }
.demo-seg button { min-height: 30px; padding: 0 10px; border-radius: 7px; font: 500 0.78rem/1 var(--f-ui); color: var(--fg-3); transition: color 0.2s, background 0.2s; }
.demo-seg button:hover { color: var(--fg-2); }
.demo-seg button[aria-pressed="true"] { color: var(--fg); background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.demo-copy { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px 0 10px; border-radius: 9px; font: 500 0.8rem/1 var(--f-ui); color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--line-2); transition: color 0.2s, box-shadow 0.2s, background 0.2s; }
.demo-copy:hover { color: var(--fg); background: rgba(255, 255, 255, 0.05); }
.demo-copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.demo-copy.is-ok { color: var(--green-lift); box-shadow: inset 0 0 0 1px rgba(70, 199, 156, 0.4); }
.demo-panes { position: relative; flex: 1; min-height: 0; }
.demo-pane { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 22px 40px 26px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent; }
.demo-pane[hidden] { display: none; }
.demo-pane:focus-visible { outline-offset: -3px; border-radius: 0 0 14px 14px; }
.demo-pane::-webkit-scrollbar { width: 8px; height: 8px; }
.demo-pane::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.demo-pane.is-swap { animation: demo-swap 0.45s var(--ease-out); }
@keyframes demo-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.demo-empty { margin: 8px 0 0; color: var(--fg-3); font: 400 0.9rem/1.5 var(--f-ui); }
.demo-empty b { color: var(--fg-2); font-weight: 500; }

/* text pane: rendered markdown, streamed */
.demo-pane--text { font: 400 12.75px/1.72 var(--f-mono); color: var(--fg-2); }
.demo-blk { --c: 122, 127, 137; position: relative; margin: 0 0 11px; padding: 1px 0; border-radius: 6px; white-space: pre-wrap; overflow-wrap: break-word; transition: background 0.3s, box-shadow 0.3s; cursor: pointer; }
.demo-blk::before { content: ""; position: absolute; left: -14px; top: 4px; bottom: 4px; width: 2px; border-radius: 2px; background: rgb(var(--c)); opacity: 0; transition: opacity 0.25s; }
.demo-blk.is-red { --c: 226, 85, 60; }
.demo-blk.is-blue { --c: 110, 162, 232; }
.demo-blk.is-gold { --c: 242, 184, 75; }
.demo-blk.is-link, .demo-blk:focus-visible { background: rgba(var(--c), 0.08); box-shadow: 0 0 0 6px rgba(var(--c), 0.08); outline: none; }
.demo-blk.is-link::before, .demo-blk:focus-visible::before { opacity: 1; }
.demo-blk.is-flash { animation: demo-flash 1s var(--ease-out); }
@keyframes demo-flash { 0% { background: rgba(var(--c), 0.24); box-shadow: 0 0 0 6px rgba(var(--c), 0.24); } }
.demo-blk--h1 { color: var(--fg); font-weight: 600; font-size: 13.5px; letter-spacing: 0.01em; margin-top: 2px; }
.demo-blk--h2 { color: var(--fg); font-weight: 600; margin-top: 6px; }
.demo-mk { color: var(--red-lift); font-weight: 600; }
.demo-mk--li { color: var(--fg-3); font-weight: 400; }
.demo-blk--li { padding-left: 2ch; text-indent: -2ch; }
.demo-blk--meta { color: var(--fg-3); }
.demo-blk em { font-style: italic; }
.demo-blk strong { color: var(--fg); font-weight: 600; }
.demo-blk--field strong { color: #F4CF86; }
.demo-blk--sig { color: var(--fg-2); }
.demo-blk--sig::first-line { color: var(--fg); }
.demo-blk.is-merged .demo-join { color: var(--fg-3); }
.demo-cur { display: inline-block; width: 0.6em; height: 1.18em; margin: 0 0 -0.24em 1px; background: var(--red-lift); border-radius: 1px; box-shadow: 0 0 10px rgba(226, 85, 60, 0.7); animation: demo-blink 1.05s steps(1) infinite; }
.demo-cur.is-typing { animation: none; }
@keyframes demo-blink { 50% { opacity: 0; } }
.demo-join { display: inline-block; margin-left: 0.6ch; padding: 0 6px; border-radius: 4px; font: 500 0.66rem/1.55 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); background: rgba(255, 255, 255, 0.06); vertical-align: 1px; white-space: nowrap; text-indent: 0; }

/* inline math */
.demo-mi, .demo-mn, .demo-mo { font-family: 'STIX Two Math', 'STIX Two Text', 'Cambria Math', Cambria, 'Latin Modern Roman', 'Times New Roman', Times, serif; }
.demo-mi { font-style: italic; font-size: 1.12em; color: var(--fg); padding-right: 0.04em; }
.demo-ms { font-family: 'STIX Two Text', Cambria, 'Latin Modern Roman', 'Times New Roman', Times, serif; font-size: 0.78em; vertical-align: -0.28em; line-height: 0; color: var(--fg); }
.demo-ms.is-var { font-style: italic; }

/* display formula */
.demo-blk--formula { margin: 10px 0 16px; padding: 18px 18px 14px; border-radius: 12px; background: linear-gradient(180deg, rgba(242, 184, 75, 0.07), rgba(242, 184, 75, 0.025)); box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.2); white-space: normal; }
.demo-blk--formula::before { left: 0; top: 14px; bottom: 14px; }
.demo-blk--formula.is-link { box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.5), 0 0 0 6px rgba(242, 184, 75, 0.08); }
.demo-math-disp { position: relative; display: flex; align-items: center; justify-content: center; min-height: 86px; padding: 0 64px; }
.demo-math { display: inline-flex; align-items: center; gap: 0; font: 400 27px/1 'STIX Two Math', 'STIX Two Text', 'Cambria Math', Cambria, 'Latin Modern Roman', 'Times New Roman', Times, serif; color: var(--fg); white-space: nowrap; }
.demo-math .demo-mi { font-size: 1em; padding-right: 0.02em; }
.demo-math .demo-ms { font-size: 0.64em; vertical-align: -0.34em; line-height: 1; }
.demo-math .demo-mo { padding: 0 0.24em; color: var(--fg-2); }
.demo-msup-wrap { display: inline-block; white-space: nowrap; line-height: 1; }
.demo-mfrac { display: inline-flex; flex-direction: column; align-items: center; margin: 0 0.12em; vertical-align: middle; }
.demo-mfrac > span { display: block; padding: 0 0.12em; line-height: 1.05; }
.demo-mbar { align-self: stretch; height: 1.5px; margin: 0.12em 0 0.14em; padding: 0 !important; background: currentColor; transform-origin: center; }
.demo-mfence { display: inline-flex; align-items: stretch; }
.demo-mrow { display: inline-flex; align-items: center; padding: 0.06em 0.06em; }
.demo-mparen { display: block; width: 0.42em; flex: none; }
.demo-mparen svg { display: block; width: 100%; height: 100%; overflow: visible; }
.demo-mparen path { fill: none; stroke: currentColor; stroke-width: 1.7; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.demo-math-tag { position: absolute; right: 0; top: 50%; transform: translateY(-50%); font: 400 15px/1 'STIX Two Text', Cambria, 'Latin Modern Roman', 'Times New Roman', Times, serif; color: var(--fg-3); }
.demo-ma { transition: opacity 0.5s var(--ease-out), transform 0.6s var(--ease-out), filter 0.5s; }
.is-anim .demo-ma { opacity: 0; transform: translateY(7px); filter: blur(4px); }
.is-anim .demo-ma.is-on { opacity: 1; transform: none; filter: none; }
.is-anim .demo-mbar.demo-ma { transform: scaleX(0); filter: none; }
.is-anim .demo-mbar.demo-ma.is-on { transform: none; }
.is-anim .demo-mparen.demo-ma { transform: scaleY(0.4); }
.is-anim .demo-mparen.demo-ma.is-on { transform: none; }
.demo-latex { margin-top: 12px; padding-top: 11px; border-top: 1px dashed rgba(242, 184, 75, 0.22); display: flex; gap: 12px; align-items: baseline; font: 400 12px/1.6 var(--f-mono); color: var(--fg-3); }
.demo-latex b { flex: none; font-weight: 500; font-size: var(--t-label); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(242, 184, 75, 0.9); }
.demo-latex code { font: inherit; color: var(--fg-2); overflow-wrap: anywhere; white-space: pre-wrap; }

/* tables (gridlines draw on cell by cell) */
.demo-tbl-wrap.is-scroll:not(.is-end) { -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent); mask-image: linear-gradient(90deg, #000 80%, transparent); }
.demo-tbl-wrap { position: relative; margin: 4px 0 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent; padding-bottom: 2px; white-space: normal; }
.demo-tbl { border-collapse: separate; border-spacing: 0; font: 400 12.25px/1.35 var(--f-mono); color: var(--fg); white-space: nowrap; }
.demo-tbl th, .demo-tbl td { position: relative; padding: 7px 12px; text-align: left; vertical-align: top; }
.demo-tbl th { font-weight: 600; color: var(--fg); transition: background 0.4s; }
.demo-tbl th.is-on { background: rgba(47, 111, 192, 0.2); }
.demo-tbl .is-num { text-align: right; }
.demo-tbl th::before, .demo-tbl td::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(110, 162, 232, 0.42); transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease-out); }
.demo-tbl th::after, .demo-tbl td::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: rgba(110, 162, 232, 0.42); transform: scaleY(0); transform-origin: top; transition: transform 0.45s var(--ease-out); }
.demo-tbl .is-on::before, .demo-tbl .is-on::after { transform: none; }
.demo-tbl tr > .is-on:last-child { box-shadow: inset -1px 0 0 rgba(110, 162, 232, 0.42); }
.demo-tbl tr:last-child > .is-on { box-shadow: inset 0 -1px 0 rgba(110, 162, 232, 0.42); }
.demo-tbl tr:last-child > .is-on:last-child { box-shadow: inset -1px -1px 0 rgba(110, 162, 232, 0.42); }
.demo-tbl tbody tr:nth-child(even) td.is-on { background: rgba(255, 255, 255, 0.018); }
.demo-ghost { visibility: hidden; }
.demo-ct { position: absolute; left: 12px; top: 7px; }
.is-num .demo-ct { left: auto; right: 12px; }
.demo-tbl.is-static .demo-ghost { visibility: visible; }
.demo-tbl.is-static .demo-ct { display: none; }

/* tables pane */
.demo-tcard { margin: 0 0 22px; }
.demo-tcard__h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; font: 500 0.9rem/1.3 var(--f-ui); color: var(--fg); }
.demo-tcard__h span { font: 500 var(--t-label)/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; }
.demo-tcard .demo-tbl th { background: rgba(47, 111, 192, 0.2); }
.demo-code { margin: 0; font: 400 12.25px/1.7 var(--f-mono); color: var(--fg-2); white-space: pre; overflow-x: auto; padding: 14px 16px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 1px var(--line); tab-size: 2; }
.demo-code .k-p { color: var(--fg-3); }
.demo-code .k-q { color: #F2D18B; }
.demo-code .k-c { color: var(--fg-3); }
.demo-code .k-h { color: #9EC0F0; font-weight: 600; }

/* fields pane */
.demo-fields { display: grid; grid-template-columns: minmax(110px, 0.36fr) minmax(0, 1fr); gap: 8px 16px; align-items: center; }
.demo-field { display: contents; }
.demo-field__k { font: 500 var(--t-label)/1.3 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); }
.demo-field__v { --c: 242, 184, 75; position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 36px 9px 16px; border-radius: 10px; font: 400 0.9rem/1.4 var(--f-mono); color: var(--fg); background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--line); overflow-wrap: anywhere; white-space: pre-line; transition: background 0.3s, box-shadow 0.3s; cursor: pointer; }
.demo-field__v::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: rgba(var(--c), 0.25); transition: background 0.3s; }
.demo-field__v::after { content: ""; position: absolute; right: 15px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); transition: background 0.3s, box-shadow 0.3s; }
.demo-field__v.is-done::before { background: rgb(var(--c)); }
.demo-field__v.is-done::after { background: var(--green-lift); box-shadow: 0 0 8px rgba(70, 199, 156, 0.6); }
.demo-field__v.is-done { box-shadow: inset 0 0 0 1px rgba(var(--c), 0.28); }
.demo-field__v.is-fill { animation: demo-fill 0.9s var(--ease-out); }
@keyframes demo-fill { 0% { background: rgba(242, 184, 75, 0.3); box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.9), 0 0 0 4px rgba(242, 184, 75, 0.14); } }
.demo-field__v.is-link, .demo-field__v:focus-visible { background: rgba(var(--c), 0.1); box-shadow: inset 0 0 0 1px rgba(var(--c), 0.7); outline: none; }
.demo-field__t:empty::before { content: ""; display: block; width: 46%; height: 9px; border-radius: 5px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05)); background-size: 200% 100%; animation: demo-shim 1.6s linear infinite; }
@keyframes demo-shim { to { background-position: -200% 0; } }
.demo-field .demo-math { font-size: 19px; }
.demo-field .demo-math-disp { min-height: 0; padding: 0; justify-content: flex-start; }

/* json pane */
.demo-json { margin: 0; font: 400 12.25px/1.7 var(--f-mono); color: var(--fg-2); white-space: pre; counter-reset: ln; }
.demo-json .ln { display: block; padding-left: 3.6em; position: relative; }
.demo-json .ln::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 2.4em; text-align: right; color: rgba(122, 127, 137, 0.55); }
.demo-json .j-k { color: #B9C3D3; }
.demo-json .j-s { color: #F2D18B; }
.demo-json .j-n { color: var(--blue-lift); }
.demo-json .j-b { color: var(--red-lift); }
.demo-json .j-p { color: var(--fg-3); }

/* ---------- foot ---------- */
.demo-foot { display: flex; align-items: center; gap: 14px 18px; min-height: 56px; padding: 8px 10px 8px 18px; border-top: 1px solid var(--line); font: 400 0.84rem/1.2 var(--f-ui); color: var(--fg-3); }
.demo-status { display: inline-flex; align-items: center; gap: 9px; flex: none; color: var(--fg-2); min-width: 9.5em; }
.demo-status__ring { width: 20px; height: 20px; flex: none; overflow: visible; }
.demo-status__dots { fill: none; stroke: var(--red-lift); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 0.1 3.6; transform-origin: 10px 10px; animation: demo-spin 2.4s linear infinite; transition: opacity 0.3s; }
.demo-status__ok { fill: none; stroke: var(--green-lift); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 12; stroke-dashoffset: 12; transition: stroke-dashoffset 0.5s var(--ease-out) 0.1s; }
.demo-status.is-idle .demo-status__dots { stroke: var(--fg-3); animation: none; opacity: 0.6; }
.demo-status.is-done .demo-status__dots { opacity: 0; animation: none; }
.demo-status.is-done .demo-status__ok { stroke-dashoffset: 0; }
@keyframes demo-spin { to { transform: rotate(360deg); } }
.demo-file { flex: none; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.demo-prog { position: relative; flex: 1; min-width: 40px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.09); overflow: visible; }
.demo-prog i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 2px; background: linear-gradient(90deg, rgba(183, 57, 31, 0.9), #FF6F55); transform-origin: left; transform: scaleX(var(--p, 0)); box-shadow: 0 0 10px rgba(226, 85, 60, 0.5); }
.demo-count { flex: none; font: 500 0.84rem/1 var(--f-mono); color: var(--fg); letter-spacing: 0.02em; min-width: 10.5em; text-align: right; }
.demo-replay { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--fg-3); transition: color 0.2s, background 0.2s; }
.demo-replay:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
.demo-replay svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.6s var(--ease-out); }
.demo-replay:hover svg { transform: rotate(-200deg); }
.demo-fine { margin: 16px 0 0; text-align: right; }

/* ---------- container: narrow output ---------- */
@container (max-width: 470px) {
  .demo-pane { padding: 16px 16px 36px 20px; }
  .demo-pane--text { font-size: 12px; }
  .demo-blk::before { left: -11px; }
  .demo-tbl { font-size: 11.5px; }
  .demo-tbl th, .demo-tbl td { padding: 6px 9px; }
  .demo-ct { left: 9px; top: 6px; }
  .is-num .demo-ct { right: 9px; }
  .demo-math { font-size: 22px; }
  .demo-math-disp { padding: 0 44px 0 0; justify-content: flex-start; }
  .demo-fields { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .demo-field__k { margin-top: 8px; }
  .demo-tab { padding: 0 9px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .demo-body { --pagew: calc((var(--demo-h) - 64px) / 1.29333); grid-template-columns: 58px calc(var(--pagew) + 40px) minmax(0, 1fr); gap: 12px; padding: 12px; }
  .demo-thumb__p { width: 38px; height: 49px; }
  .demo-thumb { height: 72px; }
  .demo-file { max-width: 22ch; }
  .demo-hint { display: none; }
}
@media (max-width: 1020px) {
  .demo-switch__t small { display: none; }
  .demo-switch__btn { min-height: 46px; padding: 8px 13px 8px 11px; }
}
@media (max-width: 900px) {
  .demo-bar { margin-left: calc(-1 * var(--gut)); margin-right: calc(-1 * var(--gut)); }
  .demo-switch { overflow-x: auto; scrollbar-width: none; border-radius: 16px; margin-inline: var(--gut); scroll-padding-inline: 8px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .demo-switch::-webkit-scrollbar { display: none; }
  .demo-switch.is-end { -webkit-mask-image: none; mask-image: none; }
  .demo-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; height: auto; padding: 10px; gap: 10px; }
  .demo-rail { display: none; }
  .demo-view { aspect-ratio: 1 / 1.2; max-height: 640px; }
  .demo-out { height: 470px; }
  .demo-foot { flex-wrap: wrap; padding: 10px 8px 10px 16px; gap: 8px 14px; }
  .demo-file { order: 5; flex: 1 1 100%; max-width: none; font-size: 0.8rem; color: var(--fg-3); }
  .demo-prog { order: 4; flex: 1 1 100%; }
  .demo-status { flex: 1; min-width: 0; }
  .demo-count { min-width: 0; }
  .demo-fine { text-align: left; }
}
@media (max-width: 560px) {
  .demo-top { padding: 10px 10px 10px 12px; min-height: 0; align-items: flex-start; }
  .demo-ws { font-size: 0.88rem; }
  .demo-ws__av { width: 28px; height: 28px; }
  .demo-ws__team { flex-basis: 100%; margin-left: 38px; font-size: 0.8rem; margin-top: -3px; }
  .demo-ws__team span { display: none; }
  .demo-pill { height: 30px; font-size: 0.76rem; padding: 0 11px 0 9px; gap: 7px; }
  .demo-win { border-radius: 20px; }
  .demo-view { aspect-ratio: 1 / 1.24; border-radius: 12px; }
  .demo-out { height: 440px; border-radius: 12px; }
  .demo-tabs { padding: 0 6px 0 4px; }
  .demo-tab { padding: 0 9px; font-size: 0.86rem; }
  .demo-aside__fmt { display: none; }
  .demo-seg button { padding: 0 8px; }
  .demo-copy { padding: 0 10px; }
  .demo-copy__t { display: none; }
  .demo-copy.is-ok .demo-copy__t { display: inline; }
  .demo-chip { left: 10px; bottom: 10px; }
  .demo-ord { width: 14px; height: 14px; margin: -7px 0 0 -7px; font-size: 0.56rem; }
  .demo-box__tag { font-size: 0.66rem; }
}
@media (max-width: 380px) {
  .demo-tab { padding: 0 7px; }
  .demo-seg button { padding: 0 6px; font-size: 0.74rem; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-pill i, .demo-status__dots, .demo-field__t:empty::before, .demo-cur { animation: none !important; }
}
