/* ============================================================
   AI Creative Production OS — "Cinematic Ops Console"
   Dark cinematic control-room aesthetic.
   Display: Space Grotesk (variable). Data/labels: IBM Plex Mono.
   Accent: electric teal over navy-black steel neutrals.
   ============================================================ */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-600.woff2") format("woff2");
}

/* ---------- Design tokens ---------- */
:root {
  color-scheme: dark;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, "Consolas", monospace;

  /* Surfaces: navy-black steel scale */
  --bg: #060b14;
  --surface: #0c1626;
  --surface-2: #101d31;
  --surface-inset: #070d16;
  --line: #1c2c44;
  --line-soft: rgba(148, 178, 216, 0.09);

  /* Text */
  --ink: #e9f1f8;
  --ink-dim: #b8c6d8;
  --muted: #93a1b5;
  --muted-2: #6c7c92;

  /* Accent — electric teal + Alarcom brand base */
  --teal: #22d3c5;
  --teal-bright: #58ecdf;
  --teal-dim: #0e7c86;
  --teal-tint: rgba(34, 211, 197, 0.12);
  --teal-glow: rgba(34, 211, 197, 0.34);
  --navy: #0b1f3a;

  --danger: #ff6259;
  --danger-tint: rgba(255, 98, 89, 0.14);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --shadow-panel: 0 22px 48px -30px rgba(0, 0, 0, 0.9);
  --shadow-pop: 0 16px 40px -18px rgba(0, 0, 0, 0.75);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Ambient control-room backdrop: teal top glow, navy pool, faint grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1200px 620px at 72% -12%, rgba(34, 211, 197, 0.11), transparent 60%),
    radial-gradient(960px 560px at -5% -8%, rgba(11, 31, 58, 0.7), transparent 58%),
    linear-gradient(rgba(148, 178, 216, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 178, 216, 0.022) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 46px 46px, 46px 46px;
}

/* Film grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--teal-glow);
  color: #04181b;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #24354f transparent;
}
*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #24354f;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: #334a6b;
  background-clip: padding-box;
}

button,
a,
input,
select,
textarea {
  font: inherit;
}

/* ---------- Typography ---------- */
h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 600;
  color: #fff;
}

h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.32em;
}

/* Live "system online" LED */
.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 var(--teal-glow);
  animation: led-pulse 2.4s var(--ease) infinite;
}

/* ---------- Shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  max-width: 1520px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px clamp(16px, 3vw, 40px) 60px;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.toolbar h1 {
  text-shadow: 0 0 40px rgba(34, 211, 197, 0.14);
}

/* ---------- Panels (shared card look) ---------- */
.workflow,
.status-grid,
.generation-strip,
.client-brand-panel,
.json-panel,
.prompt-panel,
.progress-panel,
.editor-panel,
.log-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 120px),
    var(--surface);
  box-shadow: var(--shadow-panel), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.workflow,
.client-brand-panel,
.prompt-workspace,
.status-grid,
.progress-panel,
.generation-strip,
.editor-panel {
  margin-bottom: 18px;
}

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

.panel-heading h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 13px;
  margin-right: 9px;
  vertical-align: -1px;
  border-radius: 2px;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal-glow);
}

.panel-heading span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Form fields ---------- */
.workflow {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 180px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

select,
input,
textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-2);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), background 150ms var(--ease);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%2393a1b5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

textarea {
  min-height: 64px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

select:hover,
input:hover,
textarea:hover {
  border-color: #2a3f5f;
}

select:focus-visible,
input:focus-visible,
textarea:focus-visible,
input[type="file"]:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-tint), 0 0 22px -6px var(--teal-glow);
}

input[type="file"] {
  padding: 8px 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
input[type="file"]::file-selector-button:hover {
  border-color: var(--teal);
  color: var(--teal-bright);
}

input[type="range"] {
  min-height: auto;
  width: 100%;
  padding: 0;
  accent-color: var(--teal);
  background: transparent;
}

input[type="checkbox"] {
  min-height: auto;
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--teal);
}

/* ---------- Buttons ---------- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 140ms var(--ease), border-color 140ms var(--ease),
    color 140ms var(--ease), background 140ms var(--ease), box-shadow 140ms var(--ease);
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
  color: var(--teal-bright);
  background: var(--teal-tint);
  box-shadow: 0 8px 22px -14px var(--teal-glow);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-tint);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-2);
  box-shadow: none;
}

/* Hero action */
#generateCarousel {
  border-color: transparent;
  color: #04181b;
  background: linear-gradient(180deg, var(--teal-bright), var(--teal));
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(34, 211, 197, 0.5), 0 10px 30px -10px var(--teal-glow);
}
#generateCarousel:hover:not(:disabled) {
  color: #04181b;
  background: linear-gradient(180deg, #6ff2e6, var(--teal-bright));
  box-shadow: 0 0 0 1px var(--teal), 0 14px 36px -10px var(--teal-glow);
}

/* Download ZIP pill */
.download-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--teal-dim);
  border-radius: var(--r-sm);
  color: var(--teal-bright);
  background: rgba(14, 124, 134, 0.14);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease),
    transform 140ms var(--ease), color 140ms var(--ease);
}
.download-link::before {
  content: "▼";
  font-size: 10px;
  opacity: 0.8;
}
.download-link:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
  box-shadow: 0 10px 28px -12px var(--teal-glow);
}
.download-link[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.4;
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-2);
}
.download-link:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-tint);
}

/* ---------- Tooltips (floating, JS-positioned; escapes overflow + stacking) ---------- */
.app-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  max-width: min(300px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  background: #05101c;
  box-shadow: var(--shadow-pop);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 130ms var(--ease), transform 130ms var(--ease);
}
.app-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.app-tooltip[hidden] {
  display: none;
}
.app-tooltip::after {
  content: "";
  position: absolute;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border: 6px solid transparent;
}
.app-tooltip[data-placement="top"]::after {
  top: 100%;
  border-top-color: #05101c;
}
.app-tooltip[data-placement="bottom"]::after {
  bottom: 100%;
  border-bottom-color: #05101c;
}

/* ---------- Client / Brand panel ---------- */
.client-brand-panel,
.json-panel,
.prompt-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.logo-uploader {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 0.45fr) minmax(150px, 0.55fr) auto auto auto minmax(120px, auto);
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface-inset);
}
.logo-uploader label {
  min-width: 0;
}

.range-row {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 48px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 12px;
  background: var(--surface-2);
}
.range-row output {
  color: var(--teal-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.logo-preview-box {
  width: 96px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: #0a1220;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}
.logo-preview-box img {
  max-width: 84px;
  max-height: 34px;
  object-fit: contain;
}

.logo-uploader > span {
  align-self: end;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Prompt workspace ---------- */
.prompt-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

.json-editor,
.prompt-editor {
  width: 100%;
  min-height: 230px;
  border-radius: var(--r-sm);
  background: var(--surface-inset);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  resize: vertical;
  caret-color: var(--teal);
  tab-size: 2;
}
.client-brand-editor {
  min-height: 190px;
}

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

/* ---------- Status grid (telemetry) ---------- */
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  padding: 0;
}
.status-grid > div {
  position: relative;
  min-height: 92px;
  padding: 16px 18px;
}
.status-grid > div + div {
  border-left: 1px solid var(--line);
}
.status-grid > div::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 0;
  width: 3px;
  height: 14px;
  background: var(--muted-2);
  border-radius: 0 2px 2px 0;
}
.status-grid > div:nth-child(2)::before {
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal-glow);
}
.status-grid > div:nth-child(3)::before {
  background: var(--danger);
}
.status-grid span {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.status-grid strong {
  display: block;
  margin-top: 10px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
#readySlides {
  color: var(--teal-bright);
}
.status-grid > div:last-child strong {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ---------- Progress ---------- */
.progress-panel {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}
.progress-panel > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#progressLabel {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#progressPercent {
  color: var(--teal-bright);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.progress-panel progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-inset);
}
.progress-panel progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-inset);
}
.progress-panel progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal-bright));
  box-shadow: 0 0 14px var(--teal-glow);
  transition: width 300ms var(--ease);
}
.progress-panel progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal-bright));
}

/* ---------- Generation strip ---------- */
.generation-strip {
  padding: 16px;
}
.strip-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.strip-heading h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 13px;
  margin-right: 9px;
  vertical-align: -1px;
  border-radius: 2px;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal-glow);
}
.strip-heading span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.run-history {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}
.empty-state {
  padding: 14px 2px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.run-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  flex: 0 0 min(300px, 82vw);
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 12px;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
  animation: fade-in 400ms var(--ease) both;
}
.run-item:hover {
  border-color: #2a3f5f;
  box-shadow: var(--shadow-pop);
}
.run-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.run-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.run-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.run-actions {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
}
.run-actions button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
}
.run-delete {
  border-color: rgba(255, 98, 89, 0.34);
  color: var(--danger);
  background: transparent;
}
.run-delete:hover {
  border-color: var(--danger);
  color: #fff;
  background: var(--danger-tint);
  box-shadow: 0 8px 22px -14px rgba(255, 98, 89, 0.5);
}

/* ---------- Slide editor ---------- */
.editor-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}
.editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.editor-head h2 {
  white-space: nowrap;
}
.editor-head h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 13px;
  margin-right: 9px;
  vertical-align: -1px;
  border-radius: 2px;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal-glow);
}
.editor-head button {
  white-space: nowrap;
}
.editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 16px 18px;
}
.editor-grid label {
  min-width: 0;
}
.editor-grid textarea {
  min-height: 44px;
}
.toggle-field {
  align-self: start;
}
.toggle-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 12px;
  color: var(--ink-dim);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* ---------- Workbench: log + previews ---------- */
.workbench {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
}

.log-panel,
.preview-panel {
  min-height: 440px;
}

/* Terminal-style log */
.log-panel {
  position: relative;
  overflow: hidden;
  padding: 18px;
}
.log-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.018) 0,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
}
.log-panel h2::before {
  content: "› ";
  color: var(--teal);
  font-family: var(--font-mono);
}
pre#log {
  position: relative;
  z-index: 1;
  overflow: auto;
  margin: 14px 0 0;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-panel {
  padding: 16px;
}
.slides {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.slide-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease);
  animation: fade-in 420ms var(--ease) both;
}
.slide-card:hover {
  transform: translateY(-3px);
  border-color: #2a3f5f;
  box-shadow: var(--shadow-pop);
}
.slide-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal), 0 0 26px -6px var(--teal-glow);
}
.slide-card img {
  display: block;
  width: 100%;
  aspect-ratio: var(--preview-aspect-ratio, 4 / 5);
  object-fit: contain;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.03) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.03) 75%),
    #070d16;
  background-size: 18px 18px, 18px 18px, auto;
  background-position: 0 0, 9px 9px, 0 0;
}

/* Empty preview slot — "awaiting signal" */
.placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: var(--preview-aspect-ratio, 4 / 5);
  background: var(--surface-inset);
  background-image:
    repeating-linear-gradient(-45deg, rgba(148, 178, 216, 0.05) 0, rgba(148, 178, 216, 0.05) 1px, transparent 1px, transparent 12px);
}
.placeholder::after {
  content: "◐ AWAITING SIGNAL";
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.slide-meta {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}
.slide-meta strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}
.slide-meta > span:first-of-type {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--teal-tint);
  color: var(--teal-bright);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.slide-meta span {
  color: var(--muted);
}
.slide-regen {
  width: 100%;
  min-height: 34px;
  margin-top: 4px;
  padding: 0 10px;
  font-size: 10.5px;
}

.failed {
  color: var(--danger) !important;
  background: var(--danger-tint) !important;
}

/* ---------- Motion ---------- */
@keyframes led-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--teal-glow);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(34, 211, 197, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 211, 197, 0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shell > section {
  animation: rise 620ms var(--ease) both;
}
.shell > section:nth-child(1) { animation-delay: 40ms; }
.shell > section:nth-child(2) { animation-delay: 90ms; }
.shell > section:nth-child(3) { animation-delay: 140ms; }
.shell > section:nth-child(4) { animation-delay: 190ms; }
.shell > section:nth-child(5) { animation-delay: 240ms; }
.shell > section:nth-child(6) { animation-delay: 290ms; }
.shell > section:nth-child(7) { animation-delay: 340ms; }
.shell > section:nth-child(8) { animation-delay: 390ms; }
.shell > section:nth-child(9) { animation-delay: 440ms; }

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

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

@media (max-width: 840px) {
  .shell {
    padding: 20px 16px 48px;
  }
  .toolbar {
    display: grid;
  }
  .prompt-workspace {
    grid-template-columns: 1fr;
  }
  .logo-uploader {
    grid-template-columns: 1fr;
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status-grid > div:nth-child(3) {
    border-left: 0;
  }
}

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