:root{
  --bg: #14161a;
  --bg-panel: #191c21;
  --bg-panel-2: #1f232a;
  --line: #2b2f37;
  --line-soft: #23262d;
  --text: #ecebe6;
  --text-dim: #9a9da6;
  --text-muted: #8b8e96;
  --accent: #e8a33d;
  --accent-dim: #a9762c;
  --accent-ink: #1c1509;
  --risk-safe: #6fb98f;
  --risk-mid: #e0b84f;
  --risk-high: #d97757;
  --radius: 3px;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0; min-height:100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

::selection{ background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------- topbar */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #17191d 0%, #14161a 100%);
  position: sticky; top:0; z-index: 20;
  flex-wrap: wrap; gap: 14px;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand-mark{ color: var(--accent); font-size: 20px; }
.brand-text{ display:flex; flex-direction:column; line-height:1.15; }
.brand-name{ font-family: var(--serif); font-weight:600; font-size: 20px; letter-spacing: 0.02em; }
.brand-sub{ font-size: 11.5px; color: var(--text-muted); letter-spacing:0.02em; }

.tabs{ display:flex; gap:6px; background: var(--bg-panel); padding:4px; border-radius: var(--radius); border:1px solid var(--line); }
.tab{
  appearance:none; border:none; background:transparent; color: var(--text-muted);
  font-family: var(--sans); font-size: 13px; font-weight:600; letter-spacing:0.01em;
  padding: 9px 16px; border-radius: 2px; cursor:pointer; transition: all .15s ease;
  white-space: nowrap;
}
.tab:hover{ color: var(--text); }
.tab.active{ background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------- layout */
.stage{ max-width: 1320px; margin: 0 auto; padding: 32px 32px 90px; }
.panel{ display:none; }
.panel.active{ display:block; animation: fadein .2s ease; }
@keyframes fadein{ from{ opacity:0; transform: translateY(4px);} to{opacity:1; transform:none;} }

.grid-2{ display:grid; grid-template-columns: 1.5fr 1fr; gap: 28px; }
@media (max-width: 900px){ .grid-2{ grid-template-columns: 1fr; } }

.col-title{ font-family: var(--serif); font-weight:600; font-size: 20px; margin: 0 0 14px; }
.mini-title{ font-family: var(--sans); font-weight:700; font-size:13px; text-transform: none; margin: 0 0 8px; color: var(--text); }
.col-muted{ background: var(--bg-panel); border:1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.muted-text{ color: var(--text-muted); font-size: 13.5px; line-height:1.6; margin:0; }

.field-label{ display:block; font-size: 11.5px; color: var(--text-muted); margin: 14px 0 6px; font-weight:600; letter-spacing:0.01em; }
textarea, select, input[type=text]{
  width:100%; background: var(--bg-panel-2); border:1px solid var(--line);
  color: var(--text); border-radius: var(--radius); padding: 10px 12px;
  font-family: var(--sans); font-size: 13.5px; resize: vertical;
}
textarea:focus, select:focus{ outline:none; border-color: var(--accent-dim); }

.row3{ display:grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap:14px; align-items:end; margin-top: 4px;}
@media (max-width: 700px){ .row3{ grid-template-columns: 1fr 1fr; } }

.btn{
  font-family: var(--sans); font-weight:700; font-size: 13px; letter-spacing:0.01em;
  border-radius: var(--radius); padding: 11px 18px; cursor:pointer; border:1px solid transparent;
  transition: all .15s ease;
}
.btn-primary{ background: var(--accent); color: var(--accent-ink); width:100%; margin-top: 18px;}
.btn-primary:hover{ background:#f0ae4d; }
.btn-primary:disabled{ background:#3a3d44; color:#71747c; cursor:not-allowed; }
.btn-ghost{ background: transparent; border:1px solid var(--line); color: var(--text); }
.btn-ghost:hover{ border-color: var(--accent-dim); color: var(--accent); }
.btn-sm{ padding: 7px 12px; font-size:12px; margin-top:0; width:auto; }

.hint{ font-size: 12px; color: var(--text-muted); margin-top: 10px; line-height:1.5;}

/* ---------------------------------------------------------- dropzone */
.dropzone{
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  min-height: 180px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; background: var(--bg-panel-2); position:relative; overflow:hidden;
  transition: border-color .15s;
}
.dropzone:hover, .dropzone.drag{ border-color: var(--accent); }
.dz-inner{ display:flex; flex-direction:column; align-items:center; gap:6px; color: var(--text-muted); font-size:13px; padding: 20px;}
.dz-icon{ font-size:22px; color: var(--accent); }
.dz-note{ font-size:11px; opacity:.75; text-align:center; max-width:320px;}
#image-preview{ max-width:100%; max-height: 320px; display:block; margin: 0 auto; }
#video-preview{ width:100%; max-height:320px; display:block; }

/* ---------------------------------------------------------- briefs */
.briefs-wrap{ margin-top: 36px; }
.briefs-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.brief-card{
  background: var(--bg-panel); border:1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor:pointer; transition: all .15s ease; display:flex; flex-direction:column; gap:8px;
}
.brief-card:hover{ border-color: var(--accent-dim); transform: translateY(-1px); }
.brief-card.selected{ border-color: var(--accent); background: var(--bg-panel-2); }
.brief-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.brief-title{ font-family: var(--serif); font-weight:600; font-size:15.5px; line-height:1.3; }
.risk-pill{ font-size:10.5px; font-weight:700; padding: 3px 8px; border-radius: 20px; white-space:nowrap; }
.risk-Aman{ background: rgba(111,185,143,.15); color: var(--risk-safe); }
.risk-Sedang{ background: rgba(224,184,79,.15); color: var(--risk-mid); }
.risk-Tinggi{ background: rgba(217,119,87,.15); color: var(--risk-high); }
.brief-style{ font-family: var(--mono); font-size:10.5px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em;}
.brief-scenes{ font-size:12px; color: var(--text-muted); line-height:1.55; max-height:110px; overflow:auto; }
.brief-scenes b{ color: var(--text); }
.brief-colors{ display:flex; gap:5px; margin-top:2px;}
.color-dot{ width:16px; height:16px; border-radius:50%; border:1px solid rgba(255,255,255,.15); }
.brief-keywords{ font-size:10.5px; color: var(--text-muted); font-style:italic; }
.brief-pick-btn{ margin-top: 6px; }

/* ---------------------------------------------------------- result / preview */
.result-wrap{ margin-top: 36px; }
.result-grid{ display:grid; grid-template-columns: 1.15fr 0.85fr; gap: 22px; }
@media (max-width: 980px){ .result-grid{ grid-template-columns: 1fr; } }

.preview-head, .code-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; flex-wrap:wrap; gap:8px;}
.preview-title{ font-family: var(--serif); font-weight:600; font-size:16px; }
.preview-actions{ display:flex; gap:8px; flex-wrap:wrap; }

.preview-frame-wrap{
  background: repeating-conic-gradient(#22252b 0% 25%, #1b1d22 0% 50%) 0 0/18px 18px;
  border:1px solid var(--line); border-radius: var(--radius); overflow:hidden;
  display:flex; align-items:center; justify-content:center; min-height: 260px;
}
.preview-frame{ width:100%; aspect-ratio: 16/9; border:0; background:#000; display:block; }

.render-box{ margin-top:16px; background: var(--bg-panel); border:1px solid var(--line); border-radius: var(--radius); padding:14px; }
.render-head{ margin-bottom:8px; }
.render-row{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.render-row select{ width:auto; }
.render-row .field-label{ margin:0; }
.render-progress{ margin-top:12px; }
.render-bar{ height:6px; border-radius:4px; background: var(--bg-panel-2); overflow:hidden; }
.render-bar-fill{ height:100%; width:0%; background: var(--accent); transition: width .12s linear; }
.render-progress span{ font-size:11.5px; color: var(--text-muted); display:block; margin-top:6px;}
.render-result{ margin-top:14px; display:flex; flex-direction:column; gap:10px; }
.render-result video, .render-result img{ width:100%; border-radius: var(--radius); background:#000; }
.format-note{ font-size:11.5px; color: var(--text-muted); line-height:1.55; background: var(--bg-panel-2); border:1px solid var(--line-soft); border-radius: var(--radius); padding:10px 12px; margin-top:10px; }
.format-note code{ font-family: var(--mono); background:#101215; padding:1px 5px; border-radius:2px; color:#c9d1d9; }
.format-note.warn{ border-color: var(--risk-high); color:#f0b8a4; }
.ffmpeg-cmd{ display:block; font-family: var(--mono); font-size:11px; background:#101215; color:#c9d1d9; padding:10px 12px; border-radius: var(--radius); margin-top:8px; overflow-x:auto; white-space:pre; }

.code-block{
  background: #101215; border:1px solid var(--line); border-radius: var(--radius);
  padding:14px; max-height: 640px; overflow:auto; margin:0;
}
.code-block code{ font-family: var(--mono); font-size:12px; color:#c9d1d9; white-space:pre; line-height:1.55; }

.loading-inline{ color: var(--accent); font-size:13px; display:flex; align-items:center; gap:8px; margin-top:14px;}
.spinner{ width:14px; height:14px; border-radius:50%; border:2px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite;}
@keyframes spin{ to{ transform: rotate(360deg);} }

.error-box{ background: rgba(217,119,87,.1); border:1px solid var(--risk-high); color:#f0b8a4; border-radius:var(--radius); padding:12px 14px; font-size:13px; margin-top:14px; }

.image-analysis-active{ color: var(--text); }
