:root {
  --bg: #120e17;
  --card: #1c1622;
  --card-light: #ffffff;
  --paper: #f8f2f5;
  --paper-ink: #241a22;
  --ig-yellow: #ffdc80;
  --ig-orange: #fd9942;
  --ig-red: #fd5949;
  --ig-pink: #d6249f;
  --ig-purple: #833ab4;
  --ig-purple-deep: #5851db;
  --text: #f5f1f6;
  --text-dim: #ad9fb6;
  --border: rgba(255, 255, 255, 0.09);
  --radius: 18px;
  --serif: "Fraunces", "Georgia", serif;
  --sans: "Plus Jakarta Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ig-gradient: linear-gradient(45deg, var(--ig-yellow) 0%, var(--ig-orange) 22%, var(--ig-red) 42%, var(--ig-pink) 66%, var(--ig-purple) 84%, var(--ig-purple-deep) 100%);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

:focus-visible {
  outline: 2px solid var(--ig-pink);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Soft ambient Instagram-gradient glow behind everything */
.bg-glow {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(131, 58, 180, 0.35), transparent 45%),
    radial-gradient(circle at 55% 5%, rgba(253, 89, 73, 0.28), transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(255, 220, 128, 0.22), transparent 45%);
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

.navbar,
.hero,
.download-box,
.result,
.features,
.how-to,
footer {
  position: relative;
  z-index: 1;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 6vw;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.2px;
}

.logo-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ig-gradient);
  box-shadow: 0 4px 14px rgba(214, 36, 159, 0.35);
}

.logo span {
  background: var(--ig-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-tag {
  font-size: 0.82rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 50px;
  letter-spacing: 0.3px;
}

.hero {
  text-align: center;
  padding: 64px 6vw 26px;
}

.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
  margin-bottom: 18px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  margin: 0 0 14px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.glitch-word {
  position: relative;
  display: inline-block;
  background: var(--ig-gradient);
  background-size: 260% 260%;
  background-position: 20% 50%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glitch-word.glitching {
  animation: glitchShift 0.55s steps(3, end) 1;
}

@keyframes glitchShift {
  0%   { background-position: 20% 50%; text-shadow: none; transform: translate(0, 0); }
  15%  { background-position: 55% 40%; text-shadow: -2px 0 var(--ig-red), 2px 0 var(--ig-purple-deep); transform: translate(-1px, 0); }
  30%  { background-position: 30% 60%; text-shadow: 2px 0 var(--ig-yellow), -2px 0 var(--ig-purple); transform: translate(1px, 0); }
  45%  { background-position: 70% 35%; text-shadow: -3px 0 var(--ig-pink), 3px 0 var(--ig-orange); transform: translate(-1px, 0); }
  60%  { background-position: 40% 55%; text-shadow: 2px 0 var(--ig-red), -1px 0 var(--ig-purple-deep); transform: translate(1px, 0); }
  80%  { background-position: 60% 45%; text-shadow: -1px 0 var(--ig-pink); transform: translate(0, 0); }
  100% { background-position: 20% 50%; text-shadow: none; transform: translate(0, 0); }
}

.hero p {
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto;
  font-size: 1.02rem;
  line-height: 1.6;
}

.download-box {
  max-width: 680px;
  margin: 34px auto 0;
  padding: 0 6vw;
}

.type-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.type-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: default;
}

.type-tab.active {
  color: var(--text);
  border-color: transparent;
  background: var(--ig-gradient);
}

/* Gradient-ring input, Instagram "story ring" style */
.input-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--ig-gradient);
  border-radius: 50px;
  padding: 3px;
}

.input-row input {
  flex: 1;
  background: var(--card);
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  padding: 13px 20px;
  border-radius: 46px 0 0 46px;
  min-width: 0;
}

.input-row input::placeholder {
  color: var(--text-dim);
}

.input-row #paste-btn {
  border-radius: 0;
  background: var(--card);
  color: var(--text-dim);
  border: none;
  padding: 13px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
}

.input-row #paste-btn:hover {
  color: var(--text);
}

.btn-download {
  background: var(--ig-gradient);
  color: #1a0f14;
  font-weight: 700;
  border: none;
  padding: 13px 26px;
  border-radius: 0 46px 46px 0;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.15s;
}

.btn-download:hover {
  filter: brightness(1.08);
}

.btn-download:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.status-msg {
  margin-top: 16px;
  text-align: center;
  font-size: 0.9rem;
  min-height: 20px;
  line-height: 1.5;
}

.status-msg.error {
  color: #ff8a80;
}

.status-msg.info {
  color: var(--text-dim);
}

.status-msg.success {
  color: #7ee0b0;
}

/* ---------- Result ---------- */

.result {
  display: none;
  max-width: 720px;
  margin: 32px auto 0;
  padding: 0 6vw;
}

.result.show {
  display: block;
}

.result-card {
  background: var(--card-light);
  color: #262626;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #efefef;
}

.result-head .ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ig-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-head .ring span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
}

.result-head .meta {
  min-width: 0;
}

.result-head .meta h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-head .meta span {
  font-size: 0.78rem;
  color: #8e8e8e;
}

.badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 4px 10px;
  border-radius: 50px;
  background: var(--ig-gradient);
  color: #fff;
  flex-shrink: 0;
}

.result-media {
  background: #000;
  width: 100%;
  max-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-media img,
.result-media video {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  display: block;
}

.result-actions {
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f2f2f2;
  border: 1px solid #e6e6e6;
  color: #262626;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 500;
}

.dl-btn:hover {
  background: #e9e9e9;
}

.dl-btn.primary {
  background: var(--ig-gradient);
  color: #fff;
  font-weight: 700;
  border: none;
}

/* Carousel grid */
.carousel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.carousel-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #eee;
  aspect-ratio: 4/5;
}

.carousel-item img,
.carousel-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-item .slide-num {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
}

.carousel-item .video-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 50px;
  line-height: 1;
}

.carousel-item .save-link {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #262626;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 50px;
}

.caption-box {
  padding: 0 16px 16px;
  font-size: 0.85rem;
  color: #737373;
  line-height: 1.5;
}

/* ---------- Features / how-to ---------- */

.features {
  max-width: 720px;
  margin: 80px auto 0;
  padding: 0 6vw;
}

.feature-row {
  display: flex;
  gap: 22px;
  padding: 26px 0;
  border-top: 1px solid var(--border);
}

.feature-row:last-child {
  border-bottom: 1px solid var(--border);
}

.feature-num {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 2.2rem;
  padding-top: 2px;
}

.feature-row h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-family: var(--serif);
  font-weight: 600;
}

.feature-row p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
  max-width: 46ch;
}

.how-to {
  max-width: 640px;
  margin: 56px auto 0;
  padding: 0 6vw;
}

.how-to h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.5rem;
  font-family: var(--serif);
  font-weight: 600;
}

.how-to ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.how-to ol li {
  display: flex;
  align-items: baseline;
  gap: 18px;
  color: var(--text-dim);
  font-size: 0.98rem;
  line-height: 1.6;
}

.step-no {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: transparent;
  background: var(--ig-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  flex-shrink: 0;
  width: 1.4em;
}

/* ---------- Guide / SEO article ---------- */

.guide {
  margin: 84px 0 0;
  padding: 70px 6vw;
  background: var(--paper);
  color: var(--paper-ink);
  position: relative;
  z-index: 1;
}

.guide-inner {
  max-width: 680px;
  margin: 0 auto;
}

.guide-eyebrow {
  font-size: 0.85rem;
  color: var(--ig-pink);
  font-weight: 700;
  margin: 0 0 10px;
}

.guide h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 20px;
  max-width: 20ch;
}

.guide .lede {
  font-size: 1.08rem;
  line-height: 1.7;
  color: #4a3c47;
  margin-bottom: 8px;
}

.guide h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 40px 0 12px;
}

.guide p {
  font-size: 0.98rem;
  line-height: 1.75;
  color: #4a3c47;
  max-width: 68ch;
}

.guide-steps {
  margin: 0 0 20px;
  padding-left: 22px;
  color: #4a3c47;
  line-height: 1.8;
}

.guide-steps li {
  margin-bottom: 6px;
}

.pull-note {
  border-left: 3px solid var(--ig-pink);
  background: rgba(214, 36, 159, 0.06);
  padding: 16px 20px;
  margin: 28px 0;
  border-radius: 0 10px 10px 0;
}

.pull-note p {
  margin: 0;
  font-size: 0.93rem;
  color: #5a4855;
}

.faq-list {
  margin-top: 16px;
  border-top: 1px solid rgba(36, 26, 34, 0.12);
}

.faq-list details {
  border-bottom: 1px solid rgba(36, 26, 34, 0.12);
  padding: 16px 0;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
  list-style: none;
  position: relative;
  padding-right: 28px;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: -2px;
  font-size: 1.3rem;
  color: var(--ig-pink);
  font-weight: 400;
}

.faq-list details[open] summary::after {
  content: "\2212";
}

.faq-list details p {
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: #5a4855;
}

footer {
  text-align: center;
  padding: 28px;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(26, 15, 20, 0.3);
  border-top-color: #1a0f14;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: -2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 680px) {
  .navbar {
    padding: 16px 5vw;
  }
  .nav-tag {
    display: none;
  }
  .hero {
    padding: 44px 5vw 20px;
  }
  .input-row {
    flex-wrap: wrap;
    border-radius: 22px;
    gap: 6px;
  }
  .input-row input {
    flex: 1 1 100%;
    width: 100%;
    border-radius: 18px;
    font-size: 16px;
  }
  .input-row #paste-btn {
    flex: 1;
    border-radius: 16px;
    padding: 12px 10px;
  }
  .btn-download {
    flex: 2;
    border-radius: 16px;
  }
  .features,
  .how-to,
  .guide {
    padding-left: 5vw;
    padding-right: 5vw;
  }
  .feature-row p {
    max-width: none;
  }
  .guide h2 {
    max-width: none;
  }
}

@media (max-width: 400px) {
  .type-tab {
    padding: 7px 12px;
    font-size: 0.8rem;
  }
  .logo {
    font-size: 1.1rem;
  }
}
