:root {
  --bg: #090b10;
  --card: #12151e;
  --card-border: #1e2433;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #06b6d4;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --success: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', sans-serif; }
body { background: var(--bg); color: var(--text); min-height: 100vh; padding: 24px 16px 60px; }
.container { max-width: 1140px; margin: 0 auto; }
header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--card-border); margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; box-shadow: 0 4px 20px rgba(99,102,241,0.35); }
.brand-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.brand-desc { font-size: 13px; color: var(--text-muted); }
.badge-router { display: inline-flex; align-items: center; gap: 8px; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34d399; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px; }
.badge-router .dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 10px #10b981; }
.grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 28px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; padding: 24px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.drop-zone { border: 2px dashed #2d3748; border-radius: 14px; padding: 32px 20px; text-align: center; cursor: pointer; transition: 0.2s; background: rgba(255,255,255,0.01); }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.drop-zone input { display: none; }
.preview-grid { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.preview-thumb { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; border: 1px solid var(--card-border); }
.form-group { margin-top: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.input-text { width: 100%; background: #0c0e15; border: 1px solid var(--card-border); border-radius: 10px; padding: 12px 14px; color: #fff; font-size: 14px; outline: none; transition: 0.2s; }
.input-text:focus { border-color: var(--primary); }
.options-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.select-card { border: 1px solid var(--card-border); background: #0d1017; border-radius: 10px; padding: 12px; cursor: pointer; transition: 0.2s; text-align: center; }
.select-card.active { border-color: var(--primary); background: rgba(99,102,241,0.12); color: #fff; }
.select-card .title { font-size: 13px; font-weight: 700; }
.select-card .subtitle { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.shots-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shot-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #0d1017; border: 1px solid var(--card-border); border-radius: 10px; font-size: 13px; }
.shot-badge { font-size: 11px; background: rgba(99,102,241,0.2); color: #a5b4fc; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.btn-submit { width: 100%; margin-top: 24px; padding: 14px; border: none; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: 0 4px 15px rgba(99,102,241,0.4); transition: 0.2s; }
.btn-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.5); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.preview-card { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 480px; position: relative; }
.phone-mockup { width: 260px; height: 462px; background: #000; border-radius: 28px; border: 4px solid #2d3748; box-shadow: 0 15px 40px rgba(0,0,0,0.6); overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; }
.phone-mockup video { width: 100%; height: 100%; object-fit: cover; }
.phone-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 20px; }
.progress-box { width: 100%; margin-top: 18px; }
.progress-bar-bg { width: 100%; height: 8px; background: #1e2433; border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.3s; }
.progress-status { font-size: 13px; color: var(--text-muted); margin-top: 8px; text-align: center; }
.btn-download { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; padding: 12px 24px; background: var(--success); color: #fff; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 14px; transition: 0.2s; width: 100%; }
.btn-download:hover { opacity: 0.9; }
.history-section { margin-top: 40px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; }
.history-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; padding: 12px; text-align: center; }
.history-card video { width: 100%; height: 260px; object-fit: cover; border-radius: 8px; }
.history-title { font-size: 12px; color: var(--text-muted); margin: 8px 0; word-break: break-all; }


.saved-photos-grid { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: thin; }
.saved-photo-item { position: relative; flex-shrink: 0; width: 76px; height: 76px; border-radius: 10px; border: 2px solid var(--card-border); cursor: pointer; transition: 0.2s; overflow: hidden; background: #000; }
.saved-photo-item:hover { border-color: var(--accent); }
.saved-photo-item.selected { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56,189,248,0.4); }
.saved-photo-item img { width: 100%; height: 100%; object-fit: cover; }
.saved-photo-badge { position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; background: #38bdf8; color: #000; font-size: 11px; font-weight: 800; border-radius: 50%; display: none; align-items: center; justify-content: center; }
.saved-photo-item.selected .saved-photo-badge { display: flex; }
.btn-del-photo { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; background: rgba(0,0,0,0.7); border: none; border-radius: 4px; color: #ef4444; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0.8; transition: 0.2s; }
.btn-del-photo:hover { opacity: 1; background: #ef4444; color: #fff; }

.history-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn-del-video { padding: 6px 12px; font-size: 12px; background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; border-radius: 10px; cursor: pointer; font-weight: 600; transition: 0.2s; }
.btn-del-video:hover { background: #ef4444; color: #fff; }

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* Mode Switcher Tabs */
.mode-tabs { display: flex; gap: 10px; margin-bottom: 24px; border-bottom: 1px solid var(--card-border); padding-bottom: 12px; }
.mode-tab { background: #0c0f17; border: 1px solid var(--card-border); color: var(--text-muted); border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.mode-tab:hover { border-color: var(--primary); color: #fff; }
.mode-tab.active { background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(6,182,212,0.15)); border-color: var(--primary); color: #fff; box-shadow: 0 4px 15px rgba(99,102,241,0.2); }
.tab-pill { background: linear-gradient(90deg, #ec4899, #8b5cf6); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; font-weight: 800; letter-spacing: 0.5px; }

/* AI Thinking Section & Result Cards */
.ai-results-wrapper { margin-top: 28px; display: flex; flex-direction: column; gap: 20px; }
.dna-card { background: linear-gradient(135deg, #101422, #141a2e); border: 1px solid #2d3752; border-radius: 16px; padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.dna-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.dna-item { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 12px; }
.dna-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 6px; }
.dna-val { font-size: 13px; font-weight: 600; color: #f1f5f9; line-height: 1.4; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dna-chip { font-size: 11px; background: rgba(6,182,212,0.15); border: 1px solid rgba(6,182,212,0.3); color: #38bdf8; padding: 3px 8px; border-radius: 6px; font-weight: 600; }

/* Reasoning box */
.reasoning-box { background: #0b0e14; border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; }
.reasoning-header { padding: 12px 16px; background: #0f131c; font-size: 13px; font-weight: 700; color: #a5b4fc; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.reasoning-content { padding: 14px 16px; font-size: 12px; color: #94a3b8; line-height: 1.6; white-space: pre-wrap; max-height: 250px; overflow-y: auto; display: none; font-family: monospace; border-top: 1px solid var(--card-border); }

/* Storyboard Shot Cards */
.storyboard-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.sb-shot-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; padding: 18px; transition: 0.2s; position: relative; }
.sb-shot-card:hover { border-color: #38bdf8; }
.sb-shot-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sb-shot-title { font-weight: 700; font-size: 15px; color: #fff; display: flex; align-items: center; gap: 8px; }
.sb-badge-type { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(99,102,241,0.2); color: #a5b4fc; }
.sb-badge-dur { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(16,185,129,0.2); color: #34d399; }
.sb-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; font-size: 12px; }
@media (max-width: 600px) { .sb-details { grid-template-columns: 1fr; } }
.sb-detail-item { background: #0c0f17; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.04); }
.sb-prompt-container { position: relative; margin-top: 8px; }
.sb-prompt-box { width: 100%; min-height: 75px; background: #07090e; border: 1px solid #1e2538; border-radius: 10px; padding: 12px 14px; color: #38bdf8; font-family: monospace; font-size: 12px; line-height: 1.5; resize: vertical; outline: none; }
.sb-prompt-box:focus { border-color: #38bdf8; }
.btn-copy-prompt { position: absolute; top: 8px; right: 8px; background: #1e2433; border: 1px solid #2d3748; color: #f8fafc; font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 6px; cursor: pointer; transition: 0.2s; }
.btn-copy-prompt:hover { background: #38bdf8; color: #000; border-color: #38bdf8; }

/* Google Flow Action Box */
.flow-action-card { background: linear-gradient(135deg, #0e1726, #111e38); border: 1px solid #1e3a6a; border-radius: 16px; padding: 22px; }
.flow-action-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.flow-title { font-weight: 800; font-size: 16px; color: #60a5fa; display: flex; align-items: center; gap: 8px; }
.flow-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-flow { padding: 9px 16px; font-size: 13px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: 0.2s; border: none; }
.btn-flow-copy { background: #1d4ed8; color: #fff; }
.btn-flow-copy:hover { background: #2563eb; }
.btn-flow-dl { background: #0f172a; border: 1px solid #334155; color: #cbd5e1; }
.btn-flow-dl:hover { background: #1e293b; color: #fff; }
.flow-webhook-row { display: flex; gap: 8px; margin-top: 14px; }
.flow-webhook-input { flex: 1; background: #070a12; border: 1px solid #1e293b; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #fff; }
.flow-webhook-btn { background: #10b981; color: #000; font-weight: 700; font-size: 13px; padding: 10px 16px; border-radius: 8px; border: none; cursor: pointer; transition: 0.2s; white-space: nowrap; }
.flow-webhook-btn:hover { background: #34d399; }

