/* Verse Demo interface. Tokens, type and rules: docs/VERSE-DEMO.md.
   Two standing rules: no backdrop-filter anywhere (the 3D view behind redraws every frame), and sentence
   case for every label. */

@font-face {
    font-family: "IBM Plex Sans";
    src: url("/VerseServices/Health/fonts/ibm-plex-sans-var-latin.woff2") format("woff2");
    font-weight: 100 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --ink: #111827;          /* dusk ink: panel ground */
    --slate: #1b2436;        /* raised surfaces, inputs */
    --slate-2: #232e45;
    --rule: #2e3a55;         /* hairlines */
    --paper: #f3ead9;        /* lamp paper: text */
    --haze: #a7b2c9;         /* secondary text */
    --sodium: #f2a64c;       /* the one accent */
    --sodium-ink: #1d1407;   /* text on the accent */
    --signal: #ff8370;       /* errors only */
    --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --top: 52px;
    --kb: 0px;               /* height of the on-screen keyboard, set from visualViewport */
    --vvh: 100dvh;           /* height of what is visible above it */
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #070a12; }
body {
    overflow: hidden; color: var(--paper); font-family: var(--font); font-size: 15px; line-height: 1.5;
    -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.vd-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:where(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }
a-scene:focus-visible, .a-canvas:focus-visible { outline: 2px solid var(--sodium); outline-offset: -3px; }

/* The shared pieces this page loads draw blurred glass over the canvas; here they are solid. */
.verse-home-pill, #xrmc-stick, .xrmc-btn { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.verse-home-pill { background: rgba(17, 24, 39, 0.92) !important; }
#xrmc-stick { background: rgba(17, 24, 39, 0.45) !important; }
.xrmc-btn { background: rgba(17, 24, 39, 0.82) !important; font-family: var(--font) !important; letter-spacing: 0 !important; font-weight: 600 !important; }
.xrmc-btn span { text-transform: lowercase; display: inline-block; }
.xrmc-btn span::first-letter { text-transform: uppercase; }
.xrmc-btn.on { background: var(--sodium) !important; border-color: var(--sodium) !important; color: var(--sodium-ink) !important; box-shadow: none !important; }
#xrmc-ui { z-index: 60 !important; }
body.vd-busy #xrmc-ui, body.vd-sheet-open #xrmc-ui, body.vd-sheet-open .vd-prompt { display: none; }

/* ───────────── buttons ───────────── */
.vd-btn {
    min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--rule); background: var(--slate);
    color: var(--paper); font-weight: 500; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    text-decoration: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.vd-btn:hover { background: var(--slate-2); }
.vd-btn:active { transform: translateY(1px); }
.vd-btn.is-primary { background: var(--sodium); border-color: var(--sodium); color: var(--sodium-ink); font-weight: 600; }
.vd-btn.is-primary:hover { background: #f6b565; }
.vd-btn.is-quiet { background: transparent; }
.vd-btn[disabled], .vd-btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }
.vd-btn.is-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.vd-link { color: var(--sodium); text-underline-offset: 3px; }

/* ───────────── top bar ───────────── */
.vd-top {
    position: fixed; z-index: 70; top: 0; left: 0; right: 0; height: calc(var(--top) + var(--sat));
    padding: var(--sat) calc(12px + var(--sar)) 0 calc(70px + var(--sal));
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: linear-gradient(180deg, rgba(7, 10, 18, 0.78), rgba(7, 10, 18, 0));
    pointer-events: none;
}
.vd-top > * { pointer-events: auto; }
.vd-mark { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; margin: 0; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }
.vd-top-actions { display: flex; align-items: center; gap: 6px; }
.vd-top .vd-btn { min-height: 40px; padding: 0 12px; background: rgba(17, 24, 39, 0.9); font-size: 14px; }
.vd-top .vd-btn:hover { background: var(--slate-2); }
.vd-gfx-now { color: var(--haze); font-weight: 400; }
.vd-top .vd-btn[aria-expanded="true"] { border-color: var(--sodium); }
#vd-btn-more { display: none; }

/* graphics menu */
.vd-pop {
    position: fixed; z-index: 90; top: calc(var(--top) + var(--sat) + 4px); right: calc(12px + var(--sar)); width: min(300px, calc(100vw - 24px));
    background: var(--ink); border: 1px solid var(--rule); border-radius: 12px; padding: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    max-height: calc(100dvh - var(--top) - var(--sat) - var(--sab) - 12px); overflow-y: auto; overscroll-behavior: contain;
}
.vd-pop h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.vd-pop p { margin: 0 0 10px; color: var(--haze); font-size: 13px; }
.vd-radio { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px; border-radius: 8px; cursor: pointer; }
.vd-radio:hover { background: var(--slate); }
.vd-radio input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--sodium); flex: none; }
.vd-radio b { display: block; font-weight: 500; }
.vd-radio small { display: block; color: var(--haze); font-size: 13px; line-height: 1.35; }
.vd-pop .vd-meter { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--haze); font-variant-numeric: tabular-nums; }
.vd-pop .vd-more-list { display: grid; gap: 6px; }

/* ───────────── station rail ───────────── */
.vd-rail {
    position: fixed; z-index: 65; left: calc(12px + var(--sal)); top: calc(var(--top) + var(--sat) + 22px);
    width: 172px; max-height: calc(100dvh - var(--top) - 60px); overflow: auto;
    background: rgba(17, 24, 39, 0.8); border: 1px solid rgba(46, 58, 85, 0.9); border-radius: 12px; padding: 6px 6px 6px 0;
}
.vd-rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.vd-rail button {
    width: 100%; min-height: 34px; text-align: left; padding: 6px 10px 6px 12px; border: 0; border-left: 2px solid transparent; border-radius: 0 6px 6px 0;
    background: transparent; color: var(--haze); font-size: 14px; line-height: 1.25; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.vd-rail button:hover { color: var(--paper); background: var(--slate-2); }
.vd-rail button[aria-current="true"] { color: var(--paper); border-left-color: var(--sodium); background: var(--slate); }
.vd-live { font-size: 11px; font-weight: 600; color: var(--sodium); border: 1px solid rgba(242, 166, 76, 0.5); border-radius: 999px; padding: 0 7px; line-height: 18px; white-space: nowrap; }

/* ───────────── prompt, map, toast ───────────── */
.vd-prompt { position: fixed; z-index: 64; left: 50%; bottom: calc(28px + var(--sab)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; }
.vd-prompt .vd-btn { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); white-space: nowrap; }
/* beside an open side panel the prompt keeps to the middle of what is left of the view */
body.vd-panel-open .vd-prompt { left: calc((100vw - min(430px, 100vw - 24px) - 12px - var(--sar)) / 2); }
.vd-key { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--rule); background: var(--ink); color: var(--haze); font-size: 13px; font-weight: 600; }
.vd-map { position: fixed; z-index: 62; right: calc(14px + var(--sar)); bottom: calc(14px + var(--sab)); width: 132px; height: 132px; border-radius: 50%; pointer-events: none; }
.vd-toast {
    position: fixed; z-index: 95; left: 50%; top: calc(var(--top) + var(--sat) + 14px); transform: translateX(-50%); max-width: min(560px, calc(100vw - 28px));
    background: var(--ink); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 14px; font-size: 14px; text-align: left;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}
.vd-toast.is-on { opacity: 1; }
.vd-fade { position: fixed; inset: 0; z-index: 61; background: #070a12; opacity: 0; pointer-events: none; transition: opacity 0.14s linear; }
.vd-fade.is-on { opacity: 1; }

/* ───────────── station panel ───────────── */
.vd-panel {
    position: fixed; z-index: 80; top: calc(var(--top) + var(--sat) + 6px); right: calc(12px + var(--sar)); bottom: calc(12px + var(--sab) + var(--kb));
    width: min(430px, calc(100vw - 24px)); display: flex; flex-direction: column;
    background: var(--ink); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
    animation: vd-in 0.18s ease-out;
}
@keyframes vd-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.vd-panel-head { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 16px 16px 12px 20px; }
.vd-panel-head h2 { margin: 0; font-size: 28px; line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; }
.vd-panel-head p { grid-column: 1; margin: 0; color: var(--haze); font-size: 15px; max-width: 34ch; }
.vd-panel-head .vd-btn { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.vd-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; flex: none; }
.vd-tabs::-webkit-scrollbar { display: none; }
.vd-tab { flex: none; min-height: 44px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--haze); font-size: 15px; font-weight: 500; white-space: nowrap; margin-bottom: -1px; }
.vd-tab:hover { color: var(--paper); }
.vd-tab[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--sodium); }
.vd-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 18px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.vd-body:focus { outline: none; }
.vd-body h3 { margin: 0 0 6px; font-size: 21px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.vd-body h4 { margin: 18px 0 6px; font-size: 15px; font-weight: 600; }
.vd-body p { margin: 0 0 12px; max-width: 62ch; }
.vd-note { color: var(--haze); font-size: 14px; }
.vd-access { border-left: 2px solid var(--sodium); padding: 2px 0 2px 12px; margin: 14px 0; color: var(--paper); font-size: 14px; max-width: 58ch; }
.vd-access b { display: block; font-weight: 600; color: var(--haze); font-size: 13px; }
.vd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.vd-newtab { font-weight: 400; font-size: 12px; opacity: 0.75; }
.vd-divide { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }

/* forms */
.vd-field { display: grid; gap: 6px; margin: 0 0 12px; }
.vd-field > label, .vd-label { font-size: 13px; font-weight: 500; color: var(--haze); }
.vd-input, .vd-select, .vd-text {
    width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--slate); color: var(--paper);
    font-size: 16px; line-height: 1.4;
}
.vd-text { resize: vertical; min-height: 76px; max-height: 40dvh; }
.vd-input::placeholder, .vd-text::placeholder { color: #7f8aa3; }
.vd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vd-row.has-swap { grid-template-columns: 1fr auto 1fr; align-items: end; }
.vd-status { min-height: 21px; margin: 8px 0 0; font-size: 14px; color: var(--haze); }
.vd-status.is-error, .vd-msg.is-error { color: var(--signal); }
.vd-result { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--slate); border: 1px solid var(--rule); font-size: 17px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.vd-result:empty { display: none; }
audio.vd-audio { width: 100%; height: 44px; margin-top: 10px; }

/* chat */
.vd-chat { display: flex; flex-direction: column; min-height: 100%; }
.vd-log { flex: 0 0 auto; display: grid; gap: 10px; align-content: start; margin: 0 0 12px; }
.vd-log:empty { margin: 0; }
.vd-msg { padding: 10px 12px; border-radius: 10px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; max-width: 100%; }
.vd-msg.is-you { background: var(--slate-2); justify-self: end; max-width: 88%; }
.vd-msg.is-ai { background: var(--slate); border: 1px solid var(--rule); }
.vd-msg.is-wait { color: var(--haze); }
.vd-msg.is-error { background: rgba(255, 131, 112, 0.08); border: 1px solid rgba(255, 131, 112, 0.4); }
.vd-msg p { margin: 0 0 8px; } .vd-msg p:last-child { margin-bottom: 0; }
.vd-msg ul, .vd-msg ol { margin: 0 0 8px; padding-left: 20px; }
.vd-msg code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; background: rgba(0, 0, 0, 0.3); padding: 1px 5px; border-radius: 4px; }
.vd-who { display: block; font-size: 12px; font-weight: 600; color: var(--haze); margin-bottom: 2px; }
.vd-starters { display: grid; gap: 6px; margin: 0 0 12px; }
.vd-starters .vd-btn { justify-content: flex-start; text-align: left; height: auto; padding: 9px 12px; font-weight: 400; line-height: 1.35; }
.vd-composer { position: sticky; bottom: -18px; margin: auto -20px -18px; padding: 10px 20px 14px; background: var(--ink); border-top: 1px solid var(--rule); display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.vd-composer .vd-text { min-height: 44px; height: 44px; max-height: 132px; resize: none; }

/* guides */
.vd-guides { display: grid; gap: 8px; margin: 0 0 14px; }
.vd-guide { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--slate); }
.vd-guide b { font-weight: 600; } .vd-guide small { color: var(--haze); font-size: 13px; grid-column: 1; }
.vd-guide .vd-btn { grid-column: 2; grid-row: 1 / span 2; }
.vd-guide.is-here { border-color: var(--sodium); }
.vd-talk { display: flex; flex-direction: column; flex: 1 0 auto; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.vd-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.vd-check input { width: 20px; height: 20px; accent-color: var(--sodium); }
.vd-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.vd-list li { padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; }
.vd-list b { display: block; font-weight: 600; } .vd-list span { color: var(--haze); font-size: 14px; }

/* studio */
.vd-media { display: grid; gap: 14px; margin: 0 0 6px; }
.vd-clip { margin: 0; }
.vd-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #05070c; border: 1px solid var(--rule); padding: 0; }
.vd-frame img, .vd-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.vd-frame video { object-fit: contain; background: #05070c; }
.vd-play { position: absolute; left: 12px; bottom: 12px; min-height: 44px; padding: 0 14px 0 12px; border-radius: 22px; border: 0; background: rgba(17, 24, 39, 0.92); color: var(--paper); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.vd-play::before { content: ""; width: 0; height: 0; border-left: 11px solid var(--sodium); border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
button.vd-frame:hover .vd-play { background: var(--slate-2); }
.vd-clip figcaption { margin-top: 6px; font-size: 13px; color: var(--haze); }
.vd-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vd-pair .vd-frame { aspect-ratio: 4 / 3; }
.vd-tag { position: absolute; left: 8px; top: 8px; font-size: 12px; font-weight: 600; background: rgba(17, 24, 39, 0.9); padding: 2px 8px; border-radius: 6px; }
.vd-sounds { display: grid; gap: 10px; }
.vd-sound { display: grid; gap: 4px; }
.vd-sound span { font-size: 14px; }
.vd-sound audio { width: 100%; height: 40px; }
.vd-inside { margin: 0 0 12px; padding-left: 20px; max-width: 58ch; }
.vd-inside li { margin: 0 0 4px; }

/* ───────────── dialogs ───────────── */
.vd-scrim { position: fixed; inset: 0; z-index: 100; background: rgba(5, 7, 12, 0.7); display: grid; place-items: center; padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
.vd-dialog { width: min(680px, 100%); max-height: min(calc(100dvh - 32px), 760px); display: flex; flex-direction: column; background: var(--ink); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); }
.vd-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--rule); }
.vd-dialog-head h2 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.vd-dialog-body { overflow-y: auto; padding: 14px 22px 20px; overscroll-behavior: contain; }
.vd-dialog-body p { margin: 0 0 12px; max-width: 62ch; }
.vd-dir { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.vd-dir button { width: 100%; text-align: left; min-height: 56px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--rule); background: var(--slate); display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: center; }
.vd-dir button:hover { background: var(--slate-2); border-color: #3d4b6c; }
.vd-dir b { font-weight: 600; font-size: 17px; } .vd-dir small { grid-column: 1; color: var(--haze); font-size: 14px; line-height: 1.35; }
.vd-dir .vd-live { grid-column: 2; grid-row: 1 / span 2; }
.vd-keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 16px; align-items: center; }
.vd-keys dt { display: flex; gap: 4px; flex-wrap: wrap; } .vd-keys dd { margin: 0; }

/* ───────────── veil, lost context, no 3D ───────────── */
.vd-veil { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: radial-gradient(120% 90% at 22% 100%, #5a2d19 0%, #1a2238 38%, #0a0f1d 72%); transition: opacity 0.6s ease, visibility 0.6s; }
.vd-veil.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.vd-veil-box { width: min(420px, calc(100vw - 48px)); }
.vd-veil-title { margin: 0 0 6px; font-size: 44px; line-height: 1.05; font-weight: 600; letter-spacing: -0.03em; }
.vd-veil-line { margin: 0 0 22px; color: var(--haze); font-size: 17px; min-height: 26px; }
.vd-bar { height: 2px; background: rgba(243, 234, 217, 0.16); overflow: hidden; }
.vd-bar i { display: block; height: 100%; width: 8%; background: var(--sodium); transition: width 0.4s ease; }
.vd-notice { position: fixed; z-index: 150; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); background: var(--ink); border: 1px solid var(--rule); border-radius: 14px; padding: 20px 22px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); }
.vd-notice h2 { margin: 0 0 8px; font-size: 21px; font-weight: 600; }
.vd-notice p { margin: 0 0 14px; color: var(--haze); }
body.vd-flat { background: radial-gradient(120% 90% at 22% 100%, #5a2d19 0%, #1a2238 38%, #0a0f1d 72%) fixed; }

/* the scene fills the window; A-Frame positions the canvas */
a-scene { position: fixed; inset: 0; }
.a-canvas { touch-action: none; }
body.vd-grab .a-canvas { cursor: grabbing; }
.a-canvas { cursor: grab; }
body.vd-point .a-canvas { cursor: pointer; }

/* ───────────── compact windows: phones, short windows ───────────── */
@media (max-width: 899px), (max-height: 560px) {
    .vd-rail, .vd-map { display: none; }
    .vd-top { padding-left: calc(66px + var(--sal)); }
}
@media (max-width: 599px) {
    :root { --top: 48px; }
    .vd-mark { font-size: 16px; }
    #vd-btn-gfx, #vd-btn-help, #vd-btn-vr { display: none; }
    #vd-btn-more { display: inline-flex; }
    .vd-top .vd-btn { min-height: 44px; }
    .vd-veil-title { font-size: 36px; }
}
/* a phone held upright: the station panel is a sheet from the bottom, and the keyboard pushes it up */
@media (max-width: 759px) and (orientation: portrait) {
    .vd-panel {
        top: auto; left: 0; right: 0; bottom: var(--kb); width: auto; max-height: min(78dvh, calc(var(--vvh) - var(--top) - 8px));
        height: min(78dvh, calc(var(--vvh) - var(--top) - 8px));
        border-radius: 16px 16px 0 0; border-width: 1px 0 0; padding-bottom: var(--sab);
        animation-name: vd-up;
    }
    @keyframes vd-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
    .vd-panel-head { padding: 14px 12px 10px 16px; }
    .vd-panel-head h2 { font-size: 24px; }
    .vd-body { padding: 14px 16px 16px; }
    .vd-composer { margin: auto -16px -16px; padding: 10px 16px 12px; bottom: -16px; }
    .vd-prompt { bottom: calc(164px + var(--sab)); }
    .vd-scrim { padding: calc(8px + var(--sat)) 8px calc(8px + var(--sab)); align-items: end; }
    .vd-dialog { max-height: calc(100dvh - 16px - var(--sat)); }
    .vd-dialog-head { padding: 14px 12px 10px 16px; } .vd-dialog-body { padding: 12px 16px 16px; }
}
/* a phone held sideways: the panel keeps to the right half so the view stays in sight */
@media (max-height: 560px) and (orientation: landscape) {
    :root { --top: 44px; }
    .vd-panel { top: calc(var(--sat) + 4px); bottom: calc(4px + var(--kb)); right: calc(4px + var(--sar)); width: min(430px, 56vw); border-radius: 12px; }
    .vd-panel-head { padding: 10px 10px 8px 14px; } .vd-panel-head h2 { font-size: 21px; } .vd-panel-head p { display: none; }
    .vd-body { padding: 12px 14px; } .vd-composer { margin: auto -14px -12px; padding: 8px 14px 10px; bottom: -12px; }
    .vd-prompt { bottom: calc(14px + var(--sab)); }
    /* the side panel takes the right half, top to bottom: what it would cover is put away while it is open */
    body.vd-panel-open .vd-prompt { display: none; }
    body.vd-panel-open .vd-top-actions { visibility: hidden; }
    .vd-scrim { padding: 6px; } .vd-dialog { max-height: calc(100dvh - 12px); }
}
@media (pointer: coarse) {
    .vd-key { display: none; }
    body.vd-panel-open .vd-prompt { display: none; }     /* a finger has the panel in front of it; the stick keeps its corner */
    .vd-btn, .vd-btn.is-small, .vd-top .vd-btn { min-height: 44px; }
    .vd-sound audio { height: 44px; }
    .vd-rail button { min-height: 44px; }
    .vd-tab { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .vd-panel { animation: none; }
    .vd-fade, .vd-toast, .vd-veil, .vd-bar i { transition: none; }
    .vd-btn:active { transform: none; }
}
@media (forced-colors: active) {
    .vd-btn, .vd-tab, .vd-rail button { border: 1px solid ButtonText; }
}

/* ───────── try it on the screen (verse-demo-try.js; spec §10: the screen is a real object, the controls its sill) ───────── */
:root { --bronze: #8a6a3a; --sill-h: 124px; }
.vd-try-holder { position: fixed; left: -20000px; top: 0; width: 1280px; height: 760px; overflow: hidden; }
.vd-try { position: fixed; inset: 0; z-index: 85; pointer-events: none; }
.vd-try[hidden] { display: none; }
.vd-try-screen, .vd-sill, .vd-try-list, .vd-try-morelist { pointer-events: auto; }
.vd-try-screen { position: fixed; overflow: hidden; background: var(--ink); }
.vd-try-screen:focus, .vd-try-screen > [tabindex="-1"]:focus { outline: none; }   /* step-up puts the focus on the app's container; the ring belongs to its controls */
.vd-try.is-frame { background: var(--ink); pointer-events: auto; }
.vd-try.is-frame .vd-try-screen { left: var(--sal); right: var(--sar); top: calc(var(--top) + var(--sat)); bottom: calc(var(--sill-h) + var(--sab)); }
.vd-try.is-frame .vd-sill { left: var(--sal); right: var(--sar); bottom: var(--sab); }
.vd-try-back { position: fixed; z-index: 86; top: calc(var(--sat) + 8px); right: calc(var(--sar) + 12px); min-height: 44px; }
.vd-try-back[hidden] { display: none; }
.vd-trying .vd-top, .vd-trying .vd-rail, .vd-trying .vd-map, .vd-trying .vd-prompt, .vd-trying .vd-toast { visibility: hidden; }   /* the terrace's hints would lie over the app */
.vd-trying #xrmc-ui { display: none !important; }

.vd-sill { position: fixed; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; row-gap: 4px; align-items: center;
    padding: 10px 18px 12px; background: var(--ink); border-top: 3px solid var(--bronze); color: var(--paper); font-family: var(--font); }
.vd-sill-main { display: flex; align-items: center; gap: 22px; min-width: 0; }
.vd-sill-app { margin: 0; font-size: 19px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.vd-sill-app:focus { outline: none; }
.vd-sill-app:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }
.vd-sill-tabs { display: flex; gap: 18px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.vd-sill-tabs::-webkit-scrollbar { display: none; }
.vd-sill-tab { appearance: none; background: none; border: 0; border-radius: 0; margin: 0; padding: 12px 0 10px; min-height: 44px; min-width: 44px; flex: none;
    color: var(--haze); font: 500 15px/20px var(--font); cursor: pointer; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; }
.vd-sill-tab[aria-selected="true"] { color: var(--paper); box-shadow: inset 0 -2px 0 var(--sodium); }
.vd-sill-actions { display: flex; align-items: center; gap: 20px; grid-column: 2; grid-row: 1 / span 2; }
.vd-sill-btn { appearance: none; background: none; border: 0; margin: 0; padding: 0 2px; min-height: 44px; min-width: 44px; color: var(--paper); font: 500 15px/20px var(--font); cursor: pointer; white-space: nowrap; }
.vd-sill-btn[hidden], .vd-sill-cta[hidden] { display: none; }
.vd-sill-count { margin-left: 6px; color: var(--haze); font-weight: 400; font-size: 13px; }
.vd-sill-note { grid-column: 1; margin: 0; color: var(--haze); font: 400 13px/18px var(--font); }
/* the line is true only of a practice copy: a live section (Ask, Speak, Translate, a guide) does send what is typed */
.vd-try:not(:has(.vd-try-screen > .vl-mount)) .vd-sill-note, .vd-try:not(:has(.vd-try-screen > .vl-mount)) #vd-try-more { display: none; }
.vd-sill :focus-visible, .vd-try-list :focus-visible, .vd-try-morelist :focus-visible, .vd-try-back:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }
/* a wide window: the quiet actions on one line and the one filled button under them, beside the practice-copy
   line (spec §10.3), so the station's tabs keep the width */
@media (min-width: 760px) and (min-height: 521px) {
    .vd-sill-actions { display: grid; grid-template-columns: repeat(2, auto); justify-content: end; justify-items: end; column-gap: 20px; row-gap: 4px; }
    .vd-sill-cta { grid-column: 1 / -1; }
}

.vd-try-page { position: absolute; inset: 0; overflow: auto; padding: 22px 26px 28px; background: var(--ink); color: var(--paper); font-family: var(--font); }
.vd-try-fail { position: absolute; inset: 0; overflow: auto; padding: 28px; background: var(--ink); color: var(--paper); font-family: var(--font); }
.vd-try-fail-line { margin: 0 0 16px; color: var(--signal); font-size: 19px; line-height: 24px; }
/* the app's card under it opens the real page; the sill's sign-up action stays the only filled button */
.vd-try-fail .vd-btn.is-primary { background: var(--slate); border-color: var(--rule); color: var(--paper); }
.vd-try-fail .vd-btn.is-primary:hover { background: var(--slate-2); }

.vd-try-list, .vd-try-morelist { position: fixed; z-index: 87; width: min(360px, calc(100% - 16px)); max-height: min(60dvh, 480px); overflow: auto;
    padding: 14px 18px 16px; background: var(--slate); border: 1px solid var(--rule); color: var(--paper); font: 400 15px/22px var(--font); }
.vd-try-list[hidden], .vd-try-morelist[hidden] { display: none; }
.vd-try-list h3 { margin: 0 0 8px; font-size: 15px; line-height: 20px; font-weight: 600; }
.vd-try-list h3:focus { outline: none; }
.vd-try-list ul { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.vd-try-list li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; }
.vd-tick { position: relative; width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid var(--haze); border-radius: 50%; }
.is-done > .vd-tick { border-color: var(--sodium); background: var(--sodium); }
.is-done > .vd-tick::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--sodium-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.is-new > .vd-tick::after { animation: vd-tick 0.32s ease-out both; }
@keyframes vd-tick { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.vd-try-done { margin: 4px 0 0; }

/* the replica's frame (the classes discovery-lab.js builds) */
.vd-try .vl-mount, .vd-try-holder .vl-mount { position: absolute; inset: 0; }
.vl-viewport { position: absolute; inset: 0; overflow: hidden; display: grid; place-items: center; background: var(--ink); }
.vl-viewport.is-scroll { overflow: auto; place-items: start; }
.vl-sizer { position: relative; }
.vl-scaler { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.vl-app { position: relative; overflow: hidden; overflow: clip; }
.vl-app .vl-ghost { position: absolute; z-index: 50; pointer-events: none; opacity: 0.92; transform: translate(-50%, -50%); }
/* the tour's target is shown by the halo alone: a sodium ring on it read as a second focus */
@media (forced-colors: active) { .vl-app .vl-target { outline: 2px solid Highlight !important; outline-offset: 2px; } }
.vl-halo { position: absolute; z-index: 60; pointer-events: none; border-radius: 4px; box-shadow: 0 0 0 9999px rgba(17, 24, 39, 0.55); }
.vl-halo[hidden], .vl-coach[hidden] { display: none; }
.vl-coach { position: absolute; z-index: 61; width: 340px; max-width: calc(100% - 16px); padding: 14px 16px 12px; background: var(--slate); border: 1px solid var(--rule);
    color: var(--paper); font: 400 15px/23px var(--font); }
.vl-coach-step { margin: 0 0 2px; color: var(--haze); font-size: 13px; line-height: 18px; }
.vl-coach-title { margin: 0 0 6px; font-size: 15px; line-height: 20px; font-weight: 600; }
.vl-say { margin: 0 0 10px; max-width: 46ch; }
.vl-doit { margin: 0 0 10px; color: var(--haze); }
.vl-doit.is-done { color: var(--sodium); }
.vl-coach-actions { display: flex; gap: 8px; justify-content: flex-end; }
.vl-coach-actions .vl-cbtn:first-child { margin-right: auto; }
.vl-cbtn { min-height: 44px; padding: 0 14px; background: transparent; border: 1px solid var(--rule); border-radius: 6px; color: var(--paper); font: 500 15px/20px var(--font); cursor: pointer; }
.vl-cbtn.is-primary { border-color: var(--haze); font-weight: 600; }   /* Next: unfilled; the sill's sign-up action is the only filled button */
.vl-cbtn:disabled { opacity: 0.45; cursor: default; }
.vl-cbtn:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }
.vl-toasts { position: absolute; z-index: 62; left: 50%; bottom: 14px; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.vl-toast { padding: 8px 14px; background: var(--slate); border: 1px solid var(--rule); color: var(--paper); font: 400 13px/18px var(--font); }
@media (prefers-reduced-motion: reduce) { .is-new > .vd-tick::after { animation: none; } }

/* stepped up: the app lies exactly on the screen; the sill hangs from its bottom edge */
.vd-try.is-screen .vd-try-screen { left: var(--sx); top: var(--sy); width: var(--sw); height: var(--sh); box-shadow: 0 0 0 2px var(--bronze); opacity: 0; transition: opacity 0.18s ease-out; }
.vd-try.is-screen .vd-sill { left: var(--sx); top: calc(var(--sy) + var(--sh)); width: var(--sw); clip-path: inset(0 0 100% 0); transition: clip-path 0.2s ease-out; }
.vd-try.is-screen.is-awake .vd-try-screen { opacity: 1; }
.vd-try.is-screen.is-awake .vd-sill { clip-path: inset(0 0 0 0); }
.vd-try.is-screen:not(.is-awake) .vd-try-screen, .vd-try.is-screen:not(.is-awake) .vd-sill { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .vd-try.is-screen .vd-try-screen, .vd-try.is-screen .vd-sill { transition: none; } }
/* a phone (or any short or narrow window): the app takes the width, the sill becomes the bottom bar */
@media (max-width: 759px), (max-height: 520px) {
    :root { --sill-h: 108px; }
    .vd-sill { grid-template-columns: minmax(0, 1fr); row-gap: 2px; padding: 6px 12px calc(8px + var(--sab)); }
    .vd-sill-main { gap: 14px; }
    .vd-sill-app { font-size: 19px; line-height: 24px; }
    .vd-sill-actions { grid-column: 1; grid-row: auto; gap: 16px; justify-content: space-between; }
    .vd-sill-actions > .vd-sill-btn { flex: none; }   /* a text button keeps its words; the sign-up action wraps instead of covering them */
    .vd-sill > .vd-sill-note { display: none; }
    .vd-try-back { top: calc(var(--sat) + 6px); right: calc(var(--sar) + 8px); }
    .vd-try.is-frame .vd-try-screen { top: calc(56px + var(--sat)); }
}
/* upright on a phone the count has no room beside the sign-up action (spec §10.3 leaves it off there); the list keeps the ticks */
@media (max-width: 759px) and (orientation: portrait) { .vd-sill-count { display: none; } }
/* held sideways and short: the app on the left, the sill a column on the right */
@media (max-height: 520px) and (orientation: landscape) {
    :root { --sill-w: 232px; }
    .vd-try.is-frame .vd-try-screen { top: var(--sat); bottom: var(--sab); right: calc(var(--sill-w) + var(--sar)); }
    .vd-try.is-frame .vd-sill { top: calc(56px + var(--sat)); bottom: 0; left: auto; right: var(--sar); width: var(--sill-w); align-content: start; border-top: 0; border-left: 3px solid var(--bronze); }
    .vd-sill-main { flex-direction: column; align-items: flex-start; gap: 4px; }
    .vd-sill-tabs { gap: 14px; align-self: stretch; max-width: 100%; }
    .vd-sill-actions { flex-direction: column; align-items: stretch; gap: 4px; }
}