/* ==========================================================
   AIRi demo page — animated deepfake-detection pipeline
   The stage is a dark "instrument panel" in both site themes.
   ========================================================== */

.nav__links a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

:root {
  --c-audio: #38bdf8;
  --c-video: #a78bfa;
  --c-lips: #f472b6;
  --c-fuse: #fbbf24;
  --c-xai: #fb923c;
  --c-fake: #f87171;
  --c-real: #34d399;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Above the fold: title bar + stage ---------- */
.wrap--wide { width: min(1600px, 100% - 32px); }
.demo-fold { position: relative; isolation: isolate; overflow-x: clip; padding-bottom: 56px; }
.demo-fold .hero__glow { height: 380px; }
.demo-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 20px 0 16px;
}
.demo-top__title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.demo-top h1 { font-size: clamp(1.45rem, 2.2vw, 2rem); margin: 0; }
.demo-top .links { margin-top: 0; justify-content: flex-start; }
.demo-top__kiosk { display: none; align-items: center; gap: 14px; color: var(--text-3); font: 500 0.9rem/1.2 var(--mono); }
.demo-top__kiosk img { height: 2.5rem; width: auto; padding: 4px 8px; border-radius: 8px; background: var(--logo-bg); }
.how__lead { margin: -16px 0 32px; max-width: 72ch; color: var(--text-2); font-size: 1.05rem; }
.how__lead strong { color: var(--text); font-weight: 600; }

/* ---------- Stage ---------- */

.stage {
  --st-bg: #070b17;
  --st-panel: #0b1225;
  --st-node: #0e1630;
  --st-line: #1c2744;
  --st-text: #e6ebf7;
  --st-text-2: #a3aecb;
  --st-text-3: #6f7a99;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 18px;
  border-radius: 22px;
  background: var(--st-bg);
  color: var(--st-text);
  border: 1px solid #1a2442;
  box-shadow: 0 30px 80px -30px rgba(15, 23, 42, 0.55), 0 2px 6px rgba(15, 23, 42, 0.2);
}
/* drifting dot grid + soft aurora behind everything */
.stage::before,
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.stage::before {
  background-image: radial-gradient(circle, rgba(148, 163, 184, 0.13) 1px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 30%, #000 40%, transparent 100%);
  mask-image: radial-gradient(120% 90% at 50% 30%, #000 40%, transparent 100%);
  animation: grid-drift 18s linear infinite;
}
.stage::after {
  inset: -30%;
  background:
    radial-gradient(28% 26% at 22% 34%, rgba(56, 189, 248, 0.13), transparent 70%),
    radial-gradient(26% 24% at 70% 62%, rgba(167, 139, 250, 0.13), transparent 70%),
    radial-gradient(22% 20% at 86% 22%, rgba(251, 146, 60, 0.09), transparent 70%);
  filter: blur(20px);
  animation: aurora 22s ease-in-out infinite alternate;
}
@keyframes grid-drift { to { background-position: 22px 22px; } }
@keyframes aurora {
  0% { transform: translate3d(-3%, -2%, 0) rotate(0deg); }
  100% { transform: translate3d(3%, 2%, 0) rotate(8deg); }
}

.stage__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.scenes { display: flex; flex-wrap: wrap; gap: 8px; }
.scene-chip {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--st-line);
  background: rgba(14, 22, 48, 0.75);
  color: var(--st-text-2);
  font: 500 0.84rem/1.2 var(--sans);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.scene-chip:hover { color: var(--st-text); border-color: #2c3a62; }
.scene-chip__n {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #18223f;
  font: 600 0.72rem/1 var(--mono);
  color: var(--st-text-2);
}
.scene-chip__bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--chip-c, var(--c-audio));
  transform-origin: left;
  transform: scaleX(0);
}
.scene-chip[aria-pressed="true"] {
  color: var(--st-text);
  border-color: color-mix(in srgb, var(--chip-c) 55%, transparent);
  background: color-mix(in srgb, var(--chip-c) 12%, #0e1630);
}
.scene-chip[aria-pressed="true"] .scene-chip__n { background: var(--chip-c); color: #0b1020; }
.scene-chip:focus-visible,
.stage__toggle:focus-visible,
.listen button:focus-visible { outline: 2px solid var(--c-audio); outline-offset: 2px; }

.stage__toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--st-line);
  background: rgba(14, 22, 48, 0.75);
  color: var(--st-text-2);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.stage__toggle:hover { color: var(--st-text); border-color: #2c3a62; }
.stage__toggle svg { width: 16px; height: 16px; fill: currentColor; }
.stage__toggle .i-play { display: none; }
.stage__toggle[aria-pressed="true"] .i-play { display: block; }
.stage__toggle[aria-pressed="true"] .i-pause { display: none; }

/* ---------- Diagram (SVG) ---------- */
.stage__diagram { position: relative; }
#diagram { display: block; width: 100%; height: auto; overflow: visible; }
#diagram.is-v { max-width: 440px; margin-inline: auto; }
#diagram text { font-family: var(--sans); }

.dg-wire, .dg-node, .dg-label { transition: opacity 0.6s ease; }
.is-off { opacity: 0.22; }

.dg-wire__base { fill: none; stroke: #23304f; stroke-width: 2; }
.dg-wire__glow { fill: none; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 1 1; }
.dg-wire__lit { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1 1; }
.dg-wire__flow { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 2 16; }

.dg-label rect { fill: var(--st-bg); stroke: #1f2a48; }
.dg-label text { fill: var(--st-text-2); font-size: 12px; font-weight: 500; letter-spacing: 0.01em; }
.dg-label.is-weight text { font-family: var(--mono); font-weight: 600; font-size: 12px; }
.dg-label.is-drop text { fill: var(--c-fake); }

.dg-node__box { fill: var(--st-node); stroke: #253257; stroke-width: 1.2; }
.dg-node__halo { fill: none; stroke-width: 8; }
.dg-node__burst { fill: none; stroke-width: 1.5; }
.dg-node__prog { fill: none; stroke-width: 2; stroke-dasharray: 1 1; }
.dg-node__title { fill: var(--st-text); font-size: 14.5px; font-weight: 600; }
.dg-node__sub { fill: var(--st-text-3); font-size: 11px; font-weight: 500; }
.dg-node__icon { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.dg-badge rect { stroke: none; }
.dg-badge text { font-family: var(--mono); font-weight: 600; font-size: 12px; fill: #0b1020; }

.dg-input__box { fill: var(--st-node); stroke: #34436d; stroke-width: 1.4; stroke-dasharray: 5 5; }
.dg-input__cap { fill: var(--st-text-3); font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em; }
.dg-input__name { fill: var(--st-text); font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.dg-input__meta { fill: var(--st-text-3); font-size: 10.5px; }
.dg-input__wait { fill: var(--st-text-3); font-size: 11px; font-style: italic; }

.dg-sigma__glyph { fill: var(--st-text); font-family: var(--serif); font-size: 26px; font-weight: 600; }
.dg-cap { fill: var(--st-text-3); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.dg-gauge__track { fill: none; stroke: #1c2747; stroke-width: 7; }
.dg-gauge__arc { fill: none; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 1 1; }
.dg-gauge__val { fill: var(--st-text); font-family: var(--mono); font-size: 22px; font-weight: 600; }
.dg-gauge__sub { fill: var(--st-text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; }
.dg-verdict text { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; fill: #0b1020; }

#diagram.is-v .dg-node__title { font-size: 12.5px; }
#diagram.is-v .dg-node__sub { font-size: 10px; }
#diagram.is-v .dg-label text { font-size: 11px; }
#diagram.is-v .dg-gauge__val { font-size: 20px; }

/* ---------- Console ---------- */
.console {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  margin: 4px 0 14px;
  padding: 10px 14px;
  height: calc(4 * 1.55em + 20px);
  border-radius: 12px;
  background: rgba(5, 8, 18, 0.72);
  border: 1px solid var(--st-line);
  font: 400 0.8rem/1.55 var(--mono);
  color: var(--st-text-2);
}
.console div { white-space: pre-wrap; overflow-wrap: anywhere; }
.console .is-cmd { color: var(--st-text); }
.console .is-cmd::first-letter { color: var(--c-real); }
.console .is-res { color: var(--c-fuse); }
.console .is-warn { color: var(--c-fake); }
.console .has-caret::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--st-text-2);
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ---------- Inspector ---------- */
.inspector { display: grid; }
.insp {
  grid-area: 1 / 1;
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  background: var(--st-panel);
  border: 1px solid var(--st-line);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s, box-shadow 0.6s, border-color 0.6s;
}
.insp.is-active { opacity: 1; visibility: visible; transition: opacity 0.5s ease, visibility 0s, box-shadow 0.6s, border-color 0.6s; }
.insp.is-glow { border-color: color-mix(in srgb, var(--c-xai) 45%, var(--st-line)); box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.12), 0 0 40px -10px rgba(251, 146, 60, 0.35); }
.insp__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 20px;
  margin-bottom: 12px;
}
.insp__eyebrow {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-xai);
}
.insp--fusion .insp__eyebrow { color: var(--c-fuse); }
.insp h3 { color: var(--st-text); font-size: 1.08rem; font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0; padding: 0; font-size: 0.78rem; color: var(--st-text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.sw--spec { background: linear-gradient(90deg, #1e1b4b, #4338ca, #0ea5e9, #a5f3fc); }
.sw--mask { background: linear-gradient(90deg, #f97316, #fbbf24, #fff7ed); }
.sw--gt { border: 1.5px dashed var(--c-real); background: rgba(52, 211, 153, 0.12); }

.explain { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; }
.spec-wrap { position: relative; height: 290px; }
.spec-wrap canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  counter-reset: step;
  margin: 10px 0 0;
  padding: 0;
}
.steps li {
  counter-increment: step;
  padding: 3px 10px 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--st-line);
  font-size: 0.76rem;
  color: var(--st-text-3);
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  background: #18223f;
  font: 600 0.66rem/1 var(--mono);
}
.steps li.is-done { color: var(--st-text-2); }
.steps li.is-now { color: var(--st-text); border-color: color-mix(in srgb, var(--c-xai) 55%, transparent); background: rgba(251, 146, 60, 0.08); }
.steps li.is-now::before { background: var(--c-xai); color: #0b1020; }

.explain__side { display: flex; flex-direction: column; gap: 12px; }
.mini { margin: 0; }
.mini canvas { display: block; width: 100%; height: 92px; border-radius: 8px; background: #050913; }
.mini figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; margin-top: 6px; }
.mini__name { font-size: 0.8rem; color: var(--st-text-2); }
.mini__name em { font-style: normal; font-family: var(--mono); font-size: 0.74rem; color: var(--st-text-3); }
.chip {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.35s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chip.is-on { opacity: 1; transform: none; }
.chip--fake { background: rgba(248, 113, 113, 0.15); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.4); }
.chip--real { background: rgba(52, 211, 153, 0.13); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.4); }

.listen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; }
.listen__label { flex-basis: 100%; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--st-text-3); }
.listen button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--st-line);
  background: #111a36;
  color: var(--st-text-2);
  font: 500 0.78rem/1.2 var(--sans);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.listen button::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
}
.listen button:hover { color: var(--st-text); border-color: #2c3a62; }
.listen button.is-playing { color: #0b1020; background: var(--c-xai); border-color: var(--c-xai); }
.listen button.is-playing::before { width: 8px; height: 10px; border: 0; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }

/* Fusion panel */
.formula {
  margin: 0;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  font: 500 0.8rem/1.5 var(--mono);
  color: #fde68a;
  transition: background 0.4s, border-color 0.4s, color 0.4s;
}
.formula.is-warn { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.3); color: #fecaca; }
.insp--fusion { display: flex; flex-direction: column; }
.fusion { flex: 1; display: grid; align-content: center; gap: 16px; padding: 4px 2px; }
.fusion__note { margin: 4px 0 0; font-size: 0.82rem; color: var(--st-text-3); line-height: 1.5; }
.fusion__note b { color: var(--st-text-2); font-weight: 600; }
.frow, .ffinal {
  display: grid;
  grid-template-columns: 150px 74px minmax(0, 1fr) 70px;
  align-items: center;
  gap: 14px;
}
.frow { --c: var(--c-audio); }
.frow[data-k="lipsync"] { --c: var(--c-lips); }
.frow[data-k="video"] { --c: var(--c-video); }
.frow__name { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; color: var(--st-text); }
.frow__name i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.frow__w { font: 500 0.8rem/1 var(--mono); color: var(--st-text-3); white-space: nowrap; }
.frow__w b { color: var(--st-text); font-weight: 600; }
.frow__track, .ffinal__track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: #121b38;
  overflow: hidden;
}
.frow__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 35%, transparent), var(--c));
  box-shadow: 0 0 14px var(--c);
}
.frow__thr, .ffinal__thr {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  background: rgba(230, 235, 247, 0.35);
}
.frow__p { font: 600 0.92rem/1 var(--mono); color: var(--st-text); text-align: right; }
.frow.is-dropped .frow__name { color: var(--st-text-3); text-decoration: line-through; text-decoration-color: var(--c-fake); }
.frow.is-dropped .frow__name i { background: var(--st-text-3); box-shadow: none; }
.frow.is-dropped .frow__w b { color: var(--st-text-3); text-decoration: line-through; }
.frow.is-dropped .frow__p { color: var(--c-fake); font-size: 0.76rem; }
.ffinal { margin-top: 6px; padding-top: 14px; border-top: 1px dashed var(--st-line); }
.ffinal__label { grid-column: 1 / 3; font-size: 0.9rem; font-weight: 600; color: var(--c-fuse); }
.ffinal__track { height: 20px; display: flex; overflow: visible; background: #121b38; }
.ffinal__track i { height: 100%; width: 0; flex: none; }
.ffinal__track i:first-child { border-radius: 999px 0 0 999px; }
.ffinal__track i[data-k="lipsync"] { background: var(--c-lips); }
.ffinal__track i[data-k="audio"] { background: var(--c-audio); }
.ffinal__track i[data-k="video"] { background: var(--c-video); }
.ffinal__thr { top: -5px; bottom: -5px; width: 2px; background: var(--st-text); }
.ffinal__thr em {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font: 600 0.66rem/1 var(--mono);
  font-style: normal;
  color: var(--st-text-3);
}
.ffinal__out { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ffinal__out b { font: 600 1.25rem/1 var(--mono); color: var(--st-text); }
.vpill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #0b1020;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vpill.is-on { opacity: 1; transform: none; }
.vpill.is-fake { background: var(--c-fake); box-shadow: 0 0 16px rgba(248, 113, 113, 0.6); }
.vpill.is-real { background: var(--c-real); box-shadow: 0 0 16px rgba(52, 211, 153, 0.6); }

/* ---------- How it works ---------- */
.how {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.how__card {
  position: relative;
  padding: 22px 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.how__card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--c);
}
.how__num { font: 600 0.8rem/1 var(--mono); color: var(--text-3); }
.how__card h3 { font-size: 1.05rem; margin: 10px 0 8px; }
.how__card p { margin: 0 0 10px; font-size: 0.93rem; color: var(--text-2); line-height: 1.6; }
.how__card p:last-child { margin-bottom: 0; }
.how__formula {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  font: 600 0.8rem/1.4 var(--mono) !important;
  color: var(--text) !important;
}

.runit {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px 24px;
  margin-top: 28px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.runit h3 { font-size: 1.05rem; margin-bottom: 4px; }
.runit p { margin: 0; color: var(--text-2); font-size: 0.93rem; }
.runit pre {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #0b1020;
  color: #e6ebf7;
  font: 400 0.85rem/1.4 var(--mono);
  overflow-x: auto;
}
.tok-p { color: var(--c-real); }

@media (prefers-reduced-motion: reduce) {
  .stage::before, .stage::after, .console .has-caret::after { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .explain { grid-template-columns: 1fr; }
  .explain__side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .fusion { align-content: start; gap: 18px; padding-top: 10px; }
  .listen { grid-column: 1 / -1; }
  .runit { grid-template-columns: 1fr; }
  .runit .pill { justify-self: start; }
}

@media (max-width: 640px) {
  .demo-top { padding: 14px 0 12px; }
  .stage { padding: 12px; border-radius: 18px; }
  .stage__bar { align-items: flex-start; }
  .scene-chip { font-size: 0.78rem; padding: 6px 11px 6px 8px; }
  .console { font-size: 0.72rem; padding: 8px 10px; height: calc(6 * 1.55em + 16px); }
  .insp { padding: 12px; }
  .spec-wrap { height: 230px; }
  .mini canvas { height: 72px; }
  .mini figcaption { flex-direction: column; align-items: flex-start; }
  .frow, .ffinal { grid-template-columns: 1fr auto 56px; gap: 6px 10px; }
  .frow__name { grid-column: 1; }
  .frow__w { grid-column: 2; grid-row: 1; }
  .frow__p { grid-column: 3; grid-row: 1; }
  .frow__track { grid-column: 1 / -1; grid-row: 2; }
  .ffinal__label { grid-column: 1 / 3; grid-row: 1; }
  .ffinal__out { grid-column: 3; grid-row: 1; }
  .ffinal__track { grid-column: 1 / -1; grid-row: 2; margin-top: 16px; }
}

/* ---------- Wide screens: everything above the fold ----------
   Title bar + stage fill the viewport; diagram and terminal on the left,
   the explanation / fusion panel on the right. */
@media (min-width: 1200px) and (min-height: 620px) {
  .demo-fold {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 61px);
    height: calc(100svh - 61px);
    min-height: 620px;
    max-height: 1240px;
    padding-bottom: 20px;
  }
  .demo-top { padding: 16px 0 14px; }
  .demo-fold__stage { flex: 1; min-height: 0; display: flex; }
  .stage {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(25rem, 36%, 40rem);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "bar insp" "diagram insp" "console insp";
    gap: 12px 20px;
  }
  .stage__bar { grid-area: bar; margin: 0; }
  .stage__diagram { grid-area: diagram; position: relative; min-height: 0; }
  #diagram { position: absolute; inset: 0; width: 100%; height: 100%; }
  .console { grid-area: console; margin: 0; }
  .inspector { grid-area: insp; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .insp { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  .insp__head { flex-direction: column; align-items: flex-start; }
  .explain { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
  .explain__main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .spec-wrap { flex: 1; height: auto; min-height: 140px; }
  .explain__side { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .listen { grid-column: 1 / -1; margin-top: 0; }
  .listen__label { flex-basis: auto; margin-right: 4px; }
  .mini canvas { height: 76px; }
  .mini figcaption { flex-direction: column; align-items: flex-start; }
  .frow, .ffinal { grid-template-columns: 1fr auto 64px; gap: 8px 12px; }
  .frow__name { grid-column: 1; }
  .frow__w { grid-column: 2; grid-row: 1; }
  .frow__p { grid-column: 3; grid-row: 1; }
  .frow__track { grid-column: 1 / -1; grid-row: 2; }
  .ffinal__label { grid-column: 1 / 3; grid-row: 1; }
  .ffinal__out { grid-column: 3; grid-row: 1; }
  .ffinal__track { grid-column: 1 / -1; grid-row: 2; margin-top: 16px; }
}

/* shorter wide screens (e.g. 1280×720): give the spectrogram the room */
@media (min-width: 1200px) and (min-height: 620px) and (max-height: 860px) {
  .steps { display: none; }
  .insp { padding: 12px 14px; }
  .insp__head { margin-bottom: 8px; }
  .explain { gap: 10px; }
  .mini canvas { height: 56px; }
  .console { font-size: 0.74rem; }
}

/* ---------- Kiosk (airi-demo.html?kiosk): unattended monitor ---------- */
html.kiosk { font-size: clamp(15px, 0.92vw, 44px); }
.kiosk .wrap--wide { width: calc(100% - 3vw); }
.kiosk body { overflow: hidden; cursor: none; }
.kiosk .nav,
.kiosk #how,
.kiosk .footer,
.kiosk .demo-top .links,
.kiosk .listen { display: none !important; }
.kiosk .demo-top__kiosk { display: flex; }
.kiosk .demo-top h1 { font-size: clamp(1.5rem, 2vw, 2.6rem); }
@media (min-width: 1200px) and (min-height: 620px) {
  .kiosk .demo-fold { height: 100vh; height: 100svh; max-height: none; }
}
