:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  --ink: #1b2f38;
  --muted: #667984;
  --line: #d8e1e6;
  --panel: #ffffff;
  --soft: #f5f8fa;
  --accent: #2f6f8f;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--soft); color: var(--ink); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 360px 1fr; gap: 14px; padding: 14px; }
.left-panel, .stage-panel, .log-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.left-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 15px; margin: 0 0 8px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input, select, button { font: inherit; border-radius: 6px; border: 1px solid var(--line); padding: 9px 10px; }
input, select { background: #fff; color: var(--ink); }
button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button.secondary { background: #eef4f6; color: var(--ink); border-color: #d5e1e6; }
.check { flex-direction: row; align-items: center; color: var(--ink); }
.upload-progress {
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #edf3f6;
}
.upload-progress div {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width .15s ease;
}
.small-status { min-height: 18px; color: var(--muted); font-size: 12px; }
.stage-panel { display: grid; grid-template-rows: auto 1fr 210px; min-width: 0; }
.stage-tabs { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.stage-tabs button { background: #eef4f6; color: var(--ink); border-color: #d5e1e6; }
.stage-tabs button.active { background: var(--accent); color: #fff; }
.stage { min-height: 420px; display: grid; place-items: center; padding: 14px; }
.placeholder { width: min(900px, 100%); aspect-ratio: 11 / 7; border: 1px dashed #aebdc5; border-radius: 8px; display: grid; place-items: center; color: var(--muted); background: #fafcfd; }
.preview-shell {
  width: min(1100px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  align-self: stretch;
}
.preview-status { color: var(--muted); font-size: 13px; min-height: 18px; }
.movie-preview {
  min-height: 0;
  display: grid;
  place-items: center;
  background: #0d1418;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.preview-image {
  width: 100%;
  height: 100%;
  max-height: 68vh;
  object-fit: contain;
  display: block;
}
.graph-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
}
.graph-grid figure {
  margin: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
}
.graph-grid figcaption { color: var(--muted); font-size: 12px; text-align: center; }
.graph-image {
  width: 100%;
  aspect-ratio: 11 / 6;
  object-fit: contain;
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.log-panel { border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0 0 8px 8px; padding: 12px; min-height: 0; }
pre { margin: 0; white-space: pre-wrap; overflow: auto; height: 150px; color: #21343d; background: #f7fafb; border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #e8eef1;
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 18px 60px rgba(27, 47, 56, .14);
}
.auth-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.auth-message { min-height: 18px; color: #9a3412; font-size: 13px; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .graph-grid { grid-template-columns: 1fr; }
}
