:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --panel: #121419;
  --panel-2: #181b21;
  --line: #2a2f39;
  --text: #f5f7fa;
  --muted: #9aa3af;
  --accent: #ffffff;
  --accent-text: #0a0b0d;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 15% 0%, #171b22 0, #0a0b0d 35%, #08090b 100%);
  color: var(--text);
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1500px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 40px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 8px; color: #6f7886; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 60px); line-height: .95; letter-spacing: -.045em; }
.subtitle { margin: 12px 0 0; color: var(--muted); }
.privacy-badge { border: 1px solid var(--line); background: #111318; color: #c9d0d9; padding: 8px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); background: rgba(18,20,25,.92); border-radius: var(--radius); box-shadow: 0 20px 70px rgba(0,0,0,.25); }
.controls-panel { padding: 18px; position: sticky; top: 18px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title-row h2, .export-panel h2 { margin: 0; font-size: 17px; }

.upload-box { display: flex; flex-direction: column; gap: 7px; align-items: center; justify-content: center; min-height: 150px; padding: 18px; border: 1px dashed #3a424f; border-radius: 15px; background: #0e1014; text-align: center; transition: .2s ease; }
.upload-box:hover, .upload-box.dragover { border-color: #8a95a6; background: #151820; }
.upload-box small { color: var(--muted); line-height: 1.45; }
.upload-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 21px; }
.file-card { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 12px; background: #0e1014; border-radius: 12px; border: 1px solid var(--line); }
.file-card > div { min-width: 0; display: grid; gap: 4px; }
.file-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card small { color: var(--muted); }

.control-group { margin-top: 18px; }
.control-group > label:first-child, .control-group .label-row label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 13px; color: #dde2e9; }
.label-row { display: flex; justify-content: space-between; align-items: center; }
.label-row output { color: var(--muted); font-size: 12px; }
.control-group small { display: block; margin-top: 7px; color: #737c89; line-height: 1.45; }
select, input[type="text"] { width: 100%; border: 1px solid var(--line); background: #0d0f13; color: var(--text); border-radius: 10px; padding: 10px 11px; outline: none; }
select:focus, input[type="text"]:focus { border-color: #6b7583; }
input[type="range"] { width: 100%; accent-color: #e8edf3; }
.check-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-row label { margin: 0 !important; border: 1px solid var(--line); background: #0d0f13; border-radius: 10px; padding: 10px; font-weight: 600 !important; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.seg { border: 0; border-right: 1px solid var(--line); background: #0d0f13; color: var(--muted); padding: 9px; }
.seg:last-child { border-right: 0; }
.seg.active { background: #e8edf3; color: #0b0d10; font-weight: 800; }

.viewer-column { min-width: 0; display: grid; gap: 14px; }
.viewer-card { min-height: min(68vh, 760px); border: 1px solid var(--line); background: #050607; border-radius: 22px; overflow: hidden; position: relative; box-shadow: 0 20px 70px rgba(0,0,0,.35); }
.empty-state { min-height: inherit; display: grid; place-items: center; align-content: center; text-align: center; padding: 28px; }
.empty-state h2 { margin: 18px 0 8px; font-size: clamp(22px, 3vw, 34px); }
.empty-state p { color: var(--muted); max-width: 520px; margin: 0 0 22px; line-height: 1.6; }
.empty-symbol { width: 140px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 30px; border: 1px solid #333a45; background: linear-gradient(145deg, #11151b, #080a0d); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 24px; letter-spacing: .08em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.02); }

.stage { width: 100%; height: min(68vh, 760px); position: relative; background: #000; }
.source-pane, .ascii-pane { position: absolute; inset: 0; overflow: hidden; }
.source-pane video, .ascii-pane canvas { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.pane-label { position: absolute; top: 12px; left: 12px; z-index: 3; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.48); backdrop-filter: blur(10px); border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 800; letter-spacing: .14em; color: #fff; }
.stage.mode-ascii .source-pane { display: none; }
.stage.mode-source .ascii-pane { display: none; }
.stage.mode-split .source-pane { clip-path: inset(0 50% 0 0); z-index: 2; }
.stage.mode-split .ascii-pane { clip-path: inset(0 0 0 50%); z-index: 1; }
.stage.mode-split::after { content: ""; position: absolute; z-index: 5; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(255,255,255,.55); }

.transport { padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; }
.round-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: #edf2f7; color: #0b0d10; font-weight: 900; }
.small-btn, .ghost-btn { border: 1px solid var(--line); background: #0d0f13; color: #cdd4dd; border-radius: 10px; padding: 8px 10px; }
.timeline-wrap { min-width: 0; }
.timeline-wrap input { width: 100%; }
.time-row { display: flex; justify-content: space-between; color: #8f98a5; font-size: 11px; margin-bottom: -2px; }

.export-panel { padding: 18px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.export-panel p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.export-actions { display: flex; gap: 9px; }
.primary-btn, .secondary-btn { border-radius: 11px; padding: 10px 14px; font-weight: 800; }
.primary-btn { background: #edf2f7; color: #0b0d10; border: 1px solid #edf2f7; }
.secondary-btn { background: #0d0f13; color: #e8edf3; border: 1px solid var(--line); }
.record-status { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: #ffb7b7; font-size: 13px; }
.record-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0 5px rgba(255,77,77,.1); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .controls-panel { position: static; }
  .topbar { align-items: flex-start; }
  .stage { height: 58vh; }
  .viewer-card { min-height: 58vh; }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 20px, 1500px); padding-top: 18px; }
  .topbar { display: block; }
  .privacy-badge { display: inline-block; margin-top: 12px; }
  .transport { grid-template-columns: auto 1fr auto; }
  #fullscreenBtn { display: none; }
  .export-panel { grid-template-columns: 1fr; }
  .export-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
