/* Color palette - simplified */
:root {
  /* Base */
  --white: #fff;
  --black: #333;
  --gray-bg: #f5f5f5;
  --gray-border: #ccc;
  --gray-muted: #666;

  /* Dark theme (terminal) */
  --dark-bg: #1e1e1e;
  --dark-surface: #2d2d2d;
  --dark-text: #ccc;

  /* Terminal semantic */
  --term-info: #9cdcfe;
  --term-success: #4ec9b0;
  --term-error: #f48771;
  --term-warning: #dcdcaa;
  --term-agent: #ce9178;

  /* Accent */
  --yellow: #ffc107;
  --yellow-light: #fffde7;
  --green: #4caf50;

  /* Danger */
  --red: #c00;
  --red-light: #ffebee;

  /* Segments (semantic) */
  --seg-purple: #f3e5f5;
  --seg-purple-text: #7b1fa2;
  --seg-blue: #e3f2fd;
  --seg-blue-text: #1976d2;
  --seg-green: #e8f5e9;
  --seg-green-text: #2e7d32;
}

/* Base */
* {
  box-sizing: border-box;
}
body {
  font-family: sans-serif;
  font-size: 13px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem;
}

/* Typography - only two sizes */
.text-sm {
  font-size: 11px;
}
.text-lg {
  font-size: 13px;
}
.text-bold {
  font-weight: 600;
}
.text-muted {
  color: var(--gray-muted);
}
.mono {
  font-family: monospace;
}

/* Headings */
h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -3%;
}
h2 {
  margin: 0 0 1rem 0;
  font-size: 18px;
  font-weight: 600;
}
h3 {
  margin: 0.5rem 0;
  font-size: 13px;
}

/* Series title (under main h1) */
.series-title {
  color: var(--gray-muted);
}

/* Section headers */
.section-header {
  margin: 0 0 1rem 0;
  font-size: 13px;
  font-weight: 600;
}
.section-header.episode-title {
  margin-bottom: 1rem;
}

/* Utilities */
.hidden {
  display: none !important;
}
.stale {
  opacity: 0.4;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--black);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: var(--gray-bg);
  border: 1px solid var(--gray-border);
  border-bottom: none;
  min-width: 4rem;
  text-align: center;
}
.tab:hover {
  background: var(--gray-border);
}
.tab.active {
  background: var(--white);
  border-bottom: 2px solid var(--white);
  margin-bottom: -2px;
  font-weight: 600;
}
.tab.unread {
  font-weight: 600;
}
.tab.generating {
  background: var(--yellow-light);
}
.tab.flash {
  animation: tab-flash 0.5s ease-out;
}
@keyframes tab-flash {
  0% {
    background: var(--green);
  }
  100% {
    background: var(--white);
  }
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: var(--black);
  color: var(--white);
  padding: 0.5rem 1rem;
  font-size: 11px;
  pointer-events: none;
  z-index: 100;
}

/* Loading animation */
.loading-dots {
  display: inline;
}
.loading-dots::after {
  content: "";
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
}

/* Section layout */
.section {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.action-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
button {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: 1px solid var(--black);
  background: var(--white);
  font-size: 11px;
}
button:hover {
  background: var(--gray-bg);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.primary {
  background: var(--black);
  color: var(--white);
}
button.primary:hover {
  background: var(--gray-muted);
}
button.danger {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* Batch in progress indicator */
.batch-in-progress {
  font-size: 11px;
  color: var(--gray-muted);
  font-style: italic;
}

/* Copyable box */
.copyable-box {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.copyable-box .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.5rem;
  z-index: 1;
}
.copyable-box .content {
  background: var(--gray-bg);
  padding: 0.5rem;
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid var(--gray-border);
  font-family: monospace;
  font-size: 11px;
}
.copyable-box.script-box {
  height: 500px;
}

/* Script + Logs layout */
.script-logs-container {
  display: grid;
  grid-template-columns: 0.5fr 1fr;
  gap: 0.5rem;
}
.logs-panel-wrapper {
  position: relative;
  height: 500px;
}
.logs-panel-buttons {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  display: flex;
  gap: 0.5rem;
}
.logs-panel {
  height: 100%;
  background: var(--dark-bg);
  font-family: monospace;
  font-size: 11px;
  overflow-y: auto;
  padding: 0.5rem;
}
.logs-elevator {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  font-size: 11px;
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--gray-muted);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 2;
}
.logs-elevator.visible {
  opacity: 1;
  pointer-events: auto;
}
.logs-elevator:hover {
  background: var(--dark-surface);
}

/* Log entries */
.log-entry {
  color: var(--dark-text);
  word-wrap: break-word;
}
.log-entry.info {
  color: var(--term-info);
}
.log-entry.success {
  color: var(--term-success);
  font-weight: 600;
}
.log-entry.error {
  color: var(--term-error);
  font-weight: 600;
}
.log-entry.warning {
  color: var(--term-warning);
  font-weight: 600;
}
.log-entry.agent {
  color: var(--term-agent);
}
.log-entry.tool {
  color: var(--term-warning);
}
.log-entry.separator {
  color: var(--gray-muted);
}
.log-entry.header {
  color: var(--term-agent);
  font-weight: 600;
}
.log-timestamp {
  color: var(--gray-muted);
  margin-right: 0.5rem;
}

/* Thoughts box */
.thoughts-box {
  background: var(--dark-bg);
}
.thoughts-header {
  padding: 0.5rem 1rem;
  background: var(--dark-surface);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
}
.thoughts-header:hover {
  background: var(--gray-muted);
}
.thoughts-header.claude {
  color: var(--term-agent);
}
.thoughts-header.gemini {
  color: var(--term-info);
}
.thoughts-header .toggle-icon {
  color: var(--gray-muted);
  font-size: 11px;
}
.thoughts-content {
  padding: 0.5rem;
  font-family: monospace;
  font-size: 11px;
  color: var(--dark-text);
  white-space: pre-wrap;
}
.thoughts-content.collapsed {
  display: none;
}

/* Beat card */
.beat-card {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--gray-border);
  overflow-anchor: none;
}
.beat-card.processing {
  background: var(--yellow-light);
  border-color: var(--yellow);
}
.beat-card.highlighted {
  animation: highlight-pulse 2s ease-out;
}
.beat-content {
  padding: 0;
}
.beat-content-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Reference images */
.ref-images {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  height: 80px;
  overflow: hidden;
}
.ref-images > div {
  flex-shrink: 0;
  height: 100%;
}
.ref-image {
  height: 100%;
  width: auto;
  border: 1px solid var(--gray-border);
  cursor: zoom-in;
}
.ref-filename {
  display: none;
}

/* Prompt */
.prompt-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.prompt-column .prompt-textarea {
  min-height: 100px;
}
.prompt-box {
  position: relative;
}
.prompt-box .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.5rem;
  z-index: 1;
}
.prompt-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: monospace;
  font-size: 11px;
  padding: 0.5rem;
  border: 1px solid var(--gray-border);
  background: var(--gray-bg);
  white-space: pre-wrap;
  resize: none;
  overflow: hidden;
}
.prompt-textarea.editing {
  background: var(--yellow-light);
  resize: vertical;
}
.version-indicator {
  color: var(--gray-muted);
  min-width: 40px;
  text-align: center;
  font-size: 11px;
}

/* Banana output */
.banana-output {
  margin-top: 0.5rem;
  position: relative;
}
.banana-output.verification-failed {
  outline: 0.5rem solid var(--red);
  outline-offset: -0.5rem;
}
.banana-image {
  width: 100%;
  height: auto;
  aspect-ratio: 21 / 9;
  display: block;
  cursor: zoom-in;
}
.panels-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}
.panel-container {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.panel-image {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  cursor: zoom-in;
}
.panel-dialogue {
  padding: 0.5rem 0;
  font-size: 11px;
  font-family: monospace;
  line-height: 1.4;
  color: var(--gray-text);
  border-radius: 0 0 4px 4px;
  min-height: 2.5rem;
}
.verification-status {
  display: block;
  padding: 0.5rem 1rem 1rem 1rem;
  background: var(--red-light);
  color: var(--red);
  font-weight: 600;
  font-size: 11px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 95%;
  max-height: 95%;
}
.lightbox-caption {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  background: rgba(0, 0, 0, 0.7);
  padding: 0.5rem 1rem;
  font-size: 11px;
}

/* Progress bar */
.progress-bar {
  flex: 1;
  align-self: stretch;
  background: var(--white);
  overflow: hidden;
  border: 1px solid var(--gray-border);
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  width: 0;
  background: var(--black);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--white);
  mix-blend-mode: difference;
  pointer-events: none;
}
.progress-bar.active .progress-bar-fill {
  animation: progress-fill 25s ease-out forwards;
}
.progress-bar.active[data-duration="20"] .progress-bar-fill {
  animation-duration: 20s;
}
.progress-bar.active[data-duration="25"] .progress-bar-fill {
  animation-duration: 25s;
}
.progress-bar.active[data-duration="30"] .progress-bar-fill {
  animation-duration: 30s;
}
.progress-bar.complete .progress-bar-fill {
  width: 100%;
  animation: none;
}
@keyframes progress-fill {
  0% {
    width: 0;
  }
  5% {
    width: 15%;
  }
  15% {
    width: 35%;
  }
  30% {
    width: 50%;
  }
  50% {
    width: 65%;
  }
  70% {
    width: 75%;
  }
  85% {
    width: 82%;
  }
  100% {
    width: 88%;
  }
}

/* Readme footer */
.readme-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--gray-border);
  padding-top: 1rem;
}
.readme-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.readme-col ul {
  margin: 0;
  padding-left: 1rem;
}
.readme-col li {
  margin-bottom: 0.5rem;
  line-height: 1.4;
  font-size: 11px;
}
.readme-col h3 {
  margin: 0 0 0.5rem 0;
  font-size: 13px;
}
.readme-col h3:not(:first-of-type) {
  margin-top: 1rem;
}

/* Timeline card */
.timeline-card {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--gray-border);
}
.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.timeline-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
}
.timeline-footer .timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0;
  margin: 0;
  border: none;
}
.timeline-footer .timeline-stats {
  color: var(--gray-muted);
  white-space: nowrap;
  font-size: 11px;
}

/* Timeline track */
.timeline-track {
  display: flex;
  height: 32px;
  overflow: hidden;
}
.timeline-block {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.timeline-block:hover {
  opacity: 0.8;
}
.timeline-block .block-label {
  color: white;
  font-weight: 600;
  font-size: 11px;
}
.char-legend {
  padding-left: 0.5rem;
  color: var(--gray-muted);
  font-size: 11px;
}

/* Timeline segments list */
.timeline-segments-list {
  max-height: 200px;
  overflow-y: auto;
  font-family: monospace;
  border: 1px solid var(--gray-border);
}
.timeline-segment {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 11px;
}
.timeline-segment.clickable {
  cursor: pointer;
}
.timeline-segment.clickable:hover,
.timeline-segment.clickable:hover * {
  background: var(--black);
  color: var(--white);
}
.timeline-segment.highlighted {
  animation: highlight-blink 0.3s ease-in-out 3;
}
.timeline-position {
  color: var(--gray-muted);
  min-width: 30px;
}
.timeline-duration {
  color: var(--gray-muted);
  min-width: 25px;
}
.timeline-beat {
  color: var(--gray-muted);
  min-width: 25px;
}
.timeline-type {
  min-width: 70px;
  font-weight: 600;
  font-size: 11px;
}
.timeline-speaker {
  color: var(--term-agent);
  font-weight: 600;
}
.timeline-paren {
  color: var(--term-agent);
}
.timeline-segment .timeline-text {
  flex: 1;
}

/* Segment type colors */
.timeline-seg-dialogue {
  background: var(--gray-bg);
}
.timeline-seg-action {
  background: var(--seg-purple);
}
.timeline-seg-action .timeline-type {
  color: var(--seg-purple-text);
}
.timeline-seg-transition {
  background: var(--seg-blue);
}
.timeline-seg-transition .timeline-type {
  color: var(--seg-blue-text);
}
.timeline-seg-vo {
  background: var(--seg-green);
}
.timeline-seg-vo .timeline-type {
  color: var(--seg-green-text);
}

/* Highlight animations */
@keyframes highlight-blink {
  0%,
  100% {
    background: inherit;
  }
  50% {
    background: var(--yellow);
  }
}
@keyframes highlight-pulse {
  0% {
    box-shadow: 0 0 0 3px var(--yellow);
  }
  100% {
    box-shadow: none;
  }
}

/* Version footer */
.version-footer {
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
  color: var(--gray-muted);
  font-size: 11px;
  border-top: 1px solid var(--gray-border);
}
