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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #141414;
  border-right: 1px solid #222;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 1.2rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 1rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #222;
  margin-bottom: 0.5rem;
}

.sidebar-empty {
  padding: 1.5rem 1rem;
  color: #555;
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.5;
}

.sidebar-list {
  list-style: none;
  flex: 1;
}

.sidebar-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.sidebar-item:hover {
  background: rgba(108, 99, 255, 0.08);
}

.sidebar-item.active {
  background: rgba(108, 99, 255, 0.15);
  border-left: 3px solid #6c63ff;
}

.sidebar-item-icon {
  font-size: 1.1rem;
  margin-top: 1px;
  flex-shrink: 0;
}

.sidebar-item-info {
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.sidebar-item-name {
  font-size: 0.85rem;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item-meta {
  font-size: 0.72rem;
  color: #555;
  margin-top: 2px;
}

.sidebar-item-remove {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.sidebar-item:hover .sidebar-item-remove {
  opacity: 1;
}

.sidebar-item-remove:hover {
  color: #ff4444;
}

.sidebar-clear {
  padding: 0.6rem 1rem;
  margin-top: auto;
}

.sidebar-clear button {
  width: 100%;
  padding: 0.4rem;
  background: none;
  border: 1px solid #2a2a2a;
  color: #666;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: all 0.15s;
}

.sidebar-clear button:hover {
  border-color: #ff4444;
  color: #ff6b6b;
  background: rgba(255, 68, 68, 0.05);
}

.main-content {
  flex: 1;
  min-width: 0;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.subtitle {
  color: #888;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* Upload area */
.upload-area {
  border: 2px dashed #333;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1.5rem;
}

.upload-area:hover, .upload-area.dragover {
  border-color: #6c63ff;
  background: rgba(108, 99, 255, 0.05);
}

.upload-area input { display: none; }

.upload-area .icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  display: block;
}

.upload-area p { color: #888; }

/* Progress */
.progress-section {
  display: none;
  margin-bottom: 2rem;
}

.progress-section.visible { display: block; }

.progress-bar-track {
  height: 6px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: #6c63ff;
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}

.progress-label {
  font-size: 0.85rem;
  color: #888;
}

/* Editor */
.editor-section {
  display: none;
}

.editor-section.visible { display: block; }

/* Audio player */
.player {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
}

.player audio {
  width: 100%;
  outline: none;
}

/* Waveform */
.waveform-container {
  position: relative;
  height: 80px;
  background: #111;
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
  cursor: pointer;
}

.waveform-container canvas {
  width: 100%;
  height: 100%;
}

.waveform-playhead {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: #6c63ff;
  pointer-events: none;
  transition: left 0.05s linear;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.toolbar button {
  padding: 0.55rem 1.2rem;
  border: 1px solid #333;
  background: #1a1a1a;
  color: #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.toolbar button:hover {
  border-color: #6c63ff;
  background: rgba(108, 99, 255, 0.1);
}

.toolbar button.danger:hover {
  border-color: #ff4444;
  background: rgba(255, 68, 68, 0.1);
}

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

/* Transcript */
.transcript-label {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.transcript {
  background: #1a1a1a;
  border: 1px solid #282828;
  border-radius: 12px;
  padding: 1.5rem;
  min-height: 200px;
  line-height: 2;
  font-size: 1.05rem;
  position: relative;
}

.word {
  display: inline;
  padding: 2px 1px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.word:hover {
  background: rgba(108, 99, 255, 0.15);
}

.word.playing {
  background: rgba(108, 99, 255, 0.3);
}

.word.selected {
  background: rgba(108, 99, 255, 0.4);
}

.word.deleted {
  background: rgba(255, 68, 68, 0.2);
  color: #ff6b6b;
  text-decoration: line-through;
}

.word .timestamp-tip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.word:hover .timestamp-tip {
  display: block;
}

/* Model selection */
.model-select-section {
  margin-bottom: 1.5rem;
}

.model-select-section label {
  font-size: 0.9rem;
  color: #888;
  margin-right: 0.5rem;
}

.model-select-section select {
  padding: 0.4rem 0.8rem;
  background: #1a1a1a;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Instructions */
.instructions {
  background: #1a1a1a;
  border: 1px solid #282828;
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #999;
  line-height: 1.6;
}

.instructions strong { color: #ccc; }

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #6c63ff;
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 1000;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Sidebar toggle button (mobile) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1100;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #e0e0e0;
  font-size: 1.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}

.sidebar-overlay {
  display: none;
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
  body { display: block; }

  .sidebar-toggle { display: block; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
  }
  .sidebar-overlay.visible { display: block; }

  .sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .container {
    padding: 1rem 0.75rem;
    padding-top: 3.5rem; /* room for hamburger */
  }

  h1 { font-size: 1.4rem; }

  .upload-area { padding: 2rem 1rem; }

  .model-select-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .instructions {
    font-size: 0.8rem;
    padding: 0.8rem 1rem;
  }

  .player { padding: 0.8rem; }

  .toolbar {
    gap: 0.4rem;
  }
  .toolbar button {
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  .transcript {
    padding: 1rem;
    font-size: 0.95rem;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
}
