* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0b0b0b; color: #e0e0e0; min-height: 100vh;
}
.container { max-width: 880px; margin: 0 auto; padding: 20px; }

header { margin-bottom: 20px; }
h1 { font-size: 1.5rem; color: #fff; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1rem; color: #ccc; font-weight: 600; }

.card {
  background: #151515; border-radius: 10px; padding: 16px; margin-bottom: 12px;
  border: 1px solid #262626;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.card-header h2 { margin: 0; }

.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid #333;
  background: #0b0b0b; color: #e0e0e0; font-size: 0.9rem; outline: none;
  transition: border-color 0.15s;
}
.input-row input:focus { border-color: #4a9eff; }
.input-row input::placeholder { color: #555; }

button {
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  background: #4a9eff; color: #fff; font-size: 0.9rem; font-weight: 600;
  white-space: nowrap; transition: background 0.15s;
}
button:hover { background: #3a8eef; }
button:active { transform: scale(0.97); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; background: #2a2a2a; color: #aaa; }
.btn-sm:hover { background: #3a3a3a; color: #fff; }
.btn-close { background: #3a1a1a; color: #e66; }
.btn-close:hover { background: #5a1a1a; }
.btn-danger { background: #5a1a1a; color: #ff6a6a; }
.btn-danger:hover { background: #7a1a1a; }

#addStatus { margin-top: 8px; font-size: 0.8rem; color: #666; min-height: 1em; }
#addStatus.success { color: #4caf50; }
#addStatus.error { color: #f44336; }

.empty { color: #555; text-align: center; padding: 16px; font-size: 0.85rem; }

/* Downloads */
#downloadList { display: flex; flex-direction: column; gap: 6px; }
.torrent-item {
  background: #0f0f0f; border-radius: 8px; padding: 10px 12px;
  border: 1px solid #222; transition: border-color 0.3s;
}
.torrent-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.torrent-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.85rem; color: #ddd;
}
.state-badge {
  font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.state-downloading { background: #1a3a5a; color: #6ab0ff; }
.state-seeding, .state-uploading { background: #1a3a1a; color: #6aff6a; }
.state-paused { background: #3a3a1a; color: #ffd06a; }
.state-metadl, .state-metadata { background: #2a1a3a; color: #b06aff; }
.state-error, .state-unknown { background: #3a1a1a; color: #ff6a6a; }
.state-checking, .state-check { background: #2a2a1a; color: #d0d06a; }
.state-queued { background: #1a2a2a; color: #6ad0d0; }
.state-stalled { background: #2a1a2a; color: #d06ad0; }

.progress-bar {
  height: 4px; background: #222; border-radius: 2px; overflow: hidden; margin-bottom: 4px;
}
.progress-fill {
  height: 100%; border-radius: 2px; transition: width 0.8s ease;
}
.progress-downloading { background: linear-gradient(90deg, #4a9eff, #6ab0ff); }
.progress-seeding { background: linear-gradient(90deg, #4caf50, #6aff6a); }
.progress-metadl { background: linear-gradient(90deg, #9c27b0, #b06aff); }
.progress-paused { background: #666; }
.progress-default { background: #4a9eff; }

.torrent-footer {
  display: flex; gap: 14px; font-size: 0.75rem; color: #666;
}
.torrent-footer span { white-space: nowrap; }

#torrentCount {
  font-size: 0.75rem; color: #555; background: #0f0f0f;
  padding: 2px 10px; border-radius: 10px;
}

/* File list */
#fileList { display: flex; flex-direction: column; gap: 4px; }
.file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #0f0f0f; border-radius: 6px;
  border: 1px solid #222; transition: border-color 0.15s;
}
.file-item:hover { border-color: #333; }
.file-item .name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.85rem; color: #ccc;
}
.file-item .size { color: #555; font-size: 0.8rem; white-space: nowrap; }
.file-item .actions { display: flex; gap: 4px; }
.file-item button {
  padding: 6px 14px; font-size: 0.75rem; font-weight: 600;
}
.play-btn { background: #1a4a1a; color: #6aff6a; }
.play-btn:hover { background: #2a5a2a; }
.delete-btn { background: #3a1a1a; color: #ff6a6a; }
.delete-btn:hover { background: #5a1a1a; }

/* Player */
#videoPlayer { width: 100%; max-height: 70vh; border-radius: 8px; background: #000; display: block; }
