*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { --bg: #0f0f13; --card: #1a1a24; --border: #2a2a3a; --text: #e2e8f0; --muted: #94a3b8; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }

header { background: rgba(26,26,36,0.95); border-bottom: 1px solid var(--border); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 100; }
.nav-top { padding: 0.9rem 2rem; display: flex; align-items: center; }
.logo { font-size: 1.3rem; font-weight: 800; background: linear-gradient(135deg,#7c3aed,#06b6d4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-decoration: none; }
.nav-platforms { display: flex; gap: 0; border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; justify-content: center; }
.nav-platforms::-webkit-scrollbar { display: none; }
.nav-link { display: flex; align-items: center; gap: 0.4rem; padding: 0.7rem 1.3rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; transition: all 0.2s; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--p-color); border-bottom-color: var(--p-color); }

main { flex: 1; max-width: 700px; width: 100%; margin: 0 auto; padding: 2rem 1rem; }
.dl-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.8rem; }
.dl-header .p-icon { font-size: 2.2rem; }
.dl-header h1 { font-size: 1.6rem; font-weight: 800; }
.p-badge { padding: 0.2rem 0.75rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: color-mix(in srgb, var(--p-color) 18%, transparent); color: var(--p-color); border: 1px solid color-mix(in srgb, var(--p-color) 35%, transparent); }

.input-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.url-row { display: flex; gap: 0.5rem; }
.url-row input { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 1rem; color: var(--text); font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.url-row input:focus { border-color: var(--p-color); }
.url-row input::placeholder { color: var(--muted); }
.options-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.options-row select { flex: 1; min-width: 140px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.65rem 1rem; color: var(--text); font-size: 0.9rem; outline: none; cursor: pointer; }

.btn { padding: 0.75rem 1.4rem; border-radius: 10px; border: none; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all 0.2s; white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--p-color), color-mix(in srgb, var(--p-color) 55%, #000)); color: #fff; }
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-success { background: linear-gradient(135deg,#10b981,#059669); color:#fff; }

.error-msg { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.88rem; display: none; }

#preview { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: none; margin-top: 1rem; }
.preview-inner { display: flex; gap: 1rem; padding: 1rem; align-items: flex-start; }
.preview-inner img { width: 140px; height: 90px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #111; }
.preview-info { flex: 1; min-width: 0; }
.preview-info .title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-info .meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }

#progress-section { display: none; padding: 1rem 1.5rem; }
.progress-bar-wrap { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; margin: 0.5rem 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--p-color), #06b6d4); border-radius: 999px; transition: width 0.3s; width: 0%; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); }
#download-area { display: none; padding: 0 1rem 1rem; }

.tips-box { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.2rem; margin-top: 1rem; font-size: 0.83rem; color: var(--muted); line-height: 1.7; }
.tips-box strong { color: var(--text); }

@media (max-width: 480px) {
  .preview-inner { flex-direction: column; }
  .preview-inner img { width: 100%; height: 180px; }
  .url-row { flex-direction: column; }
  .nav-top { padding: 0.9rem 1rem; }
}
