* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0d1117; color: #c9d1d9; min-height: 100vh; }
.hidden { display: none !important; }

.login-body { display: flex; align-items: center; justify-content: center; }
.login-box {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 40px; width: 380px; max-width: 90vw; text-align: center;
}
.login-box h1 { font-size: 22px; margin-bottom: 28px; color: #f0f6fc; }
.login-box input {
  width: 100%; padding: 12px 14px; margin-bottom: 14px;
  background: #0d1117; border: 1px solid #30363d; border-radius: 8px;
  color: #c9d1d9; font-size: 15px; outline: none;
}
.login-box input:focus { border-color: #58a6ff; }
.login-box button {
  width: 100%; padding: 12px; background: #238636; border: none;
  border-radius: 8px; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-box button:hover { background: #2ea043; }
.error-msg { color: #f85149; font-size: 13px; margin-bottom: 10px; min-height: 18px; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: #161b22; border-bottom: 1px solid #30363d;
}
header h1 { font-size: 20px; color: #f0f6fc; }
.logo-link { color: #f0f6fc; text-decoration: none; }
.logo-link:hover { color: #58a6ff; }
.logout-btn { color: #8b949e; text-decoration: none; font-size: 14px; }
.logout-btn:hover { color: #f85149; }

.url-section {
  display: flex; gap: 10px; padding: 24px; max-width: 800px; margin: 0 auto;
}
.url-section input {
  flex: 1; padding: 12px 14px; background: #0d1117; border: 1px solid #30363d;
  border-radius: 8px; color: #c9d1d9; font-size: 15px; outline: none;
}
.url-section input:focus { border-color: #58a6ff; }
.url-section button {
  padding: 12px 24px; background: #1f6feb; border: none; border-radius: 8px;
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.url-section button:hover { background: #388bfd; }

#spinner { text-align: center; padding: 40px; font-size: 15px; color: #8b949e; }

#infoSection { max-width: 900px; margin: 0 auto; padding: 0 24px 24px; }
.info-grid { display: grid; grid-template-columns: 550px minmax(0, 350px); gap: 14px; align-items: start; }
.video-preview-col { background: #161b22; border: 1px solid #30363d; border-radius: 10px; overflow: hidden; }
.video-preview { padding: 10px; }
.video-preview img { width: 100%; height: auto; border-radius: 8px; object-fit: cover; background: #0d1117; }
.video-info-col { padding: 0 12px 12px; }
.video-info-col h2 { font-size: 15px; color: #f0f6fc; word-wrap: break-word; line-height: 1.4; margin: 0; }
.video-info-col .duration { color: #8b949e; font-size: 13px; }
.info-grid .formats-section { background: #161b22; border: 1px solid #30363d; border-radius: 10px; padding: 14px; min-width: 0; display: flex; flex-direction: column; }
.formats-section h3 { margin-bottom: 8px; font-size: 13px; color: #f0f6fc; }
.formats-section .dl-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #30363d; }
#formatsList { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; max-height: 200px; }
.format-item {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; background: #0d1117; border: 1px solid #30363d;
  border-radius: 5px; font-size: 12px;
}
.format-item label { cursor: pointer; display: flex; align-items: center; gap: 4px; font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.format-item input[type="checkbox"] { width: 14px; height: 14px; accent-color: #238636; flex-shrink: 0; }
.format-item .file-size { color: #8b949e; font-size: 10px; flex-shrink: 0; }
.size-note { color: #8b949e; font-size: 12px; margin-top: 8px; font-style: italic; }

.primary-btn {
  display: inline-block; margin-top: 10px; padding: 8px 20px;
  background: #238636; border: none; border-radius: 8px; color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.primary-btn:hover { background: #2ea043; }
.primary-btn:disabled { opacity: 0.5; cursor: default; }

#progressSection { max-width: 800px; margin: 20px auto; padding: 0 24px 24px; }
#progressSection h3 { margin-bottom: 14px; font-size: 16px; color: #f0f6fc; }
.task-item {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 16px; margin-bottom: 12px;
}
.task-label { font-weight: 600; font-size: 14px; margin-bottom: 10px; color: #f0f6fc; }
.progress-wrap { margin-bottom: 8px; }
.progress-bar {
  width: 100%; height: 10px; background: #21262d; border-radius: 6px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, #238636, #2ea043);
  border-radius: 6px; transition: width 0.3s ease;
}
.progress-info {
  display: flex; gap: 16px; font-size: 13px; color: #8b949e; margin-top: 4px;
}
.progress-info .pct { color: #58a6ff; font-weight: 600; }
.progress-info .sp { color: #d2a8ff; }
.progress-info .eta { color: #8b949e; }
.progress-info .done { color: #3fb950; font-weight: 600; }
.progress-info .err { color: #f85149; }
.completed-files { margin-top: 6px; font-size: 12px; color: #8b949e; }
.cancel-btn {
  margin-top: 8px; padding: 6px 16px; background: transparent;
  border: 1px solid #30363d; border-radius: 6px; color: #f85149;
  font-size: 12px; cursor: pointer;
}
.cancel-btn:hover { background: #21262d; }

.hidden { display: none !important; }

@media (max-width: 768px) {
  .info-grid { grid-template-columns: 1fr; }
  .formats-section .dl-actions { flex-direction: column; gap: 8px; }
  .formats-section .dl-actions .primary-btn { width: 100%; }
}

@media (max-width: 640px) {
  .login-box { padding: 24px 20px; }
  .login-box h1 { font-size: 18px; }
  .login-box input { font-size: 16px; padding: 14px; }
  .login-box button { padding: 14px; font-size: 16px; }
}
