/* Craix Nav — control-room view: opener card, gallery card and the dialog with the three.js scene. */
.cn-scene-block { clear: both; max-width: 560px; margin: 1.5rem auto 2rem; }
.cn-scene__open { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem; width: 100%; padding: .9rem 1rem; font: inherit; text-align: left; color: #d7e4d9; background: linear-gradient(135deg, #04070d, #0d1a24); border: 1px solid #6adb7f55; border-radius: 8px; cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease; }
.cn-scene__open:hover { border-color: #6adb7f; box-shadow: 0 0 18px #6adb7f33; }
.cn-scene__open:focus-visible { outline: 3px solid #6adb7f; outline-offset: 2px; }
.cn-scene__open-icon { width: 96px; height: 48px; color: #6adb7f; }
.cn-scene__open-text strong { display: block; color: #9ff0ad; font-size: 1rem; }
.cn-scene__open-text span { display: block; margin-top: .2rem; color: #a9b6c6; font-size: .85rem; line-height: 1.45; }
.cn-scene__open-cta { padding: .5rem .8rem; white-space: nowrap; color: #04070d; background: #6adb7f; border-radius: 5px; font-size: .9rem; font-weight: 600; }

/* Gallery card variant: looks like the GLB cards, opens the scene dialog instead. */
.model-gallery__card--scene .cn-scene__open--card { display: block; position: relative; width: 100%; padding: 0; background: #04070d; border: 1px solid #6adb7f55; border-radius: 8px; overflow: hidden; }
.model-gallery__card--scene .cn-scene__open--card img { display: block; width: 100%; height: auto; }
.model-gallery__card--scene .cn-scene__open--card .cp-model__label { position: absolute; right: .6rem; bottom: .6rem; padding: .35rem .7rem; color: #04070d; background: #6adb7f; border-radius: 5px; font-size: .85rem; font-weight: 600; }

.cn-scene-dialog { --cn-green: #6adb7f; --cn-gold: #ffd166; --cn-cyan: #4fe3f0; --cn-ink: #04070d; box-sizing: border-box; width: min(1080px, calc(100vw - 16px)); max-width: none; height: min(800px, calc(100vh - 16px)); height: min(800px, calc(100dvh - 16px)); max-height: none; margin: auto; padding: 0; overflow: hidden; color: #e2e8f0; background: var(--cn-ink); border: 1px solid #6adb7f55; border-radius: 10px; box-shadow: 0 24px 90px #000a; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 1rem; line-height: 1.4; text-align: left; }
.cn-scene-dialog[open] { display: flex; flex-direction: column; }
.cn-scene-dialog::backdrop { background: #02050ad9; }
.cn-scene-dialog button { font: inherit; color: inherit; background: transparent; border: 1px solid #6adb7f55; border-radius: 5px; cursor: pointer; }
.cn-scene-dialog :focus-visible { outline: 2px solid var(--cn-gold); outline-offset: 2px; }

.cn-scene__header { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-bottom: 1px solid #6adb7f40; }
.cn-scene__heading { flex: 1 1 auto; min-width: 0; }
.cn-scene__kicker { margin: 0; color: #6adb7fb3; font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; }
.cn-scene-dialog .cn-scene__header h2 { margin: 0; padding: 0; border: 0; color: #9ff0ad; font-family: inherit; font-size: 1.05rem; letter-spacing: .04em; text-shadow: 0 0 8px #6adb7f80; }
.cn-scene__status { display: flex; align-items: center; gap: .45rem; margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: .75rem; font-weight: 700; white-space: nowrap; color: var(--cn-green); }
.cn-scene__led { width: .6rem; height: .6rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.cn-scene__status[data-mode="receive"] { color: var(--cn-gold); }
.cn-scene__status[data-mode="disconnect"] { color: #8fa3c7; }
.cn-scene-dialog .cn-scene__close { flex-shrink: 0; min-width: 40px; min-height: 40px; font-size: 1.05rem; }
.cn-scene-dialog .cn-scene__sound { min-height: 40px; padding: .3rem .7rem; font-size: .8rem; }
.cn-scene-dialog .cn-scene__sound[aria-pressed="true"] { color: var(--cn-ink); background: var(--cn-gold); border-color: var(--cn-gold); }
html:fullscreen .cn-scene-dialog, html:-webkit-full-screen .cn-scene-dialog { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
.cn-scene__legend-intro { margin: 0; padding: 0 .65rem .4rem; color: #9ff0ad; }
.cn-scene__pull { display: block; margin: .25rem 0 .1rem; }
.cn-scene__pull input { width: 100%; height: 18px; margin: 0; accent-color: var(--cn-green); cursor: pointer; }
.cn-scene__pull .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cn-scene__legend summary { user-select: none; }

.cn-scene__stage { position: relative; flex: 1 1 auto; min-height: 220px; overflow: hidden; background: #000; }
.cn-scene__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.cn-scene__loading { position: absolute; inset: auto 0 45%; margin: 0; color: #9ff0ad; text-align: center; font-size: .9rem; }
.cn-scene__stage[aria-busy="false"] .cn-scene__loading { display: none; }
.cn-scene__loading.is-error { color: #f0645f; }
.cn-scene__readout { position: absolute; right: .6rem; top: .6rem; display: grid; gap: .15rem; margin: 0; padding: .45rem .6rem; background: #02050acc; border: 1px solid #6adb7f40; border-radius: 4px; font-family: ui-monospace, Consolas, monospace; font-size: .72rem; pointer-events: none; }
.cn-scene__readout div { display: flex; justify-content: space-between; gap: 1rem; }
.cn-scene__readout dt { color: #8fa3c7; }
.cn-scene__readout dd { margin: 0; color: var(--cn-green); min-width: 3ch; text-align: right; }
.cn-scene__readout div:nth-child(2) dd { color: var(--cn-gold); }
.cn-scene__readout div:nth-child(3) dd { color: #b9c7e6; }

/* In-scene narration and the instrument legend. */
.cn-scene__hud { position: absolute; left: .6rem; top: .6rem; display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; max-width: min(46%, 420px); pointer-events: none; }
.cn-scene__hud > * { pointer-events: auto; }
.cn-scene__phase { position: static; max-width: 100%; margin: 0; padding: .45rem .65rem; color: #f3f7f1; background: #02050acc; border-left: 3px solid var(--cn-green); border-radius: 4px; font-size: .8rem; line-height: 1.45; pointer-events: none; transition: border-color .4s ease; }
.cn-scene__phase[data-tone="warn"] { border-left-color: var(--cn-gold); }
.cn-scene__phase[data-tone="break"] { border-left-color: #f0645f; }
.cn-scene__legend { position: static; max-width: 100%; margin: 0; padding: 0; background: #02050ad9; border: 1px solid #6adb7f40; border-radius: 6px; font-size: .7rem; line-height: 1.35; max-height: calc(100% - 6rem); overflow: auto; }
.cn-scene__legend summary { padding: .4rem .65rem; color: #9ff0ad; font-weight: 600; cursor: pointer; list-style: none; }
.cn-scene__legend summary::before { content: '▸ '; }
.cn-scene__legend[open] summary::before { content: '▾ '; }
.cn-scene__legend dl { margin: 0; padding: 0 .65rem .3rem; }
.cn-scene__legend dl div { margin: 0 0 .35rem; }
.cn-scene__legend dt { color: #d7e4d9; font-weight: 600; letter-spacing: .04em; }
.cn-scene__legend dt span { margin-left: .3rem; color: var(--cn-green); font-family: ui-monospace, Consolas, monospace; font-weight: 400; }
.cn-scene__legend dt s { color: #6f7d99; text-decoration-color: #f0645f; }
.cn-scene__legend dt em { margin-left: .3rem; padding: 0 .35rem; color: var(--cn-cyan); border: 1px solid #4fe3f066; border-radius: 3px; font-size: .62rem; font-style: normal; letter-spacing: .06em; text-transform: uppercase; }
.cn-scene__legend dd { margin: .1rem 0 0; color: #a9b6c6; }
.cn-scene__legend > p { margin: 0; padding: .2rem .65rem .5rem; color: #a9b6c6; }

/* Narrowing of the field, the balance scope and the star's nature switch. */
.cn-scene__vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at 52% 42%, rgba(4,7,13,0) 28%, rgba(4,7,13,.55) 58%, rgba(4,7,13,.96) 100%); pointer-events: none; transition: opacity .3s linear; }
.cn-scene__scope { position: absolute; right: .6rem; top: 6.6rem; width: 120px; margin: 0; padding: .3rem; background: #02050acc; border: 1px solid #6adb7f40; border-radius: 4px; pointer-events: none; }
.cn-scene__scope svg { display: block; width: 100%; height: auto; font-family: system-ui, sans-serif; }
.cn-scene__scope figcaption { margin: .25rem 0 0; color: #8fa3c7; font-size: .6rem; line-height: 1.3; }
.cn-scene__phase[data-tone="open"] { border-left-color: var(--cn-cyan); }
.cn-scene__legend dt em.is-old { color: #f0645f; border-color: #f0645f66; }
.cn-scene__nature { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; font-size: .78rem; color: #a9b6c6; }
.cn-scene__nature button { min-height: 36px; padding: .3rem .6rem; font-size: .78rem; }
.cn-scene__nature button[aria-pressed="true"] { color: var(--cn-ink); background: var(--cn-gold); border-color: var(--cn-gold); }
.cn-scene__footer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; padding: .5rem .8rem; border-top: 1px solid #6adb7f40; }
.cn-scene-dialog .cn-scene__footer p { flex: 1 1 280px; }
.cn-scene-dialog .cn-scene__fullscreen { min-height: 36px; padding: .3rem .7rem; font-size: .8rem; white-space: nowrap; }
.cn-scene-dialog .cn-scene__fullscreen[aria-pressed="true"] { color: var(--cn-ink); background: var(--cn-green); border-color: var(--cn-green); }
.cn-scene-dialog:fullscreen { width: 100%; height: 100%; max-width: none; max-height: none; border: 0; border-radius: 0; }
.cn-scene-dialog:fullscreen .cn-scene__stage { min-height: 0; }
.cn-scene__lever { display: flex; gap: .3rem; flex-wrap: wrap; }
.cn-scene__lever button { min-height: 36px; padding: .3rem .7rem; font-size: .8rem; }
.cn-scene__lever button[aria-pressed="true"] { color: var(--cn-ink); background: var(--cn-green); border-color: var(--cn-green); }
.cn-scene__lever .cn-scene__auto[aria-pressed="true"] { color: var(--cn-ink); background: var(--cn-gold); border-color: var(--cn-gold); }
.cn-scene-dialog .cn-scene__footer p { margin: 0; color: #a9b6c6; font-size: .78rem; line-height: 1.4; }
.cn-scene-dialog .cn-scene__reset, .cn-scene-dialog .cn-scene__retry { min-height: 36px; padding: .3rem .7rem; font-size: .8rem; white-space: nowrap; }
@media (max-width: 720px) {
    .cn-scene__open { grid-template-columns: 1fr; }
    .cn-scene__open-icon { display: none; }
    .cn-scene-dialog .cn-scene__footer p, .cn-scene__nature { flex-basis: 100%; }
    .cn-scene__scope { display: none; }
    .cn-scene__readout { font-size: .65rem; }
    .cn-scene__phase { max-width: calc(100% - 9rem); font-size: .72rem; }
    .cn-scene__legend { max-width: calc(100% - 1.2rem); font-size: .68rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cn-scene__open { transition: none; }
}
