:root {
  --bg: #000;
  /* soft Matrix green — accents only, not body text */
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.18);
  --green-line: rgba(62, 207, 142, 0.45);
  --accent: var(--green);
  --accent-soft: #8fe0b8;
  --accent-glow: rgba(62, 207, 142, 0.15);
  --panel: rgba(18, 18, 18, 0.94);
  --panel-border: rgba(255, 255, 255, 0.14);
  --text: #f4f4f4;
  --muted: #b0b0b0;
  --danger: #ff2a2a;
  --blue: #3b82f6;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --green-dim: var(--accent-soft);
  --green-glow: var(--accent-glow);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
}
body { overflow-x: hidden; }

#rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 42px;
  animation: drift 18s linear infinite;
}
@keyframes drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 420px, 0 0; }
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}
.screen.active { display: block; }

.scene-bg {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: -1;
}

.intro-card {
  width: min(720px, calc(100% - 2rem));
  margin: 8vh auto;
  padding: 2rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-top: 2px solid var(--green);
  box-shadow: none;
  backdrop-filter: blur(10px);
}
.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--green);
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  text-transform: uppercase;
}
h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0 0 1rem;
  line-height: 1.15;
  font-weight: 700;
  color: #fff;
}
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h1 span, h2 span { color: var(--green); text-shadow: none; }
h2 { font-size: clamp(1.3rem, 3vw, 2rem); }
.lead { color: var(--muted); line-height: 1.6; margin: 0 0 1.25rem; }
.path-list {
  list-style: none;
  margin: 1.25rem 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
  color: var(--text);
}
.path-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  line-height: 1.35;
}
.path-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--green-line);
  background: #111;
}
.path-list strong {
  color: #fff;
  font-weight: 600;
}
.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.35rem;
}
.hint { margin: 1rem 0 0; color: var(--muted); font-size: 0.82rem; }

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  transition: 0.2s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); box-shadow: none; }
.btn.primary {
  background: var(--green);
  color: #06140e;
  border-color: var(--green);
}
.btn.primary:hover { background: #55db9d; }
.btn.ghost { border-color: rgba(255, 255, 255, 0.2); color: var(--muted); }
.btn.small { padding: 0.45rem 0.7rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* —— Side navigation (room) —— */
:root { --side-w: 280px; }

#screen-room.active {
  display: grid !important;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}
.nav-toggle {
  display: none !important;
}
.nav-backdrop {
  display: none !important;
}
.side-nav {
  position: sticky;
  top: 0;
  align-self: stretch;
  height: 100dvh;
  max-height: 100dvh;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: rgba(2, 8, 5, 0.96);
  border-right: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  padding: 1rem 0.85rem;
  transform: none !important;
  width: auto;
  min-width: 0;
}
.side-nav-top {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.side-nav-scroll {
  flex: 1;
  overflow: auto;
  padding-right: 0.2rem;
}
.side-label {
  margin: 0.85rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.side-rooms, .side-slides {
  display: grid;
  gap: 0.35rem;
}
.side-item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  transition: 0.15s ease;
}
.side-item:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
}
.side-item.active {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: #fff;
  box-shadow: none;
}
.side-item.done::before {
  content: "● ";
  color: var(--green);
}
.side-item .side-num {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
}
.side-item .side-name { display: inline; }
.side-nav-foot {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.room-shell {
  min-width: 0;
  min-height: 100dvh;
  height: 100dvh;
  padding: 1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
}
.room-panel {
  width: min(1280px, 100%);
  margin: 0;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.75rem;
}

/* Mobile: content full-width, left nav → bottom pagination */
@media (max-width: 860px) {
  #screen-room.active {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: none;
  }
  .room-shell {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    padding: 0.65rem 0.65rem 0.5rem;
  }
  .room-panel {
    width: 100%;
  }
  .side-nav {
    order: 2;
    position: relative;
    height: auto;
    max-height: none;
    border-right: none;
    border-top: 1px solid var(--panel-border);
    padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.96);
  }
  .side-nav-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    padding-bottom: 0.45rem;
  }
  .side-nav-top .eyebrow { display: none; }
  .side-nav-top .btn.small {
    font-size: 0.68rem;
    padding: 0.35rem 0.55rem;
  }
  .side-nav-scroll {
    flex: 0 0 auto;
    overflow: visible;
    display: grid;
    gap: 0.4rem;
    padding-right: 0;
  }
  .side-label {
    margin: 0;
    font-size: 0.6rem;
  }
  .side-rooms,
  .side-slides {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.1rem;
    scrollbar-width: thin;
  }
  .side-item {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,0.22);
    font-size: 0.68rem;
  }
  .side-item .side-num {
    display: block;
    margin: 0;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: inherit;
  }
  .side-item .side-name { display: none; }
  .side-item.active {
    background: var(--green);
    border-color: var(--green);
    color: #04140c;
  }
  .side-item.done:not(.active) {
    border-color: var(--green-line);
  }
  .side-item.done::before { content: none; }
  .side-nav-foot {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
  }
  .side-nav-foot .hint {
    margin: 0;
    font-size: 0.7rem;
    text-align: center;
  }
  .room-head {
    gap: 0.4rem 0.55rem;
    padding: 0.35rem 0.45rem;
  }
  .room-label {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }
  .nav-sq {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
}
.room-head {
  display: flex;
  align-items: center;
  gap: 0.55rem 0.85rem;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 0.4rem 0.65rem 0.4rem 0.9rem;
  backdrop-filter: blur(8px);
}
.room-head-spacer { flex: 1; min-width: 0.75rem; }
.room-label {
  margin: 0;
  color: var(--green);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.room-label.muted { color: var(--muted); }
.nav-sq {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.28);
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}
.nav-sq:hover:not(:disabled) {
  border-color: var(--green-line);
  background: var(--green-soft);
}
.nav-sq.primary {
  background: var(--green);
  border-color: var(--green);
  color: #04140c;
}
.nav-sq.primary:hover:not(:disabled) {
  background: #58dba0;
  border-color: #58dba0;
}
.nav-sq:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.room-body {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 0.85rem;
  backdrop-filter: blur(10px);
  min-height: 0;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: auto;
}
.slide-layout {
  display: grid;
  gap: 1.15rem 2rem;
  align-items: start;
  min-height: 100%;
  height: auto;
}
.slide-layout.has-media {
  /* image ~1.5× narrower than before → ~1/3 vs 2/3 */
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr);
  column-gap: 2.25rem;
}
.slide-layout.has-media.media-right {
  grid-template-columns: minmax(280px, 1.05fr) minmax(260px, 1.15fr);
}
.slide-layout.has-media.media-right .slide-figure {
  height: min(58dvh, 480px);
  max-height: min(58dvh, 480px);
}
.slide-layout.has-media:has(.slide-figure) .slide-figure {
  height: min(62dvh, 520px);
  max-height: min(62dvh, 520px);
}
.data-table-wrap {
  margin-top: 0.35rem;
  margin-bottom: 0.75rem;
  width: 100%;
  overflow-x: auto;
}
.data-table-wrap .model-table {
  font-size: 0.78rem;
  min-width: 640px;
}
.data-table-wrap .model-table th,
.data-table-wrap .model-table td {
  padding: 0.4rem 0.5rem;
  white-space: nowrap;
}
.data-table-wrap .model-table td:first-child,
.data-table-wrap .model-table th:first-child {
  white-space: normal;
  min-width: 11rem;
}
.interactive-series .model-table td:first-child,
.interactive-series .model-table th:first-child {
  min-width: 3.2rem;
  max-width: 4.5rem;
}
.series-matrix th {
  font-size: 0.72rem;
  vertical-align: bottom;
  white-space: normal;
  min-width: 3.6rem;
  max-width: 5.2rem;
  line-height: 1.25;
}
.series-matrix th.series-target {
  color: var(--green);
}
.series-hint {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.series-input {
  width: 3.6rem;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  font: inherit;
  font-size: 0.74rem;
  padding: 0.28rem 0.3rem;
}
.series-input:focus {
  outline: none;
  border-color: var(--green-line);
}
input.series-out {
  color: var(--green);
  border-color: rgba(0, 255, 65, 0.35);
}
.series-input.series-changed {
  animation: seriesFlash 1.4s ease;
  border-color: rgba(255, 220, 80, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 220, 80, 0.35);
}
input.series-out.series-changed {
  border-color: rgba(0, 255, 65, 0.75);
  box-shadow: 0 0 0 1px rgba(0, 255, 65, 0.35);
  animation: seriesFlashOrders 1.4s ease;
}
@keyframes seriesFlash {
  0% { background: rgba(255, 220, 80, 0.28); }
  100% { background: rgba(0, 0, 0, 0.55); }
}
@keyframes seriesFlashOrders {
  0% { background: rgba(0, 255, 65, 0.22); }
  100% { background: rgba(0, 0, 0, 0.55); }
}
.series-dep {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.01em;
  font-weight: 400;
}
.series-label {
  min-width: 3.2rem;
  font-weight: 600;
}
.slide-copy .slide-lines {
  margin-top: 0.25rem;
}
.slide-figure {
  margin: 0;
  border: 1px solid rgba(255,255,255,0.16);
  overflow: hidden;
  background: #000;
  width: 100%;
  /* фиксированный блок — не тянется за длинной формой */
  height: min(52dvh, 440px);
  max-height: min(52dvh, 440px);
  align-self: start;
  position: sticky;
  top: 0;
}
.slide-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--img-pos, center center);
}
.slide-figure.fit-contain {
  height: min(68dvh, 560px);
  max-height: min(68dvh, 560px);
  background: #000;
}
.slide-figure.fit-contain img {
  object-fit: contain;
  object-position: center center;
}
.slide-layout.has-media.media-right .slide-figure.fit-contain {
  height: min(70dvh, 580px);
  max-height: min(70dvh, 580px);
}
.slide-layout.has-media.media-stack {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 0.75rem;
  height: 100%;
  min-height: 0;
}
.slide-layout.media-stack .slide-copy-top {
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.15rem 0.25rem 0;
}
.slide-layout.media-stack .slide-figure.figure-full {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: min(48dvh, 420px);
  max-height: none;
  position: static;
  align-self: stretch;
}
.slide-layout.media-stack .slide-figure.figure-full img {
  width: 100%;
  height: 100%;
  max-height: min(62dvh, 620px);
  object-fit: contain;
  object-position: center center;
}
.slide-figures {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 0.65rem;
  width: 100%;
  min-height: 0;
  align-items: stretch;
}
.slide-figures .slide-figure {
  margin: 0;
  height: 100%;
  max-height: none;
  position: static;
}
.slide-layout.media-stack .slide-figures.figures-full {
  flex: 1 1 auto;
  min-height: min(42dvh, 360px);
}
.slide-layout.media-stack .slide-figures.figures-full .slide-figure.figure-full {
  min-height: min(40dvh, 340px);
}
.slide-layout.media-stack .slide-figures.figures-full .slide-figure.figure-full img {
  max-height: min(52dvh, 520px);
}
.slide-copy {
  min-width: 0;
  width: 100%;
  min-height: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(0.75rem, 2vh, 1.5rem);
  padding: 0.35rem 0.5rem 0.5rem 0.25rem;
  overflow: visible;
  box-sizing: border-box;
}
.slide-copy > :not(.speaker-notes) {
  width: 100%;
  max-width: none;
}
.slide-title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3.2vw, 2.35rem);
  margin: 0;
  color: #fff;
  flex: 0 0 auto;
  line-height: 1.2;
  max-width: none;
}
@media (max-width: 980px) {
  .slide-layout.has-media {
    grid-template-columns: 1fr;
  }
  .slide-figure {
    position: static;
    height: 220px;
    max-height: 220px;
  }
  .slide-figure.fit-contain {
    height: min(42dvh, 280px);
    max-height: min(42dvh, 280px);
  }
  .slide-layout.media-stack .slide-figure.figure-full {
    min-height: min(38dvh, 260px);
    height: auto;
    max-height: none;
  }
  .slide-layout.media-stack .slide-figure.figure-full img {
    max-height: min(48dvh, 360px);
  }
  .slide-figure img {
    height: 100%;
  }
  .slide-copy {
    padding: 0.25rem 0.1rem 0.4rem;
    justify-content: flex-start;
  }
}
.slide-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: clamp(0.7rem, 1.8vh, 1.15rem);
  flex: 1 1 auto;
  align-content: start;
  width: 100%;
}
.slide-lines li {
  line-height: 1.55;
  color: #f2f2f2;
  padding-left: 0.95rem;
  border-left: 2px solid var(--green-line);
  font-size: clamp(0.95rem, 1.55vw, 1.2rem);
}
.slide-bullets {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: clamp(0.55rem, 1.5vh, 0.95rem);
  color: #e6e6e6;
  line-height: 1.5;
  flex: 1 1 auto;
  align-content: start;
  width: 100%;
  font-size: clamp(0.92rem, 1.45vw, 1.12rem);
}
.slide-bullets li::marker { color: var(--green); }

/* —— Nested AI map —— */
.slide-layout.has-media:has(.nest-map) {
  align-items: start;
  height: auto;
  min-height: 100%;
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 1fr);
}
.nest-map {
  width: 100%;
  height: auto;
  max-height: none;
  align-self: start;
  overflow: visible;
  padding: 0;
  box-sizing: border-box;
}
.nest-layer {
  border: 1px solid rgba(62, 207, 142, 0.4);
  background: rgba(62, 207, 142, 0.08);
  padding: 0.7rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-sizing: border-box;
}
.nest-layer > .nest-layer {
  margin-top: 0.1rem;
}
.nest-layer-head {
  display: grid;
  gap: 0.2rem;
}
.nest-layer-head strong {
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 1.55vw, 1.15rem);
  font-weight: 700;
  line-height: 1.2;
}
.nest-layer-head span {
  color: #d5d5d5;
  font-size: clamp(0.78rem, 1.25vw, 0.92rem);
  line-height: 1.35;
}
.nest-layer[data-depth="1"] { background: rgba(62, 207, 142, 0.07); }
.nest-layer[data-depth="2"] { background: rgba(62, 207, 142, 0.1); }
.nest-layer[data-depth="3"] { background: rgba(62, 207, 142, 0.13); }
.nest-layer[data-depth="4"] { background: rgba(62, 207, 142, 0.16); }
.nest-layer[data-depth="5"] { background: rgba(62, 207, 142, 0.2); }
.nest-layer[data-depth="6"],
.nest-layer[data-depth="7"] {
  background: #0a0a0a;
  border-color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}
.nest-layer[data-depth="6"] > .nest-layer-head strong,
.nest-layer[data-depth="7"] > .nest-layer-head strong {
  color: #fff;
}
.nest-layer[data-depth="6"] > .nest-layer-head span,
.nest-layer[data-depth="7"] > .nest-layer-head span {
  color: #cfcfcf;
}
.nest-layer[data-depth="7"] {
  padding-bottom: 0.85rem;
}
@media (max-width: 980px) {
  .slide-layout.has-media:has(.nest-map) {
    grid-template-columns: 1fr;
  }
}

.model-viz {
  display: grid;
  grid-template-columns: minmax(200px, 0.9fr) minmax(220px, 1.2fr);
  gap: 1rem 1.25rem;
  align-items: stretch;
  width: 100%;
  margin-top: 0.35rem;
  flex: 1 1 auto;
}
@media (max-width: 900px) {
  .model-viz { grid-template-columns: 1fr; }
}
.model-table-wrap {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
  overflow: hidden;
}
.model-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.model-table th,
.model-table td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.model-table th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.model-table tr:last-child td { border-bottom: 0; }
.model-table .forecast-row {
  background: var(--green-soft);
}
.model-table .forecast-row td {
  color: #fff;
  font-weight: 600;
  border-top: 1px solid var(--green-line);
}
.forecast-tag {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--green);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.model-chart-wrap {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
  padding: 0.55rem;
  display: grid;
  place-items: center;
}
.model-chart {
  width: 100%;
  height: auto;
  max-height: 280px;
}
.chart-axis {
  stroke: rgba(255,255,255,0.28);
  stroke-width: 1;
}
.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.2;
}
.chart-forecast-line {
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  opacity: 0.85;
}
.chart-dot {
  fill: #fff;
  stroke: var(--green);
  stroke-width: 2;
}
.chart-dot.forecast {
  fill: var(--green);
  stroke: #fff;
  stroke-width: 2;
}
.chart-label {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
}

.slide-copy #room-form,
.slide-copy form {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: flex-start;
}
.speaker-notes {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
  flex: 0 0 auto;
  width: 100%;
}
.speaker-notes summary {
  cursor: pointer;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.speaker-notes p {
  margin: 0.55rem 0 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.block { margin-bottom: 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.block h3 { color: #fff; font-size: 1rem; margin-bottom: 0.55rem; }
.speech {
  margin: 0 0 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.field { margin: 0.75rem 0; }
.field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field textarea,
.field select {
  width: 100%;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--text);
  padding: 0.7rem 0.75rem;
  font: inherit;
  border-radius: 0;
  box-sizing: border-box;
}
.field input[type="password"] {
  letter-spacing: 0.08em;
}
.field input::placeholder {
  color: rgba(255,255,255,0.35);
}
.field textarea { min-height: 84px; resize: vertical; }
.choices { display: grid; gap: 0.4rem; }
.choices-multi {
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
}
.choice {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.28);
  cursor: pointer;
}
.choice:hover { border-color: rgba(255,255,255,0.4); }
.choice:has(input:checked) {
  border-color: rgba(0, 255, 65, 0.55);
  background: rgba(0, 255, 65, 0.08);
}
.choice-other {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.3rem;
}
.choice-other label {
  font-size: 0.78rem;
  color: var(--muted);
}
.choice-other input[type="text"] {
  width: 100%;
  max-width: 28rem;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.7rem;
}
.choice-other input[type="text"]:focus {
  outline: none;
  border-color: var(--green-line);
}
.field-tool-matrix {
  margin-top: 0.85rem;
}
.tool-matrix-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
}
.tool-matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  font-size: 0.78rem;
}
.tool-matrix th,
.tool-matrix td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.55rem 0.6rem;
  vertical-align: middle;
  text-align: left;
}
.tool-matrix thead th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tool-matrix tbody th {
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  min-width: 11rem;
}
.tool-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tool-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  white-space: nowrap;
}
.tool-opt:has(input:checked) {
  border-color: rgba(62, 207, 142, 0.6);
  background: rgba(62, 207, 142, 0.1);
  color: var(--green);
}
.tool-opt input {
  accent-color: var(--green);
}
.scale {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.scale label {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.22);
  cursor: pointer;
  margin: 0;
  color: var(--text);
}
.scale input { display: none; }
.scale input:checked + span,
.scale label:has(input:checked) {
  background: #fff;
  color: #111;
  box-shadow: none;
}
.scale label span { pointer-events: none; }

.finale-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* —— Auth —— */
.login-card code {
  color: var(--green);
  font-family: inherit;
}
.auth-form {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.auth-form .field span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
}
.auth-error {
  margin: 0.35rem 0 0;
  color: var(--danger);
  font-size: 0.86rem;
}
.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* —— Admin —— */
.admin-shell {
  width: min(1200px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
  position: relative;
  z-index: 1;
}
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.admin-top h2 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.admin-meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 1rem;
}
.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.3fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
}
.admin-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 0.9rem 1rem 1.1rem;
  min-height: 200px;
}
.admin-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: #fff;
}
.admin-table-wrap { overflow: auto; max-height: 70dvh; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  vertical-align: top;
}
.admin-table th { color: var(--muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.68rem; }
.admin-questions {
  display: grid;
  gap: 0.75rem;
  max-height: 70dvh;
  overflow: auto;
}
.admin-q {
  border: 1px solid rgba(255,255,255,0.12);
  padding: 0.7rem 0.75rem;
}
.admin-q h4 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1.4;
}
.admin-q .meta { color: var(--muted); font-size: 0.72rem; margin-bottom: 0.45rem; }
.admin-bars { display: grid; gap: 0.35rem; }
.admin-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.75rem;
}
.admin-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.admin-bar-fill {
  height: 100%;
  background: var(--green);
}
.admin-samples {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
  color: #ddd;
  font-size: 0.75rem;
  line-height: 1.4;
}
.admin-samples strong { color: var(--muted); font-weight: 600; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); }

.cloud-pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: min(100%, 54rem);
  margin: 0.35rem auto 0;
  padding: 0.2rem 0 0.75rem;
  align-self: stretch;
  flex: 1 1 auto;
}
.pyramid-apex {
  width: var(--pyr-w, 22%);
  z-index: 5;
  animation: pyrIn 0.55s ease both;
}
.pyramid-apex-inner {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(180deg, rgba(62, 207, 142, 0.34), rgba(8, 24, 16, 0.92));
  border-bottom: 1px solid rgba(62, 207, 142, 0.55);
  min-height: 4.2rem;
  display: grid;
  place-items: end center;
  padding: 0 0.8rem 0.7rem;
  text-align: center;
}
.pyramid-apex-inner span {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: #fff;
  letter-spacing: 0.02em;
}
.pyramid-layer {
  width: var(--pyr-w, 100%);
  margin-top: -1px;
  animation: pyrIn 0.55s ease both;
  animation-delay: calc(0.07s * (var(--pyr-i) + 1));
  z-index: calc(4 - var(--pyr-i));
}
.pyramid-layer-shape {
  clip-path: polygon(
    var(--pyr-inset, 8%) 0,
    calc(100% - var(--pyr-inset, 8%)) 0,
    100% 100%,
    0 100%
  );
  background:
    linear-gradient(
      180deg,
      rgba(62, 207, 142, calc(0.22 - var(--pyr-i) * 0.03)),
      rgba(0, 0, 0, 0.78)
    );
  border-bottom: 1px solid rgba(62, 207, 142, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.pyramid-layer-inner {
  padding: 0.7rem clamp(1.1rem, 4vw, 2.4rem) 0.85rem;
}
.pyramid-layer-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.pyramid-layer-meta strong {
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  color: #fff;
  font-weight: 600;
}
.pyramid-audience {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}
.pyramid-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.3rem;
}
.pyramid-item:has(.pyramid-item-children) {
  grid-column: 1 / -1;
}
.pyramid-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.38);
  padding: 0.3rem 0.45rem;
}
.pyramid-item-head,
.pyramid-item-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  align-items: baseline;
}
.pyramid-item-name {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 600;
}
.pyramid-item-note {
  color: var(--muted);
  font-size: 0.68rem;
}
.pyramid-item-note::before {
  content: "→ ";
  color: rgba(255, 255, 255, 0.28);
}
.pyramid-item-children {
  display: grid;
  gap: 0.18rem;
  margin-top: 0.28rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(62, 207, 142, 0.28);
}
.pyramid-item-child span:first-child {
  color: #fff;
  font-size: 0.72rem;
}
.pyramid-layer[data-i="3"] .pyramid-item-name {
  color: #fff;
}
@keyframes pyrIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.slide-layout.media-stack .cloud-pyramid {
  width: 100%;
  max-width: 56rem;
}
@media (max-width: 980px) {
  .cloud-pyramid {
    width: 100%;
    margin-top: 0.5rem;
  }
  .pyramid-apex-inner {
    min-height: 3.4rem;
  }
  .pyramid-apex-inner span {
    font-size: 0.78rem;
  }
  .pyramid-layer-meta {
    flex-direction: column;
    gap: 0.12rem;
  }
  .pyramid-items {
    grid-template-columns: 1fr;
  }
}
