:root {
  --bg: #08090d;
  --panel: rgba(21, 23, 31, 0.86);
  --panel-strong: rgba(32, 35, 47, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f4f0e8;
  --muted: #a6a2a0;
  --dim: #6f6c70;
  --hot: #ff6a4a;
  --warn: #ffc15c;
  --ok: #80e7bd;
  --blue: #89b7ff;
  --violet: #c6a1ff;
  --shadow: rgba(0, 0, 0, 0.38);
  --stage-brightness: 0.98;
  --ambient-glow: 0.24;
  --ambient-grid-opacity: 0.16;
  --ambient-haze-opacity: 0.24;
  --ambient-haze-blur: 18px;
  --ambient-pulse-duration: 16s;
  --ambient-pulse-scale: 1.015;
  --ambient-saturation: 1.02;
  --ambient-contrast: 1.01;
  --ambient-shift-y: 0px;
  --stage-saturate: 1.02;
  --stage-lift: 0px;
  --ambient-primary: rgba(255, 193, 92, 0.24);
  --ambient-secondary: rgba(137, 183, 255, 0.18);
  --ambient-tertiary: rgba(255, 106, 74, 0.14);
  --ambient-shadow-glow: rgba(255, 106, 74, 0.06);
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 12%, var(--ambient-tertiary), transparent 28rem),
    radial-gradient(circle at 80% 0%, var(--ambient-secondary), transparent 24rem),
    linear-gradient(135deg, #06070a 0%, #11131a 55%, #07080d 100%);
  color: var(--text);
  font-family: var(--font-ui);
  transition: background 320ms ease, filter 280ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--ambient-grid-opacity);
  background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 78%);
  transition: opacity 240ms ease, transform 280ms ease;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--ambient-haze-opacity);
  background:
    radial-gradient(circle at 50% 0%, var(--ambient-primary), transparent 30rem),
    radial-gradient(circle at 20% 75%, var(--ambient-secondary), transparent 28rem),
    radial-gradient(circle at 82% 25%, var(--ambient-tertiary), transparent 24rem);
  mix-blend-mode: screen;
  filter: blur(var(--ambient-haze-blur)) saturate(var(--ambient-saturation)) contrast(var(--ambient-contrast));
  transform: translateY(var(--ambient-shift-y)) scale(var(--ambient-pulse-scale));
  transform-origin: 50% 12%;
  transition: opacity 220ms ease, filter 260ms ease, transform 320ms ease;
  animation: ambientBreathe var(--ambient-pulse-duration) ease-in-out infinite;
}

body.modal-open {
  overflow: hidden;
}

.app-shell {
  width: min(1560px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 32px;
  filter: brightness(var(--stage-brightness)) saturate(var(--stage-saturate));
  transform: translateY(var(--stage-lift));
  transition: filter 240ms ease, transform 240ms ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.header-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.tool-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: stretch;
}

.eyebrow,
.panel-tag,
.audience-kicker {
  color: var(--hot);
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.02;
  margin-top: 7px;
  letter-spacing: -0.04em;
}

.brand-block p {
  color: var(--muted);
  margin-top: 9px;
  max-width: 720px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 8px;
  min-width: 440px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  padding: 10px 12px;
  box-shadow: 0 14px 32px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--ambient-shadow-glow) 30%, transparent);
  transition: box-shadow 240ms ease, background 240ms ease, border-color 240ms ease;
}

.metric-label {
  display: block;
  color: var(--dim);
  font: 700 11px/1 var(--font-mono);
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 7px;
  font: 800 24px/1 var(--font-mono);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-bottom: 14px;
}

.scene-strip {
  margin-bottom: 14px;
}

.scene-card {
  border: 1px solid rgba(255, 193, 92, 0.24);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(18, 20, 29, 0.9), rgba(13, 18, 30, 0.84)),
    radial-gradient(circle at top right, rgba(255, 193, 92, 0.1), transparent 16rem);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.24), 0 0 48px var(--ambient-shadow-glow);
  padding: 16px 18px;
  transition: box-shadow 240ms ease, background 240ms ease, border-color 240ms ease, transform 240ms ease;
}

.scene-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.scene-title {
  margin-top: 6px;
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: -0.03em;
}

.scene-description {
  margin-top: 8px;
  max-width: 880px;
  color: var(--muted);
  line-height: 1.5;
}

.scene-progress-block {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 14px 32px var(--shadow), 0 0 24px color-mix(in srgb, var(--ambient-shadow-glow) 40%, transparent);
  transition: box-shadow 240ms ease, background 240ms ease;
}

.scene-progress-label {
  display: block;
  color: var(--dim);
  font: 700 11px/1 var(--font-mono);
  text-transform: uppercase;
}

.scene-progress-value {
  display: block;
  margin-top: 7px;
  font: 900 20px/1 var(--font-mono);
}

.config-entry-button {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 146px;
  align-self: flex-end;
}

.director-entry-button {
  min-width: 154px;
}

.lang-switch {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 14px 32px var(--shadow), 0 0 22px color-mix(in srgb, var(--ambient-shadow-glow) 40%, transparent);
  transition: box-shadow 240ms ease, border-color 240ms ease, background 240ms ease;
}

.lang-button {
  min-width: 68px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  border-color: transparent;
  font: 800 13px/1 var(--font-mono);
  letter-spacing: 0.04em;
}

.lang-button.is-active {
  background: rgba(255, 106, 74, 0.16);
  border-color: rgba(255, 106, 74, 0.34);
  color: #ffd2c8;
  box-shadow: inset 0 0 0 1px rgba(255, 106, 74, 0.16);
}

.config-entry-meta {
  color: var(--muted);
  font: 700 11px/1.2 var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font: 700 14px/1 var(--font-ui);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,255,255,0.32);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(135deg, rgba(255,106,74,0.95), rgba(255,193,92,0.92));
  border-color: rgba(255,255,255,0.22);
  color: #121016;
  box-shadow: 0 16px 36px rgba(255,106,74,0.24);
}

button.small {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 9px;
}

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font: 700 13px/1 var(--font-ui);
  padding: 0 4px;
}

.toggle input {
  accent-color: var(--hot);
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel,
.audience-panel,
.telemetry-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 22px 80px rgba(0,0,0,0.28), 0 0 52px var(--ambient-shadow-glow);
  backdrop-filter: blur(16px);
  transition: box-shadow 260ms ease, border-color 240ms ease, background 240ms ease, transform 240ms ease;
}

.panel {
  min-height: 438px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 24px;
  opacity: 0;
  border: 1px solid var(--hot);
  transition: opacity 180ms ease;
}

.panel.alert::after {
  opacity: 0.68;
  animation: pulseBorder 760ms ease-in-out 2;
}

.raw-panel {
  border-color: rgba(255,106,74,0.24);
}

.warden-panel {
  border-color: rgba(255,193,92,0.22);
}

.public-panel {
  border-color: rgba(137,183,255,0.22);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin-top: 6px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.panel-subtitle {
  color: var(--dim);
  font: 700 12px/1.4 var(--font-mono);
  text-align: right;
  margin-top: 2px;
}

.panel-body {
  flex: 1;
  padding: 22px 20px;
  overflow: auto;
  white-space: pre-wrap;
}

.raw-body {
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1.32;
  letter-spacing: -0.04em;
}

.public-body {
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.38;
  color: #e4ecff;
}

.code-body {
  font: 700 15px/1.6 var(--font-mono);
  color: #ffdf9d;
}

body[data-ui-lang="zh"] .warden-panel .code-body {
  font-size: 13.5px;
  line-height: 1.78;
  letter-spacing: 0.02em;
}

.panel-footer {
  min-height: 48px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 700 12px/1.4 var(--font-mono);
}

.blacked-out {
  color: transparent !important;
  text-shadow: none !important;
  background: repeating-linear-gradient(135deg, rgba(0,0,0,0.76), rgba(0,0,0,0.76) 10px, rgba(255,255,255,0.04) 10px, rgba(255,255,255,0.04) 16px);
}

.redacted-word {
  background: #050508;
  color: transparent;
  border-radius: 4px;
  padding: 0 0.2em;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
}

.audience-panel {
  margin-top: 14px;
  min-height: 164px;
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) 160px minmax(380px, 1.75fr);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  border-color: rgba(255,193,92,0.26);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.audience-panel.active {
  border-color: rgba(255,106,74,0.74);
  background: rgba(42, 25, 24, 0.86);
  box-shadow: 0 0 0 1px rgba(255,106,74,0.18), 0 30px 90px rgba(255,106,74,0.12);
}

.audience-panel.idle {
  opacity: 0.78;
}

.audience-left h2 {
  margin-top: 7px;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.audience-left p {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.55;
}

.countdown-wrap {
  border: 1px solid var(--line);
  border-radius: 20px;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(0,0,0,0.18);
}

.countdown-label,
.default-policy {
  color: var(--muted);
  font: 700 12px/1.3 var(--font-mono);
  text-align: center;
}

.countdown {
  font: 900 56px/1 var(--font-mono);
  letter-spacing: -0.08em;
  color: var(--warn);
  margin: 6px 0;
}

.countdown.urgent {
  color: var(--hot);
  animation: urgentPulse 500ms ease-in-out infinite alternate;
}

.audience-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-button {
  text-align: left;
  border-radius: 18px;
  padding: 14px;
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.055);
}

.option-key {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
  color: var(--warn);
  font: 900 16px/1 var(--font-mono);
}

.option-text {
  line-height: 1.35;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(260px, 1fr) minmax(360px, 1.55fr);
  gap: 14px;
  margin-top: 14px;
}

.venue-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(420px, 1.35fr);
  gap: 14px;
  margin-top: 14px;
}

.telemetry-card {
  padding: 18px;
  min-height: 204px;
}

.telemetry-card h3 {
  font-size: 18px;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.leash-track {
  width: 100%;
  height: 18px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.leash-fill {
  height: 100%;
  width: 18%;
  background: linear-gradient(90deg, var(--ok), var(--warn), var(--hot));
  border-radius: 99px;
  transition: width 240ms ease;
}

.telemetry-list {
  display: grid;
  gap: 9px;
}

.telemetry-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
}

.telemetry-list strong {
  color: var(--text);
  font-family: var(--font-mono);
}

.rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rule-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  font: 700 12px/1 var(--font-mono);
  background: rgba(255,255,255,0.04);
}

.rule-chip.active {
  border-color: rgba(128,231,189,0.54);
  color: var(--ok);
  background: rgba(128,231,189,0.08);
}

.log-card {
  min-height: 204px;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.log-output {
  max-height: 170px;
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.2);
  font: 600 12px/1.55 var(--font-mono);
  color: var(--muted);
  white-space: pre-wrap;
}

.venue-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.venue-mode-chip,
.printer-queue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(137, 183, 255, 0.34);
  background: rgba(137, 183, 255, 0.12);
  color: #d7e5ff;
  font: 800 12px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.venue-meter {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font: 700 13px/1 var(--font-mono);
}

.venue-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  margin-top: 10px;
}

.venue-fill {
  height: 100%;
  width: 82%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(128, 231, 189, 0.92), rgba(255, 193, 92, 0.96), rgba(255, 106, 74, 0.96));
  transition: width 180ms ease;
}

.printer-queue-card {
  min-height: 286px;
}

.printer-queue-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.queue-hint {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.printer-queue-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 242px;
  overflow: auto;
}

.printer-slip {
  border: 1px solid rgba(255, 193, 92, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 14px;
}

.printer-slip.is-empty {
  color: var(--muted);
  font: 700 13px/1.6 var(--font-ui);
}

.printer-slip-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font: 800 12px/1.2 var(--font-mono);
  color: var(--warn);
}

.printer-slip-head span {
  color: var(--dim);
  font-weight: 700;
}

.printer-slip-body {
  margin-top: 8px;
  white-space: pre-wrap;
  line-height: 1.55;
}

.printer-slip-meta {
  margin-top: 8px;
  color: var(--dim);
  font: 700 12px/1.3 var(--font-mono);
}

.director-modal {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  padding: 24px;
}

.director-modal[hidden] {
  display: none !important;
}

.director-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 193, 92, 0.12), transparent 24rem),
    rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(12px);
}

.director-dialog {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 30px;
  border: 1px solid rgba(255, 193, 92, 0.28);
  background:
    linear-gradient(135deg, rgba(13, 15, 24, 0.96), rgba(18, 24, 39, 0.92)),
    radial-gradient(circle at top right, rgba(255, 193, 92, 0.12), transparent 18rem);
  box-shadow: 0 32px 120px rgba(0, 0, 0, 0.36);
  padding: 20px;
}

.director-close-button {
  position: absolute;
  top: 18px;
  right: 18px;
}

.director-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.director-header h2 {
  margin-top: 6px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.director-header p {
  margin-top: 8px;
  max-width: 780px;
  color: var(--muted);
  line-height: 1.6;
}

.director-badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  min-width: min(450px, 100%);
}

.director-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.director-block {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.035);
  padding: 16px;
}

.director-block-wide {
  grid-column: 1 / -1;
}

.director-block h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.director-copy {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.director-copy-mini {
  font-size: 13px;
}

.director-actions,
.director-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.director-helper-badge {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.director-helper-badge[data-state="active"] {
  border-color: rgba(255, 193, 92, 0.24);
  color: #ffe4b0;
}

.director-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 8px;
  color: var(--text);
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.04em;
}

.director-inline-toggle input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.director-actions-slim button,
.director-chip-grid button {
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.03em;
}

.director-chip-grid button.is-active {
  border-color: rgba(255, 193, 92, 0.54);
  background: rgba(255, 193, 92, 0.14);
  color: #ffe4b0;
}

.director-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.director-form-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.director-field {
  display: grid;
  gap: 8px;
}

.director-field-wide {
  grid-column: span 2;
}

.director-field span {
  color: var(--muted);
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.director-field input,
.director-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 13px;
  font: 600 14px/1.4 var(--font-ui);
}

.director-preset-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.director-preset-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
}

.director-preset-card.is-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.02);
}

.director-preset-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.director-preset-head strong {
  font: 700 13px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.director-preset-edit-grid {
  display: grid;
  gap: 10px;
}

.director-preset-field {
  display: grid;
  gap: 6px;
}

.director-preset-field span {
  color: var(--muted);
  font: 700 11px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.director-preset-field input,
.director-preset-field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.director-preset-field textarea {
  min-height: 82px;
  resize: vertical;
}

.director-preset-time {
  color: var(--muted);
  font: 600 11px/1.4 var(--font-mono);
}

.director-preset-meta {
  display: grid;
  gap: 8px;
}

.director-preset-meta div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font: 600 12px/1.45 var(--font-mono);
}

.director-preset-meta strong {
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.director-preset-empty {
  color: var(--muted);
  min-height: 70px;
  line-height: 1.55;
}

.director-preset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.director-preset-actions button {
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.03em;
}

.director-observation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.director-observation-card {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
}

.director-observation-card span,
.director-observation-item span {
  display: block;
  color: var(--muted);
  font: 700 11px/1.25 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.director-observation-card strong,
.director-observation-item strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.director-observation-copy {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.director-observation-list {
  display: grid;
  gap: 10px;
}

.director-observation-item {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 14px;
}

.director-observation-item small {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.5);
  font: 600 11px/1.45 var(--font-mono);
  letter-spacing: 0.05em;
}

body[data-venue-mode="projection"] .app-shell {
  transform: scale(1.005);
}

body[data-venue-mode="projection"] .panel,
body[data-venue-mode="projection"] .telemetry-card,
body[data-venue-mode="projection"] .audience-panel {
  background: rgba(9, 11, 18, 0.95);
  border-color: rgba(255, 255, 255, 0.16);
}

body[data-venue-mode="projection"] .control-row,
body[data-venue-mode="projection"] .lower-grid {
  opacity: 0.94;
}

body[data-venue-mode="museum"] .app-shell {
  transform: translateY(calc(var(--stage-lift) + 2px));
}

body[data-venue-mode="museum"] .panel,
body[data-venue-mode="museum"] .telemetry-card,
body[data-venue-mode="museum"] .audience-panel {
  backdrop-filter: blur(22px);
  border-color: rgba(128, 231, 189, 0.16);
}

.flash {
  animation: flashPanel 360ms ease-in-out;
}

.shake {
  animation: shake 300ms ease-in-out;
}

@keyframes pulseBorder {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.92; }
}

@keyframes urgentPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

@keyframes ambientBreathe {
  0%, 100% {
    opacity: calc(var(--ambient-haze-opacity) * 0.88);
    transform: translateY(var(--ambient-shift-y)) scale(calc(var(--ambient-pulse-scale) - 0.012));
  }
  50% {
    opacity: calc(var(--ambient-haze-opacity) * 1.08);
    transform: translateY(calc(var(--ambient-shift-y) - 3px)) scale(var(--ambient-pulse-scale));
  }
}

@keyframes flashPanel {
  0% { background-color: rgba(255, 106, 74, 0.18); }
  100% { background-color: transparent; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.config-strip {
  margin-bottom: 0;
  padding: 18px;
  border: 1px solid rgba(137, 183, 255, 0.24);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(14, 17, 28, 0.94), rgba(18, 23, 37, 0.9)),
    radial-gradient(circle at top right, rgba(137, 183, 255, 0.12), transparent 16rem);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.28);
}

.config-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.config-modal[hidden] {
  display: none !important;
}

.config-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(137, 183, 255, 0.14), transparent 26rem),
    rgba(5, 8, 14, 0.74);
  backdrop-filter: blur(10px);
}

.config-dialog {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 28px;
}

.config-close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
}

.config-strip-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.config-strip-header h2 {
  margin-top: 6px;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.config-strip-header p {
  margin-top: 8px;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.55;
}

.config-strip code {
  font-family: var(--font-mono);
  color: var(--blue);
}

.config-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  min-width: min(420px, 100%);
}

.metric.compact {
  min-width: 0;
}

.metric-inline {
  font-size: 18px;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.config-field {
  display: grid;
  gap: 8px;
}

.config-field span {
  color: var(--muted);
  font: 700 12px/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.config-field input,
.config-field select,
.config-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 13px;
  font: 600 14px/1.45 var(--font-ui);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.config-field input:focus,
.config-field select:focus,
.config-field textarea:focus {
  border-color: rgba(137, 183, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(137, 183, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.config-field textarea {
  resize: vertical;
  min-height: 118px;
}

.config-checkbox-field {
  align-items: start;
}

.config-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 13px;
  color: var(--muted);
  font: 600 14px/1.5 var(--font-ui);
}

.config-checkbox-row input {
  margin-top: 2px;
  accent-color: var(--hot);
}

.config-field-wide {
  grid-column: span 2;
}

.config-field-full {
  grid-column: 1 / -1;
}

.config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.config-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font: 600 12px/1.5 var(--font-mono);
}

.config-status {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  font: 700 13px/1.5 var(--font-mono);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.config-status[data-tone="success"] {
  border-color: rgba(128, 231, 189, 0.42);
  color: var(--ok);
  background: rgba(128, 231, 189, 0.08);
}

.config-status[data-tone="error"] {
  border-color: rgba(255, 106, 74, 0.44);
  color: #ffd1c7;
  background: rgba(255, 106, 74, 0.08);
}

.config-status[data-tone="warn"] {
  border-color: rgba(255, 193, 92, 0.44);
  color: #ffe4b0;
  background: rgba(255, 193, 92, 0.08);
}

.screen-simulator-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(17, 20, 30, 0.92), rgba(10, 13, 22, 0.9)),
    radial-gradient(circle at top right, rgba(137, 183, 255, 0.1), transparent 18rem);
  box-shadow: 0 22px 72px rgba(0, 0, 0, 0.24);
  padding: 18px;
}

.screen-simulator-header p {
  margin-top: 8px;
  color: var(--muted);
  max-width: 880px;
}

.screen-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.screen-preview-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
}

.screen-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.screen-preview-head h3 {
  margin-top: 6px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.screen-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font: 700 12px/1 var(--font-mono);
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.04);
}

.screen-link:hover {
  border-color: rgba(255, 193, 92, 0.34);
  color: #fff0d0;
}

.screen-preview-description {
  color: var(--muted);
  line-height: 1.5;
  min-height: 42px;
}

.screen-preview-frame {
  width: 100%;
  height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: #090b12;
}

@media (max-width: 1100px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-tools {
    align-items: stretch;
  }

  .tool-cluster {
    justify-content: stretch;
  }

  .lang-switch,
  .config-entry-button {
    width: 100%;
  }

  .scene-head {
    flex-direction: column;
  }

  .scene-progress-block {
    width: 100%;
  }

  .lang-button {
    flex: 1;
  }

  .status-strip {
    min-width: 0;
  }

  .stage-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .venue-grid {
    grid-template-columns: 1fr;
  }

  .screen-preview-grid {
    grid-template-columns: 1fr;
  }

  .audience-panel {
    grid-template-columns: 1fr;
  }

  .audience-options {
    grid-template-columns: 1fr;
  }

  .config-strip-header {
    flex-direction: column;
  }

  .config-metrics {
    min-width: 0;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .config-grid {
    grid-template-columns: 1fr;
  }

  .config-field-wide,
  .config-field-full {
    grid-column: auto;
  }

  .config-modal {
    padding: 16px;
  }

  .config-dialog {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .director-modal {
    padding: 16px;
  }

  .director-dialog {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .director-header,
  .director-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .director-badges,
  .director-form-grid,
  .director-form-grid-compact {
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .director-preset-list {
    grid-template-columns: 1fr;
  }

  .director-observation-grid {
    grid-template-columns: 1fr;
  }

  .director-field-wide {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* Core rebuild: Ash Ledger and Episode rehearsal controls */
.ash-card {
  min-height: 240px;
}

.ash-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.ash-summary div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.ash-summary-wide {
  grid-column: 1 / -1;
}

.ash-summary span {
  font: 700 10px/1.2 var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ash-summary strong {
  font: 800 16px/1.1 var(--font-mono);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ash-summary-wide strong {
  white-space: normal;
  line-height: 1.35;
  font-size: 12px;
  color: var(--accent);
}

.ash-ledger-list {
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow: auto;
  padding-right: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ash-entry {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-left: 2px solid rgba(255, 193, 92, 0.42);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.ash-entry.is-episode-final {
  border-left-color: rgba(128, 231, 189, 0.62);
  background: rgba(128, 231, 189, 0.055);
}

.ash-entry.is-final {
  border-left-color: rgba(255, 114, 91, 0.72);
  background: rgba(255, 114, 91, 0.07);
}

.ash-entry strong {
  font: 800 11px/1 var(--font-mono);
  color: var(--warn);
}

.ash-entry span {
  color: var(--muted);
}

.ash-entry em {
  color: var(--text);
  font-style: normal;
  line-height: 1.35;
}

.research-card {
  min-height: 260px;
}

.research-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.research-summary div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.research-summary-wide {
  grid-column: 1 / -1;
}

.research-summary span {
  font: 700 10px/1.2 var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.research-summary strong {
  font: 800 14px/1.2 var(--font-mono);
  color: var(--text);
  overflow-wrap: anywhere;
}

.research-archive-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
  padding-right: 4px;
  color: var(--muted);
  font-size: 12px;
}

.research-entry {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-left: 2px solid rgba(137, 183, 255, 0.46);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.research-entry strong {
  font: 800 11px/1 var(--font-mono);
  color: var(--accent);
}

.research-entry span {
  color: var(--muted);
}

.research-entry em {
  color: var(--text);
  font-style: normal;
  line-height: 1.35;
}

.director-chip-grid-dense button {
  max-width: 260px;
  white-space: normal;
  text-align: left;
  line-height: 1.25;
}

@media (max-width: 1180px) {
  .lower-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .lower-grid {
    grid-template-columns: 1fr;
  }
}

/* Recognition Threshold climate: recognition is not a score to win, but a spatial weather system. */
body[data-recognition-band="low"] .stage-grid .panel {
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(137, 183, 255, 0.09);
}

body[data-recognition-band="mid"] .stage-grid .panel {
  box-shadow: 0 22px 68px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 193, 92, 0.10);
}

body[data-recognition-band="high"] .stage-grid .panel {
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(128, 231, 189, 0.08);
}

body[data-recognition-band="high"] .beam,
body[data-recognition-band="high"] .scanline {
  opacity: 0.62;
}

body[data-recognition-band="low"] .beam,
body[data-recognition-band="low"] .scanline {
  opacity: 1;
}

/* Mode density: rehearsal keeps the development panels open; exhibition hides them unless cued. */
body[data-venue-mode="exhibition"] .lower-grid {
  display: none;
}

body[data-venue-mode="research"] .lower-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-venue-mode="research"] .log-card,
body[data-venue-mode="research"] .ash-card,
body[data-venue-mode="research"] .research-card {
  min-height: 360px;
}
