:root {
  --bg: #ffffff;
  --bg-alt: #f5f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-700: #1d4ed8;
  --accent: #16a34a;
  --accent-700: #15803d;
  --pink: #db2777;
  --danger-bg: #fef2f2;
  --danger: #b91c1c;
  --hero-1: #4c1d95;
  --hero-2: #86198f;
  --hero-3: #c2410c;
  --cta: #fbbf24;
  --cta-700: #f59e0b;
  --cta-text: #1f1300;
  --radius: 14px;
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, .25);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --bg-alt: #0f172a;
    --surface: #111a2e;
    --text: #e2e8f0;
    --text-2: #cbd5e1;
    --muted: #94a3b8;
    --border: #1e293b;
    --danger-bg: #3b1219;
    --danger: #fca5a5;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 800px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-icon { width: 34px; height: 34px; flex: none; }
.brand-text { font-size: 1.4rem; font-weight: 800; letter-spacing: -.035em; color: var(--text); }

.main-nav { position: relative; }
.nav-menu { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-menu a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.nav-menu a:hover { background: var(--bg-alt); color: var(--text); }
.lang select {
  appearance: none; -webkit-appearance: none;
  padding: 8px 30px 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2364748b' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  cursor: pointer; font-weight: 500; color: var(--text-2);
}
.nav-toggle { display: none; width: 42px; height: 42px; border: 0; background: transparent; border-radius: 10px; padding: 10px; }
.nav-toggle span { display: block; height: 2px; margin: 4px 0; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-menu {
    display: none; position: absolute; right: 0; top: 52px; min-width: 220px;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  }
  .nav-menu.open { display: flex; }
  .lang select { width: 100%; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  color: #fff;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(255,255,255,.18), transparent 60%),
    linear-gradient(120deg, var(--hero-1), var(--hero-2) 55%, var(--hero-3));
  padding: 56px 0 64px;
  overflow: hidden;
}
.hero-inner { text-align: center; max-width: 860px; }
.hero h1 { font-size: clamp(1.8rem, 4.6vw, 2.9rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: .35em; }
.hero-sub { font-size: clamp(1rem, 2.2vw, 1.15rem); opacity: .95; margin: 0 auto 28px; max-width: 680px; }
.hero-hint { font-size: .9rem; opacity: .85; margin: 14px 0 0; }

.dl-form {
  display: flex; gap: 10px; align-items: stretch;
  background: rgba(255,255,255,.16); padding: 8px; border-radius: 18px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.45);
}
.input-wrap {
  position: relative; flex: 1; display: flex; align-items: center;
  background: #fff; border-radius: 12px; min-width: 0;
}
.input-icon { width: 20px; height: 20px; color: #94a3b8; position: absolute; left: 14px; pointer-events: none; }
#url-input {
  flex: 1; min-width: 0; height: 56px; border: 0; outline: 0; background: transparent;
  padding: 0 8px 0 44px; font-size: 1rem; color: #0f172a;
}
#url-input::placeholder { color: #94a3b8; }
.icon-btn {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #94a3b8;
  display: grid; place-items: center; margin-right: 2px;
}
.icon-btn:hover { background: #f1f5f9; color: #475569; }
.icon-btn svg { width: 18px; height: 18px; }
.paste-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 40px; margin-right: 8px; padding: 0 14px; border-radius: 10px;
  border: 1px solid #c7d2fe; background: #eef2ff; color: #3730a3; font-weight: 600; font-size: .95rem;
}
.paste-btn:hover { background: #e0e7ff; }
.paste-btn svg { width: 18px; height: 18px; }

.submit-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 170px; height: 56px; padding: 0 24px; border: 0; border-radius: 12px;
  background: var(--cta); color: var(--cta-text); font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 6px 18px -6px rgba(245,158,11,.8);
  transition: background .15s, transform .05s;
}
.submit-btn:hover { background: var(--cta-700); }
.submit-btn:active { transform: translateY(1px); }
.submit-btn .btn-icon { width: 22px; height: 22px; }
.submit-btn .spinner { display: none; width: 20px; height: 20px; border: 3px solid rgba(31,19,0,.25); border-top-color: var(--cta-text); border-radius: 50%; animation: spin .8s linear infinite; }
.submit-btn.loading .spinner { display: inline-block; }
.submit-btn.loading .btn-icon { display: none; }
.submit-btn:disabled { opacity: .85; cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .hero { padding: 36px 0 44px; }
  .dl-form { flex-direction: column; padding: 6px; }
  .submit-btn { width: 100%; height: 52px; }
  #url-input { height: 52px; }
  .paste-btn span { display: none; }
  .paste-btn { padding: 0 10px; }
}

.error-box {
  margin: 18px auto 0; max-width: 720px; padding: 12px 16px; border-radius: 12px;
  background: var(--danger-bg); color: var(--danger); font-weight: 500; text-align: left;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}

/* ---------- Result ---------- */
.result-section { padding: 32px 0 8px; }
.result-card {
  display: grid; grid-template-columns: 280px 1fr; gap: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 20px; box-shadow: var(--shadow);
  animation: rise .35s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.result-media { position: relative; border-radius: 14px; overflow: hidden; background: #0f172a; aspect-ratio: 9 / 16; max-height: 500px; }
.result-media img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px;
  background: rgba(15,23,42,.75); color: #fff; font-size: .8rem; font-weight: 600;
}
.duration { position: absolute; bottom: 10px; right: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(15,23,42,.75); color: #fff; font-size: .8rem; font-variant-numeric: tabular-nums; }
.result-media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.play-btn {
  position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; transition: transform .15s;
}
.play-btn:hover { transform: scale(1.08); }
.play-btn svg { width: 100%; height: 100%; }
.result-body { display: flex; flex-direction: column; min-width: 0; }
.author { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--bg-alt); flex: none; }
.author-name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desc { margin: 0 0 18px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.6em; overflow: auto; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.dl-btn {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 12px;
  text-decoration: none; font-weight: 700; color: #fff; background: var(--primary);
  transition: background .15s, transform .05s; border: 0; width: 100%; text-align: left;
}
.dl-btn:hover { background: var(--primary-700); }
.dl-btn:active { transform: translateY(1px); }
.dl-btn svg { width: 22px; height: 22px; flex: none; }
.dl-btn .sub { margin-left: auto; font-weight: 500; font-size: .85rem; opacity: .85; white-space: nowrap; }
.dl-btn.green { background: var(--accent); }
.dl-btn.green:hover { background: var(--accent-700); }
.dl-btn.pink { background: var(--pink); }
.dl-btn.pink:hover { background: #be185d; }
.dl-btn.outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.dl-btn.outline:hover { background: var(--bg-alt); }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.image-item { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg-alt); aspect-ratio: 3 / 4; }
.image-item img { width: 100%; height: 100%; object-fit: cover; }
.image-item a {
  position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%; background: rgba(15,23,42,.78); color: #fff;
}
.image-item a svg { width: 18px; height: 18px; }
.image-item .num { position: absolute; left: 6px; top: 6px; padding: 0 7px; border-radius: 6px; background: rgba(15,23,42,.7); color: #fff; font-size: .75rem; }

.ghost-btn {
  align-self: flex-start; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-2); font-weight: 600;
}
.ghost-btn:hover { background: var(--bg-alt); color: var(--text); }

@media (max-width: 720px) {
  .result-card { grid-template-columns: 1fr; padding: 14px; }
  .result-media { max-height: 420px; aspect-ratio: auto; height: 60vw; min-height: 260px; }
  .ghost-btn { align-self: stretch; }
}

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { font-size: clamp(1.45rem, 3vw, 2rem); text-align: center; margin-bottom: 36px; letter-spacing: -.01em; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.step-num {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(135deg, #f97316, #c026d3); color: #fff; font-weight: 800; font-size: 1.1rem;
}
.step h3 { font-size: 1.1rem; }
.step p { margin: 0; color: var(--text-2); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-icon { font-size: 1.8rem; margin-bottom: 8px; }
.feature h3 { font-size: 1.05rem; }
.feature p { margin: 0; color: var(--text-2); }

@media (max-width: 860px) {
  .steps, .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .section { padding: 44px 0; }
  .steps, .features { grid-template-columns: 1fr; }
}

.faq-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 16px 48px 16px 18px; font-weight: 600; position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s;
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-item p { margin: 0; padding: 0 18px 16px; color: var(--text-2); }

.seo-text h2 { text-align: left; margin-bottom: 16px; }
.seo-text p { color: var(--text-2); }

.ad-slot { margin: 24px auto; text-align: center; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }
.footer-inner p { margin: 0; }
.muted { color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: #0f172a; color: #fff; box-shadow: var(--shadow); z-index: 200; font-weight: 500;
  animation: rise .25s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
