/* ============ YT Clipper — premium dark theme ============ */
:root {
  --bg: #08080f;
  --bg2: #0d0d1a;
  --card: rgba(255, 255, 255, .045);
  --border: rgba(255, 255, 255, .10);
  --text: #f5f5f8;
  --muted: #a3a3b5;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --orange: #fb923c;
  --grad: linear-gradient(135deg, #8b5cf6, #ec4899 55%, #fb923c);
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ambient glow */
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 400px at 15% 5%, rgba(139, 92, 246, .22), transparent 60%),
    radial-gradient(700px 500px at 85% 20%, rgba(236, 72, 153, .16), transparent 60%),
    radial-gradient(500px 400px at 50% 100%, rgba(251, 146, 60, .10), transparent 60%);
}

/* ============ nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(8, 8, 15, .72);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: .9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--text); }

/* ============ hero ============ */
.hero {
  max-width: 860px; margin: 0 auto; text-align: center;
  padding: 5rem 1.25rem 3.5rem;
}
.hero-badge {
  display: inline-block; font-size: .82rem; font-weight: 600;
  padding: .45rem 1rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card);
  margin-bottom: 1.5rem; color: var(--muted);
}
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.8rem); font-weight: 900; }
.hero-sub { color: var(--muted); font-size: 1.12rem; max-width: 640px; margin: 0 auto 2rem; }
.hero-cta { margin-bottom: 3rem; }
.hero-stats { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.7rem; font-weight: 800; }
.hero-stats span { color: var(--muted); font-size: .85rem; }

/* ============ buttons / inputs ============ */
.btn {
  display: inline-block; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: .95rem;
  padding: .8rem 1.5rem; border-radius: 12px;
  text-decoration: none; text-align: center;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 28px rgba(236, 72, 153, .35);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 10px 34px rgba(236, 72, 153, .5); }
.btn-ghost {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.btn-lg { padding: 1rem 2.2rem; font-size: 1.05rem; border-radius: 14px; }
.btn-block { display: block; width: 100%; margin-top: 1rem; }
.btn-sm { padding: .45rem .9rem; font-size: .82rem; border-radius: 9px; }

input, select {
  width: 100%; padding: .85rem 1rem; font-size: .95rem; font-family: inherit;
  color: var(--text); background: rgba(0, 0, 0, .35);
  border: 1px solid var(--border); border-radius: 12px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .25);
}
select option { background: #14141f; }
.lbl { display: block; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1rem 0 .45rem; }

/* ============ layout ============ */
.section { max-width: 1080px; margin: 0 auto; padding: 3rem 1.25rem; }
.section-title { font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 800; text-align: center; }
.section-sub { text-align: center; margin-bottom: 2.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.auth-card { max-width: 460px; margin: 0 auto; text-align: center; }
.card-icon { font-size: 2.4rem; margin-bottom: .5rem; }
.auth-card form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
.row { display: flex; gap: .7rem; }
.row .btn { flex: 1; }
.msg { min-height: 1.4em; font-size: .9rem; margin: .7rem 0 0; }
.msg.ok { color: #4ade80; }
.msg.err { color: #f87171; }

/* tool card */
.tool-card { max-width: 760px; margin: 0 auto; }
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.tool-head h2 { margin: 0; font-size: 1.4rem; }
.user-row { display: flex; align-items: center; gap: .7rem; }
.pill {
  display: inline-block; padding: .4rem .9rem; border-radius: 999px;
  background: rgba(139, 92, 246, .15); border: 1px solid rgba(139, 92, 246, .4);
  font-size: .85rem; font-weight: 600;
}
.url-row { display: flex; gap: .7rem; }
.url-row input { flex: 1; }
.url-row .btn { white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

/* segments */
#segments { display: flex; flex-direction: column; gap: .6rem; margin-top: .9rem; }
.seg-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .8rem 1rem; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(0, 0, 0, .25);
  transition: border-color .2s, background .2s;
}
.seg-row:hover { border-color: rgba(139, 92, 246, .5); }
.seg-row:has(input:checked) {
  border-color: var(--pink);
  background: rgba(236, 72, 153, .10);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, .15);
}
.seg-row input { width: auto; accent-color: var(--pink); }
.seg-badge {
  font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  background: var(--grad); color: #fff; padding: .25rem .6rem; border-radius: 999px;
  white-space: nowrap;
}

/* result */
#result { margin-top: 1.8rem; padding-top: 1.8rem; border-top: 1px solid var(--border); }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.result-head h3 { margin: 0; }
.score-wrap { display: flex; align-items: center; gap: .7rem; }
.scorebar { width: 130px; height: 10px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.scorefill { height: 100%; width: 0; border-radius: 999px; background: var(--grad); transition: width 1s ease; }
#clipVideo { width: 100%; max-height: 480px; border-radius: 14px; background: #000; border: 1px solid var(--border); }

/* credits box */
.credits-box {
  margin-top: 1.8rem; padding: 1.2rem 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border: 1px dashed rgba(139, 92, 246, .5); border-radius: 14px;
  background: rgba(139, 92, 246, .07);
}
.credits-box p { margin: .2rem 0 0; }

/* ============ features ============ */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.2rem; }
.feat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.7rem; transition: transform .2s, border-color .2s;
}
.feat-card:hover { transform: translateY(-4px); border-color: rgba(139, 92, 246, .5); }
.feat-icon { font-size: 2rem; margin-bottom: .7rem; }
.feat-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.feat-card p { color: var(--muted); font-size: .92rem; margin: 0; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; margin-top: 2rem; }
.step {
  text-align: center; padding: 2rem 1.4rem;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--grad); font-weight: 800; font-size: 1.3rem; margin-bottom: 1rem;
}
.step p { color: var(--muted); font-size: .92rem; margin: 0; }

/* footer */
.footer {
  text-align: center; padding: 3rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border); margin-top: 2rem; color: var(--muted);
}

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #1c1c28; color: var(--text); border: 1px solid var(--border);
  padding: .8rem 1.4rem; border-radius: 999px; font-size: .9rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 100;
  box-shadow: var(--shadow); max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ad overlay */
#adOverlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .82); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.ad-box {
  background: #14141f; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2.2rem; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow);
}
.ad-progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; margin: 1.2rem 0 .6rem; }
.ad-progress-fill { height: 100%; width: 0; background: var(--grad); transition: width 1s linear; }
.ad-count { font-size: 2.2rem; font-weight: 800; }

/* responsive */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .url-row { flex-direction: column; }
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 1.4rem; }
  .hero { padding: 3.5rem 1.25rem 2.5rem; }
  .hero-stats { gap: 1.5rem; }
}

/* v6: ad slots (Adsterra) + segment buttons */
.ad-slot { display: flex; justify-content: center; margin: 1.5rem auto; max-width: 1100px; padding: 0 1.25rem; min-height: 0; }
.ad-slot:empty { display: none; }
.seg-row { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: .7rem .9rem; margin-bottom: .5rem; cursor: pointer; color: inherit; }
.seg-row:hover { border-color: rgba(139,92,246,.5); }
.seg-row.active { border-color: var(--pink, #ec4899); background: rgba(236,72,153,.08); }
.seg-badge { font-weight: 700; white-space: nowrap; }
#clipOpts { margin-top: 1rem; }
#limitPill b { color: #fff; }
