:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #0f1419;
  --muted: #536471;
  --accent: #1d9bf0;
  --accent-dark: #1a8cd8;
  --accent-soft: #e8f3fd;
  --line: #e1e8ed;
  --error-bg: #fde8e8;
  --error-ink: #b3261e;
  --container: 1120px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

/* ---------- header ---------- */
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  max-width: var(--container); margin: 0 auto; padding: .9rem 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none;
}
.brand-mark { width: 28px; height: 28px; border-radius: 7px; }

/* language dropdown (pure CSS/HTML, no JS) */
.lang-picker { position: relative; }
.lang-picker summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem; min-height: 44px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  font-size: .92rem; font-weight: 600; color: var(--ink);
}
.lang-picker summary::-webkit-details-marker { display: none; }
.lang-picker summary svg { width: 14px; height: 14px; color: var(--muted); transition: transform .15s ease; }
.lang-picker[open] summary { border-color: var(--accent); }
.lang-picker[open] summary svg { transform: rotate(180deg); }
.lang-picker summary:focus-visible { outline: 3px solid rgba(29, 155, 240, .4); outline-offset: 2px; }
.lang-menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 30;
  min-width: 210px; max-height: 70vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 20, 25, .12);
  padding: .4rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
}
.lang-menu a {
  padding: .5rem .7rem; border-radius: 8px; text-decoration: none;
  color: var(--ink); font-size: .9rem; white-space: nowrap;
}
.lang-menu a:hover { background: var(--accent-soft); }
.lang-menu a.active { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- hero: the search box is the primary CTA ---------- */
.hero {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 3.5rem 1rem 3rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.45rem, 1rem + 2.2vw, 2.3rem);
  font-weight: 800; line-height: 1.3;
  max-width: 860px; margin: 0 auto 1.9rem;
}
.url-form {
  display: flex; gap: .55rem; align-items: stretch;
  max-width: 780px; margin: 0 auto;
  background: var(--card); padding: .5rem;
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 28px rgba(15, 20, 25, .08);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.url-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(15, 20, 25, .08), 0 0 0 3px rgba(29, 155, 240, .25);
}
.url-form input {
  flex: 1; min-width: 0; min-height: 48px;
  border: 0; background: transparent; padding: .6rem 1rem; font-size: 1.05rem; color: var(--ink);
}
.url-form input:focus { outline: none; }
.url-form button {
  min-height: 48px; padding: 0 1.7rem;
  font-size: 1.05rem; font-weight: 700;
  background: var(--accent); color: #fff; border: 0; border-radius: 11px; cursor: pointer;
}
.url-form button:hover { background: var(--accent-dark); }
.url-form button:active { transform: scale(.98); }
.url-form button:focus-visible { outline: 3px solid rgba(29, 155, 240, .45); outline-offset: 2px; }

.formats {
  list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem;
  margin: 1rem 0 0; padding: 0;
}
.chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: .22rem .85rem; font-size: .85rem; font-weight: 600; color: var(--muted);
}

/* ---------- alerts & result card ---------- */
.alert { margin-top: .9rem; padding: .7rem 1rem; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.alert-error { background: var(--error-bg); color: var(--error-ink); border-color: transparent; }

.note-box {
  max-width: 820px; margin: 1.2rem auto 0; text-align: start;
  padding: .8rem 1rem; border-radius: 10px;
  background: var(--accent-soft); border-inline-start: 3px solid var(--accent);
}
.note-box strong { display: block; margin-bottom: .25rem; font-size: .92rem; color: var(--ink); }
.note-box p { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.6; }

.tutorial-intro { margin: 1rem 0 0; line-height: 1.7; }
.tutorial-reqs { margin: .8rem 0 0; padding-inline-start: 1.3rem; }
.tutorial-reqs li { margin: .3rem 0; color: var(--ink); }
.tutorial-example { margin: .9rem 0 0; word-break: break-all; }
.tutorial-example a { color: var(--accent); }

.tweet-card {
  max-width: 820px; margin: 1.5rem auto 0; text-align: start;
  padding: 1.2rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 6px 20px rgba(15, 20, 25, .06);
}
.tweet-head { display: flex; gap: .75rem; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 50%; }
.tweet-meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.author-name { font-weight: 700; }
.author-handle, .tweet-date { color: var(--muted); font-size: .9rem; }
.tweet-text-box {
  margin: .8rem 0; text-align: start;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .95rem .5rem;
}
.tweet-text-head {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  margin-bottom: .35rem;
}
.tweet-text-head strong { font-size: .8rem; font-weight: 700; color: var(--muted); }
.btn-copy {
  flex: none; min-height: 32px; padding: .2rem .9rem;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  color: var(--accent); background: var(--card);
  border: 1px solid var(--accent); border-radius: 999px;
}
.btn-copy:hover { background: var(--accent-soft); }
.btn-copy:focus-visible { outline: 3px solid rgba(29, 155, 240, .4); outline-offset: 2px; }
.btn-copy.copied { color: #fff; background: #00897b; border-color: #00897b; }
.tweet-text { margin: 0 0 .45rem; white-space: pre-wrap; word-break: break-word; }

.media-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .6rem; }
.media-item {
  display: flex; align-items: center; gap: .8rem;
  border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem;
}
.media-thumb { width: 56px; height: 56px; border-radius: 8px; background: var(--bg); overflow: hidden; flex: none; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { display: flex; gap: .5rem; align-items: center; flex: 1; flex-wrap: wrap; }
.badge { font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: var(--bg); }
.badge-video { color: var(--accent); }
.badge-gif { color: #9c27b0; }
.badge-image { color: #00897b; }
.quality, .ext { color: var(--muted); font-size: .9rem; }
.btn-download {
  padding: .5rem 1.2rem; font-weight: 700; text-decoration: none;
  color: #fff; background: var(--accent); border-radius: 999px; flex: none;
}
.btn-download:hover { background: var(--accent-dark); }

/* ---------- content sections ---------- */
.page-body { max-width: 960px; margin: 0 auto; padding: 2.5rem 1rem 3rem; }
.page-body section + section { margin-top: 2.5rem; }
.features h2, .how-to h2, .faq h2, .static-page h1 { font-size: 1.2rem; margin-top: 0; }

.features ul {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem;
}
.features li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .25rem;
}
.features strong { font-size: .98rem; }
.features span { color: var(--muted); font-size: .88rem; }

.faq h3 { font-size: .98rem; margin-bottom: .25rem; }
.faq p { margin-top: 0; color: var(--muted); }
.static-page { max-width: 760px; }

/* ---------- footer ---------- */
.site-footer {
  max-width: var(--container); margin: 0 auto;
  padding: 1.2rem 1rem; color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--line);
}
.site-footer nav a { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { padding: 2.5rem 1rem 2.2rem; }
  .url-form { flex-direction: column; padding: .6rem; }
  .url-form button { width: 100%; }
  .features ul { grid-template-columns: 1fr; }
  .media-item { flex-wrap: wrap; }
  .lang-menu { grid-template-columns: 1fr; }
}
