/* DowTik – TikTok downloader */
:root {
  --bg-dark: #0b1120;
  --bg-dark2: #131b31;
  --accent: #0ef0d0;
  --accent2: #ff3b6b;
  --text: #1c2333;
  --muted: #5b6478;
  --card: #ffffff;
  --radius: 14px;
}

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

[hidden] { display: none !important; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: #f6f8fc;
  line-height: 1.6;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }

/* header */
.site-header {
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .5px;
}
.logo em { font-style: normal; color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 26px; }
.main-nav { display: flex; gap: 26px; }
.main-nav a {
  color: #c7d0e2;
  text-decoration: none;
  font-size: .95rem;
}
.main-nav a:hover { color: var(--accent); }

/* language dropdown */
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: #c7d0e2;
  font-size: .92rem;
  padding: 7px 12px;
  border: 1px solid #2b3652;
  border-radius: 9px;
  user-select: none;
  white-space: nowrap;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { color: var(--accent); border-color: #3a486b; }
.lang-menu ul {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  background: var(--bg-dark2);
  border: 1px solid #2b3652;
  border-radius: 12px;
  list-style: none;
  padding: 8px;
  min-width: 170px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.lang-menu ul a {
  display: block;
  color: #c7d0e2;
  text-decoration: none;
  font-size: .9rem;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.lang-menu ul a:hover { background: #1d2740; color: #fff; }
.lang-menu ul a.active { color: var(--accent); font-weight: 700; }

/* hero */
.hero {
  background: linear-gradient(150deg, var(--bg-dark) 0%, var(--bg-dark2) 55%, #251236 100%);
  color: #fff;
  text-align: center;
  padding: 64px 0 84px;
}
.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 800;
}
.hero .tagline {
  color: #aeb8cf;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  margin: 10px 0 34px;
}

/* form */
.dl-form {
  display: flex;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}
.input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius);
  padding: 4px 6px 4px 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
}
.paste-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: #eef1f7;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.paste-btn:hover { background: #e2e7f0; color: var(--text); }
.go-btn {
  position: relative;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent) 0%, #08c9ae 100%);
  color: #04211c;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0 34px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 8px 30px rgba(14,240,208,.25);
}
.go-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 34px rgba(14,240,208,.4); }
.go-btn:disabled { opacity: .7; cursor: wait; transform: none; }
.go-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(4,33,28,.25);
  border-top-color: #04211c;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.go-btn.loading .go-label { display: none; }
.go-btn.loading .go-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.sub-note {
  margin-top: 16px;
  color: #8f9ab1;
  font-size: .92rem;
  text-align: center;
}

.error-box {
  max-width: 720px;
  margin: 18px auto 0;
  background: rgba(255,59,107,.12);
  border: 1px solid rgba(255,59,107,.5);
  color: #ffb3c4;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: .95rem;
}

/* result card */
.result-card {
  max-width: 720px;
  margin: 30px auto 0;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  gap: 22px;
  text-align: left;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.result-media img {
  width: 150px;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  background: #dfe4ee;
}
.result-info { flex: 1; min-width: 0; }
.res-author { font-weight: 700; margin-bottom: 4px; }
.res-title {
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  padding: 11px 18px;
  border-radius: 10px;
  background: #eef1f7;
  color: var(--text);
  transition: filter .15s;
}
.dl-btn:hover { filter: brightness(.95); }
.dl-btn.primary { background: linear-gradient(135deg, var(--accent) 0%, #08c9ae 100%); color: #04211c; }
.dl-btn.music { background: linear-gradient(135deg, var(--accent2) 0%, #e02455 100%); color: #fff; }
.another-btn {
  margin-top: 16px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: .88rem;
  text-decoration: underline;
  cursor: pointer;
}
.another-btn:hover { color: var(--text); }

/* sections */
.section { padding: 70px 0; }
.section.alt { background: #fff; }
.section h2 {
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin-bottom: 40px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.step {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(28,35,51,.07);
}
.section.alt .step { background: #f6f8fc; box-shadow: none; }
.step-num {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-dark);
  color: var(--accent);
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step h3 { margin-bottom: 8px; font-size: 1.08rem; }
.step p { color: var(--muted); font-size: .93rem; }

/* about card */
.about-section { padding-top: 0; }
.about-card {
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 18px;
  padding: 44px 40px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(28,35,51,.06);
}
.about-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 20px;
  border-radius: 14px;
  background: rgba(8,201,174,.12);
  color: #08c9ae;
  display: flex;
  align-items: center;
  justify-content: center;
}
.about-card h2 {
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  color: #08a892;
  margin-bottom: 0;
}
.about-divider {
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), #08c9ae);
  margin: 18px auto 26px;
}
.about-card p {
  color: var(--muted);
  font-size: .98rem;
  max-width: 640px;
  margin: 0 auto;
}
.about-card p + p { margin-top: 16px; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.feature {
  background: #f6f8fc;
  border-radius: var(--radius);
  padding: 26px 22px;
}
.feature-icon { font-size: 1.7rem; margin-bottom: 10px; }
.feature h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .92rem; }

/* faq */
#faq details {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 3px 14px rgba(28,35,51,.06);
  overflow: hidden;
}
#faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 18px 22px;
  list-style: none;
  position: relative;
  padding-right: 46px;
}
#faq summary::-webkit-details-marker { display: none; }
#faq summary::after {
  content: "+";
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--muted);
}
#faq details[open] summary::after { content: "–"; }
#faq details p { padding: 0 22px 18px; color: var(--muted); font-size: .95rem; }

/* how-to iOS tip */
.ios-tip {
  max-width: 720px;
  margin: 28px auto 0;
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  padding: 14px 20px;
  color: var(--muted);
  font-size: .92rem;
  text-align: center;
}

/* footer */
.site-footer {
  background: var(--bg-dark);
  color: #8f9ab1;
  text-align: center;
  padding: 44px 0 34px;
  font-size: .88rem;
}
.site-footer p + p { margin-top: 6px; }
.footer-cols {
  margin-bottom: 28px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1d2740;
}
.footer-col { margin-bottom: 26px; }
.footer-col h4 {
  color: #5b6784;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: 14px;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
}
.footer-col a {
  display: inline-block;
  color: #a7b1c7;
  text-decoration: none;
  font-size: .88rem;
  padding: 6px 14px;
  border: 1px solid #232e4b;
  border-radius: 999px;
  transition: color .15s, border-color .15s;
}
.footer-col a:hover { color: var(--accent); border-color: #35507a; }
.footer-col a.active { color: var(--accent); border-color: rgba(14,240,208,.45); }

/* responsive */
/* RTL adjustments */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .res-title, [dir="rtl"] .res-author { text-align: right; }

@media (max-width: 760px) {
  .main-nav { display: none; }
  .dl-form { flex-direction: column; }
  .go-btn { padding: 15px 34px; }
  .steps, .features { grid-template-columns: 1fr; }
  .result-card { flex-direction: column; align-items: center; text-align: center; }
  .result-info { text-align: center; }
  .result-actions { justify-content: center; }
  .hero { padding: 44px 0 60px; }
}
@media (min-width: 761px) and (max-width: 980px) {
  .features { grid-template-columns: repeat(2, 1fr); }
}
