:root {
  --bg: #111418;
  --card: #1b2028;
  --border: #2c3440;
  --text: #f0f3f7;
  --muted: #98a2b3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #d97706;
  --success: #16a34a;
  --danger: #dc2626;
  --secondary: #2d3644;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  font-size: 15px;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.sub {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

code {
  background: #252b34;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}

.status-pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-idle {
  background: #28303d;
  color: #cbd5e1;
}

.status-loading {
  background: #422006;
  color: #fde68a;
}

.status-ready {
  background: #052e16;
  color: #86efac;
}

.status-error {
  background: #450a0a;
  color: #fca5a5;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  background: var(--secondary);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  touch-action: manipulation;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-lg {
  min-height: 48px;
  font-size: 1rem;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.btn-primary {
  background: var(--primary);
}

.btn-secondary {
  background: var(--secondary);
  border-color: #3d4757;
}

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

.btn-success {
  background: var(--success);
}

.btn-danger {
  background: var(--danger);
}

.hint, .hint-inline {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.badge {
  background: #27303f;
  color: #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #14181e;
  border: 1px solid var(--border);
}

.file-item.active {
  border-color: var(--primary);
  background: #172236;
}

.file-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.file-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.file-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.empty-state {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 10px 4px;
  text-align: center;
}

.time-readout {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin: 8px 0 6px;
}

.muted {
  color: var(--muted);
}

.timeline-track-wrap {
  position: relative;
  padding: 12px 0;
}

.segment-overlay {
  position: relative;
  height: 12px;
  background: #0f1318;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.seg-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(37, 99, 235, 0.55);
  border-left: 2px solid #60a5fa;
  border-right: 2px solid #60a5fa;
}

.seg-bar.mode-cut {
  background: rgba(220, 38, 38, 0.55);
  border-color: #f87171;
}

.seg-bar.is-selected {
  outline: 2px solid #fbbf24;
  z-index: 2;
}

.scrubber {
  width: 100%;
  height: 36px;
  margin: 0;
  accent-color: #60a5fa;
  cursor: pointer;
}

.transport-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.mark-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.mt-8 {
  margin-top: 8px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 10px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #14181e;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.segments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seg-row {
  background: #14181e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seg-row.selected {
  border-color: #fbbf24;
}

.seg-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.seg-input-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seg-input-box label {
  font-size: 0.76rem;
  color: var(--muted);
}

.seg-input-row {
  display: flex;
  gap: 4px;
}

.seg-input-row input {
  width: 100%;
  min-width: 0;
  background: #0f1318;
  border: 1px solid #374151;
  color: var(--text);
  border-radius: 6px;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field select {
  background: #0f1318;
  color: var(--text);
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 480px) {
  .export-grid,
  .mode-switch {
    grid-template-columns: 1fr;
  }
}

.output-box {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #166534;
  background: #052e16;
  border-radius: 8px;
}

.output-box.hidden {
  display: none;
}

.output-audio {
  width: 100%;
  margin-top: 8px;
}

.logs-details {
  margin-top: 10px;
}

.logs-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
}

.log-output {
  background: #0b0e12;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  max-height: 180px;
  overflow: auto;
  font-size: 0.76rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0 0;
}
