:root {
  --bg: #0f0f13;
  --surface: #16161e;
  --surface2: #1e1e2a;
  --border: #2a2a3a;
  --accent: #6c8eff;
  --accent2: #4f6ef7;
  --text: #e8e8f0;
  --sub: #8888aa;
  --err: #ff5555;
  --ok: #50fa7b;
  --warn: #ffb86c;
  --info: #8be9fd;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 2rem 1rem;
  line-height: 1.6;
}

.container {
  max-width: 820px;
  margin: 0 auto;
}

h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #bd93f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.35rem;
}

.subtitle {
  color: var(--sub);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

/* ── Notices ── */
.notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border-left: 4px solid;
  background: var(--surface);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.notice.info  { border-color: var(--info);  color: var(--info); }

/* ── Upload Area ── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  margin-bottom: 1.25rem;
  position: relative;
}
.upload-area:hover  { border-color: var(--accent); background: rgba(108,142,255,.04); }
.upload-area.drag-over { border-color: var(--ok); background: rgba(80,250,123,.06); }

.upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.upload-area .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-area p    { font-size: 1rem; margin-bottom: 0.25rem; }
.upload-area p strong { color: var(--accent); }
.upload-area small { color: var(--sub); font-size: 0.8rem; }

/* ── Video Preview ── */
#videoPreview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 10px;
  display: none;
  margin-bottom: 1.25rem;
  background: #000;
  border: 1px solid var(--border);
}

/* ── Log Toggle ── */
.toggle-log-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--sub);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: border-color 0.2s;
}
.toggle-log-btn:hover { border-color: var(--accent); color: var(--text); }

/* ── Log Box ── */
.log-box {
  display: none;
  background: #0a0a0f;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--sub);
}
.log-clear-btn {
  background: none; border: none; cursor: pointer;
  color: var(--sub); font-size: 0.8rem;
  transition: color 0.2s;
}
.log-clear-btn:hover { color: var(--err); }
#logLines {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}
.log-line {
  font-size: 0.82rem;
  font-family: 'Fira Mono', 'Consolas', monospace;
  padding: 0.1rem 0;
  line-height: 1.5;
}
.log-line.info    { color: var(--info); }
.log-line.success { color: var(--ok); }
.log-line.warn    { color: var(--warn); }
.log-line.error   { color: var(--err); }

/* ── Steps ── */
.steps {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.step-card {
  flex: 1;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.step-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.step-num {
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
  flex-shrink: 0;
  transition: background 0.3s;
}
.step-num.loading { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.step-num.done    { background: var(--ok); color: #000; }
.step-num.error   { background: var(--err); }

.step-title { font-weight: 600; font-size: 0.95rem; }
.step-desc  { font-size: 0.82rem; color: var(--sub); min-height: 1.2em; margin-bottom: 0.5rem; }

.prog-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #bd93f9);
  border-radius: 99px;
  transition: width 0.35s ease;
}

/* ── Buttons ── */
.btn-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:active, .btn-secondary:active, .btn-danger:active {
  transform: scale(0.97);
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent2); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }
.btn-danger    { background: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

button:disabled { opacity: 0.38; cursor: not-allowed; }

.spinner {
  width: 0.9rem; height: 0.9rem;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
  flex-shrink: 0;
}

/* ── Transcription Box ── */
.transcription-box {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.transcription-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.transcription-header span { font-weight: 600; font-size: 0.95rem; }
.action-btns { display: flex; gap: 0.4rem; }

.sm-btn {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
}
.sm-btn:hover { border-color: var(--accent); color: var(--accent); }

.stats-bar {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.stat {
  font-size: 0.8rem;
  color: var(--sub);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
}
.stat strong { color: var(--text); }

#transcriptionText {
  padding: 1rem;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.75;
  min-height: 120px;
  color: var(--text);
}

/* ── Error ── */
.error-msg {
  display: none;
  background: rgba(255,85,85,.08);
  border: 1px solid var(--err);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: var(--err);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

/* ── Animations ── */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.6; } }
