* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fef9f3;
  --sidebar-bg: #2d2a26;
  --sidebar-text: #f5efe8;
  --accent: #e8734a;
  --accent-hover: #d4623b;
  --border: #e8ddd4;
  --text: #3d2c1e;
  --text-light: #7a6b5e;
  --card-bg: #ffffff;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

.btn-new {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background 0.2s;
}

.btn-new:hover { background: var(--accent-hover); }

.strip-list { flex: 1; }

.strip-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.2s;
  font-size: 0.85rem;
}

.strip-item:hover { background: rgba(255,255,255,0.08); }
.strip-item.active { background: rgba(255,255,255,0.12); }

.strip-item-title {
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strip-item-meta {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* Main */
.main {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

/* Create Panel */
.create-panel { max-width: 560px; }

.create-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-light);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group { flex: 1; }

.btn-create {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.btn-create:hover { background: var(--accent-hover); }
.btn-create:disabled { opacity: 0.5; cursor: not-allowed; }

/* Console Panel */
.console-panel {
  background: #1e1e1e;
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #2d2d2d;
  color: #ccc;
  font-size: 0.8rem;
  font-weight: 500;
}

.console-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.console-close:hover { color: #fff; }

.progress-bar {
  height: 3px;
  background: #333;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.console-log {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.8rem;
  color: #a8e6a3;
  padding: 12px 14px;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Preview */
.preview-panel { max-width: 900px; }

.preview-header {
  margin-bottom: 24px;
}

.preview-header h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.preview-topic {
  font-size: 0.85rem;
  color: var(--text-light);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.panel-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative;
}

.panel-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.panel-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-regen-panel {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-regen-panel:hover { background: rgba(255,255,255,0.3); }

.preview-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-action {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.preview-outputs h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.output-thumbs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.output-thumbs a {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.output-thumbs img {
  height: 120px;
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main { padding: 20px; }
  .preview-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .sidebar h2 { margin-bottom: 0; margin-right: auto; }
  .strip-list { display: none; }
  .main { padding: 16px; }
  .preview-grid { grid-template-columns: 1fr; }
}
