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

:root {
  --bg: #0f0f17;
  --bg2: #16161f;
  --card: #1c1c28;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.12);
  --text: #f0f0f8;
  --muted: #8888a8;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --green: #10b981;
  --red: #ef4444;
  --radius: 14px;
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── HEADER ── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,15,23,0.95);
  backdrop-filter: blur(12px);
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; color: #fff; }
.header-nav { display: flex; gap: 20px; }
.header-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; transition: color .2s; }
.header-nav a:hover { color: #fff; }
.header-badge { background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3); color: var(--accent); padding: 4px 12px; border-radius: 100px; font-size: 12px; font-weight: 600; }
@media(max-width:500px){ .header-nav{display:none} }

/* ── HERO ── */
.hero {
  text-align: center;
  padding: 56px 24px 40px;
  background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.12) 0%, transparent 60%);
}
.hero h1 { font-size: clamp(32px, 6vw, 58px); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 16px; }
.hero h1 span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: clamp(14px, 2vw, 17px); color: var(--muted); line-height: 1.7; margin-bottom: 28px; }

.platforms { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.platform-pill { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border); padding: 6px 14px; border-radius: 100px; font-size: 13px; font-weight: 500; color: var(--muted); transition: 0.2s; cursor: default; }
.platform-pill:hover { border-color: var(--border2); color: var(--text); }
.p-yt { color: #ff0000; font-weight: 700; }
.p-ig { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 700; }
.p-fb { color: #1877f2; font-weight: 700; }
.p-tt { color: #69c9d0; font-weight: 700; }
.p-tw { color: #fff; font-weight: 700; }

/* ── MAIN ── */
.main { max-width: 720px; margin: 0 auto; padding: 0 16px 60px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 28px; margin-bottom: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }

/* ── INPUT ── */
.input-wrap { display: flex; flex-direction: column; gap: 12px; }
.input-row { display: flex; align-items: center; background: var(--bg2); border: 1.5px solid var(--border2); border-radius: var(--radius); overflow: hidden; transition: border-color 0.2s; }
.input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.input-icon { padding: 0 12px; color: var(--muted); flex-shrink: 0; display: flex; align-items: center; }
#url { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 15px; padding: 14px 8px; font-family: 'Inter', sans-serif; }
#url::placeholder { color: var(--muted); }
.btn-paste { padding: 10px 14px; background: transparent; border: none; border-left: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: 0.2s; display: flex; align-items: center; }
.btn-paste:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 24px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 700; cursor: pointer; transition: 0.2s; font-family: 'Inter', sans-serif; width: 100%; }
.btn-primary:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,0.35); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── ALERT ── */
.alert { padding: 12px 16px; border-radius: 10px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; font-size: 14px; line-height: 1.5; margin-top: 4px; }
.hidden { display: none !important; }

/* ── VIDEO META ── */
.video-meta { display: flex; gap: 16px; align-items: flex-start; padding: 20px 0; border-top: 1px solid var(--border); margin-top: 16px; }
.thumb-wrap { position: relative; flex-shrink: 0; }
.thumb-wrap img { width: 140px; height: 88px; object-fit: cover; border-radius: 10px; display: block; }
.duration-badge { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,0.8); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.video-info { flex: 1; min-width: 0; }
.platform-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 10px; border-radius: 100px; background: rgba(99,102,241,0.15); color: var(--accent); margin-bottom: 8px; }
.video-info h2 { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.uploader { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ── FORMATS / QUALITY ── */
.formats-section { padding: 20px 0; border-top: 1px solid var(--border); }
.formats-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 14px; font-weight: 600; color: var(--muted); }
.audio-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); }
.audio-toggle input { display: none; }
.toggle-slider { width: 36px; height: 20px; background: var(--border2); border-radius: 100px; position: relative; transition: 0.2s; flex-shrink: 0; }
.toggle-slider::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: 0.2s; }
.audio-toggle input:checked ~ .toggle-slider { background: var(--accent); }
.audio-toggle input:checked ~ .toggle-slider::after { left: 19px; }

.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.tile { padding: 12px 8px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg2); text-align: center; cursor: pointer; transition: 0.15s; }
.tile:hover { border-color: var(--border2); background: rgba(255,255,255,0.04); }
.tile.selected { border-color: var(--accent); background: rgba(99,102,241,0.1); }
.tile strong { display: block; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.tile .sub-label { font-size: 11px; color: var(--muted); line-height: 1.4; }
.tile.best-quality { border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.07); }
.tile.best-quality strong { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.tile.audio-tile { border-color: rgba(16,185,129,0.3); }
.tile.audio-tile strong { color: var(--green); }

/* ── ACTIONS ── */
.actions { display: flex; gap: 10px; padding-top: 20px; border-top: 1px solid var(--border); }
.btn-download { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px; background: linear-gradient(135deg, var(--green), #059669); color: #fff; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 700; cursor: pointer; transition: 0.2s; font-family: 'Inter', sans-serif; }
.btn-download:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(16,185,129,0.3); }
.btn-download:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-cancel { padding: 15px 18px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #fca5a5; border-radius: var(--radius); cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; font-family: 'Inter', sans-serif; }
.btn-cancel:hover { background: rgba(239,68,68,0.18); }

/* ── PROGRESS ── */
.progress-box { padding: 16px 0; }
.progress-bar { height: 8px; background: var(--bg2); border-radius: 100px; overflow: hidden; margin-bottom: 10px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 100px; transition: width 0.3s ease; }
.progress-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.progress-stats span:first-child { color: var(--accent); font-weight: 700; }

/* ── RESULT ── */
.result-box { display: flex; align-items: center; gap: 14px; padding: 16px; background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2); border-radius: var(--radius); margin-top: 4px; }
.result-icon { font-size: 24px; flex-shrink: 0; }
.result-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.result-link { font-size: 14px; color: var(--green); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.result-link:hover { text-decoration: underline; }

/* ── STEPS + SUPPORTED ── */
.steps-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 24px 28px; }
.steps-card h3 { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 18px; }
.steps { display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.2); color: var(--accent); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.step strong { display: block; font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.step div { font-size: 13px; color: var(--muted); line-height: 1.5; }
.supported-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 8px; }
.supported-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* ── COOKIES STATUS ── */
.cookies-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 20px 28px; margin-bottom: 20px; }
.cookies-card h3 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.platform-status { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.p-status { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; }
.p-status.ok   { border-color: rgba(16,185,129,0.25); color: var(--green); }
.p-status.fail { border-color: rgba(239,68,68,0.15);  color: var(--muted); }
.p-status .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.p-status.ok   .dot { background: var(--green); }
.p-status.fail .dot { background: #444; }

/* ── FOOTER ── */
.footer { text-align: center; padding: 32px 24px 40px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 20px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-bottom: 12px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 13px; transition: color .2s; }
.footer-links a:hover { color: var(--text); }

/* Loading animation */
.loading-dots::after { content: '.'; animation: dots 1.2s infinite; }
@keyframes dots { 0%{content:'.'} 33%{content:'..'} 66%{content:'...'} }

/* Mobile */
@media (max-width: 500px) {
  .card { padding: 18px 14px; }
  .video-meta { flex-direction: column; }
  .thumb-wrap img { width: 100%; height: 180px; }
  .hero { padding: 36px 16px 28px; }
  .steps-card { padding: 18px 14px; }
  .formats { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); }
  .main { padding: 0 12px 40px; }
}
