/* ============================================================
   XSave — X 视频下载
   Plain CSS, no build step, no external assets.
   Dark-first, light via [data-theme="light"] (set by theme-boot.js).
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC",
    "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Source Han Sans SC",
    "Noto Sans SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0a0a0c;
  --bg-elevated: #0e0e12;
  --surface: #131318;
  --surface-2: #191920;
  --surface-3: #22222b;
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.145);
  --header-bg: rgba(10, 10, 13, 0.72);
  --sticky-bg: rgba(13, 13, 17, 0.86);

  --text: #f2f2f6;
  --text-2: #b7b7c5;
  --text-3: #8d8d9e;
  --text-invert: #0b0b0e;

  --accent: #86a0ff;
  --accent-2: #bb92ff;
  --accent-grad: linear-gradient(115deg, #6d8bff 0%, #a06dff 100%);
  --accent-soft: rgba(109, 139, 255, 0.14);
  --accent-border: rgba(130, 154, 255, 0.42);
  --btn-grad: linear-gradient(120deg, #4a63f0 0%, #7b49e6 100%);
  --btn-grad-hover: linear-gradient(120deg, #5570f6 0%, #8957ef 100%);

  --ok: #43d19a;
  --warn: #f0b74d;
  --danger: #ff8a97;
  --danger-soft: rgba(255, 110, 125, 0.12);
  --warn-soft: rgba(240, 183, 77, 0.1);
  --warn-border: rgba(240, 183, 77, 0.26);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 40px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 32px 90px -32px rgba(0, 0, 0, 0.85), 0 10px 28px -18px rgba(0, 0, 0, 0.6);

  --radius-lg: 22px;
  --radius-xl: 26px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.22, 0.9, 0.26, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fa;
  --bg-elevated: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f3f4f9;
  --surface-3: #e9ebf3;
  --border: rgba(18, 20, 40, 0.085);
  --border-strong: rgba(18, 20, 40, 0.16);
  --header-bg: rgba(248, 249, 252, 0.78);
  --sticky-bg: rgba(250, 250, 253, 0.9);

  --text: #15161c;
  --text-2: #4b4d5c;
  --text-3: #686a7b;
  --text-invert: #ffffff;

  --accent: #3e55d6;
  --accent-2: #7d43d4;
  --accent-soft: rgba(70, 95, 235, 0.1);
  --accent-border: rgba(62, 85, 214, 0.38);
  --btn-grad: linear-gradient(120deg, #4456e8 0%, #7440dd 100%);
  --btn-grad-hover: linear-gradient(120deg, #5064f2 0%, #8350e8 100%);
  --danger: #c53042;
  --danger-soft: rgba(197, 48, 66, 0.08);
  --warn: #9a6b08;
  --warn-soft: rgba(196, 138, 18, 0.1);
  --warn-border: rgba(196, 138, 18, 0.28);

  --shadow-sm: 0 1px 2px rgba(20, 22, 40, 0.06);
  --shadow-md: 0 16px 44px -22px rgba(24, 28, 60, 0.22);
  --shadow-lg: 0 40px 100px -40px rgba(24, 28, 60, 0.3),
    0 12px 32px -20px rgba(24, 28, 60, 0.16);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(880px 560px at 50% -12%, rgba(109, 139, 255, 0.17), transparent 62%),
    radial-gradient(680px 480px at 88% 4%, rgba(160, 109, 255, 0.11), transparent 60%),
    radial-gradient(560px 480px at 4% 28%, rgba(80, 120, 255, 0.07), transparent 62%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="light"] body::before {
  background:
    radial-gradient(880px 560px at 50% -14%, rgba(109, 139, 255, 0.2), transparent 62%),
    radial-gradient(660px 480px at 90% 2%, rgba(160, 109, 255, 0.14), transparent 60%),
    radial-gradient(560px 480px at 2% 30%, rgba(80, 120, 255, 0.08), transparent 62%);
}

[hidden] {
  display: none !important;
}

img,
svg,
video {
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

::selection {
  background: rgba(109, 139, 255, 0.38);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ico {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
  fill: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 120;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  transition: top 0.18s var(--ease);
}

.skip-link:focus {
  top: calc(16px + env(safe-area-inset-top, 0px));
}

/* ---------- Shared primitives ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.16s var(--ease),
    box-shadow 0.22s var(--ease),
    background 0.22s var(--ease),
    border-color 0.22s var(--ease),
    color 0.22s var(--ease);
}

.btn:active {
  transform: scale(0.985);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.btn-primary {
  background: var(--btn-grad);
  color: #fff;
  box-shadow:
    0 10px 28px -12px rgba(93, 84, 246, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover {
  background: var(--btn-grad-hover);
  box-shadow:
    0 14px 34px -12px rgba(93, 84, 246, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-3);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.18s var(--ease),
    color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    transform 0.16s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn .ico {
  width: 21px;
  height: 21px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.text-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.text-btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.text-btn .ico {
  width: 16px;
  height: 16px;
  transition: transform 0.22s var(--ease);
}

.text-btn[aria-expanded="true"] .toggle-caret {
  transform: rotate(180deg);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1120px;
  height: 60px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
}

.brand-mark {
  display: inline-flex;
  border-radius: 10px;
  box-shadow: 0 6px 18px -8px rgba(93, 84, 246, 0.8);
}

.brand-mark svg {
  display: block;
  border-radius: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.brand-text small {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  color: var(--text-3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ico-sun,
[data-theme="dark"] .ico-moon {
  display: none;
}

[data-theme="dark"] .ico-sun,
.ico-moon {
  display: block;
}

/* ---------- Layout ---------- */
.main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 52px) clamp(16px, 4vw, 32px) 72px;
  padding-bottom: calc(72px + var(--safe-b));
}

/* ---------- Hero ---------- */
.hero {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.live-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-grad);
  box-shadow: 0 0 0 0 rgba(109, 139, 255, 0.5);
  animation: livedot 2.8s var(--ease) infinite;
}

.hero-title {
  margin: 18px 0 12px;
  font-size: clamp(28px, 6.6vw, 46px);
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.grad-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  padding-right: 0.06em;
}

.lede {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-2);
  font-size: clamp(14.5px, 1.7vw, 16px);
  line-height: 1.72;
  text-wrap: pretty;
}

/* Search */
.searchbox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  max-width: 700px;
  margin: 28px auto 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transition: border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.searchbox:focus-within {
  border-color: var(--accent-border);
  box-shadow:
    0 0 0 4px var(--accent-soft),
    var(--shadow-lg);
}

.searchbox.is-invalid {
  border-color: rgba(255, 138, 151, 0.55);
  box-shadow: 0 0 0 4px var(--danger-soft), var(--shadow-md);
}

.field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 0 4px 0 14px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: var(--surface-2);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.field:focus-within {
  background: var(--surface);
  border-color: var(--accent-border);
}

.field-icon {
  width: 19px;
  height: 19px;
  color: var(--text-3);
}

#url-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 16px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  text-overflow: ellipsis;
}

#url-input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

#url-input::-webkit-search-cancel-button {
  display: none;
}

.field-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}

.field-btn .ico {
  width: 19px;
  height: 19px;
}

.field-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.field-btn:active {
  transform: scale(0.93);
}

.parse-btn {
  min-height: 54px;
  padding: 0 24px;
  border-radius: 15px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.parse-btn-icon {
  width: 19px;
  height: 19px;
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.parse-btn.is-loading .parse-btn-icon {
  display: none;
}

.parse-btn.is-loading .btn-spinner {
  display: inline-block;
}

.hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px auto 0;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.9;
}

.hint b {
  color: var(--text-2);
  font-weight: 600;
}

.hint kbd {
  padding: 1px 6px;
  margin: 0;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.6;
}

.hint-sep {
  color: var(--text-3);
  opacity: 0.55;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
}

.status:empty {
  margin: 0;
  min-height: 0;
}

.status.is-error {
  color: var(--danger);
}

.status .status-spinner {
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Empty state ---------- */
.empty {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: clamp(34px, 6vw, 58px);
  padding: clamp(26px, 5vw, 44px) clamp(20px, 5vw, 40px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
  box-shadow: var(--shadow-md);
  text-align: center;
  overflow: hidden;
}

.empty::before {
  content: "";
  position: absolute;
  top: -40%;
  left: 50%;
  width: 520px;
  height: 420px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(109, 139, 255, 0.14), transparent);
  pointer-events: none;
}

.empty-art-wrap {
  position: relative;
  flex: none;
  width: min(230px, 62vw);
}

.empty-art {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 30px rgba(60, 50, 180, 0.16));
}

.empty-copy {
  position: relative;
  min-width: 0;
}

.empty-copy h2 {
  margin: 0 0 10px;
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.012em;
}

.empty-copy p {
  max-width: 520px;
  margin: 0 auto;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.75;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 12.5px;
}

.feature-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feature-list .ico {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

/* ---------- Result shell ---------- */
.result {
  margin-top: clamp(30px, 5vw, 46px);
  outline: none;
  scroll-margin-top: 82px;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  animation: fadeUp 0.38s var(--ease) both;
}

.media-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.details-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ---------- Media tabs ---------- */
.media-tabs {
  display: flex;
  gap: 8px;
  padding: 2px 0 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.media-tabs::-webkit-scrollbar {
  display: none;
}

.media-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.18s var(--ease),
    color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.media-tab .ico {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.media-tab:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.media-tab[aria-pressed="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
}

.media-tab[aria-pressed="true"] .ico {
  color: var(--accent);
}

.media-tab-time {
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.media-tab-count {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- Media card / stage ---------- */
.media-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  max-height: 72vh;
  background: #07070a;
  overflow: hidden;
}

.player {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
  background: #07070a;
  object-fit: contain;
  object-position: center;
  outline: none;
}

.stage-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(8, 8, 12, 0.6);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.5;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.stage-badge .ico {
  width: 13px;
  height: 13px;
}

.stage-badge--quality {
  margin-left: auto;
}

.stage-loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(5, 5, 9, 0.55);
  color: #e7e7ef;
  font-size: 12.5px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.stage-loader .spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.stage-fallback {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.stage-fallback-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
}

.stage-fallback-title .ico {
  width: 17px;
  height: 17px;
  color: var(--warn);
}

.stage-fallback p {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.7;
}

.stage-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.stage-fallback-actions .btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 13px;
}

.media-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
}

.media-caption-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.media-caption-item .ico {
  width: 14px;
  height: 14px;
}

.media-caption-type {
  color: var(--text-2);
  font-weight: 600;
}

.media-note {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.65;
}

.media-note .ico {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
}

/* ---------- Photo grid ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  background: var(--border);
}

.photo-grid[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.photo-grid[data-count="3"] .photo-tile:first-child {
  grid-column: span 2;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-2);
}

.photo-grid[data-count="1"] .photo-tile {
  aspect-ratio: auto;
  max-height: 72vh;
}

.photo-grid[data-count="1"] .photo-open img {
  max-height: 72vh;
  object-fit: contain;
  background: #07070a;
}

.photo-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.photo-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease), filter 0.3s var(--ease);
}

@media (hover: hover) {
  .photo-open:hover img {
    transform: scale(1.025);
    filter: brightness(1.04);
  }
}

.photo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(8, 8, 12, 0.56);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.photo-dl {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 8, 12, 0.56);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.18s var(--ease), transform 0.16s var(--ease);
}

.photo-dl .ico {
  width: 18px;
  height: 18px;
}

.photo-dl:hover {
  background: rgba(8, 8, 12, 0.86);
}

.photo-dl:active {
  transform: scale(0.92);
}

.photo-strip {
  display: flex;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}

.photo-strip::-webkit-scrollbar {
  display: none;
}

.photo-strip-btn {
  position: relative;
  flex: none;
  width: 66px;
  height: 66px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.photo-strip-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.photo-strip-btn:hover img {
  transform: scale(1.05);
}

.photo-strip-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 5px 3px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

/* ---------- Tweet card ---------- */
.tweet-card {
  padding: clamp(18px, 3.4vw, 24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.author-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.avatar img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  background: var(--accent-grad);
}

.author-body {
  min-width: 0;
  line-height: 1.35;
}

.author-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.author-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.verified {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--accent);
}

.author-handle {
  display: block;
  overflow: hidden;
  color: var(--text-3);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-link {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border-radius: 11px;
  color: var(--text-3);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.author-link .ico {
  width: 18px;
  height: 18px;
}

.author-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tweet-text {
  display: -webkit-box;
  margin: 14px 0 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

.tweet-text.is-expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.tweet-text.is-empty {
  color: var(--text-3);
  font-size: 14px;
}

.tweet-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 44px;
  margin-top: 4px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.tweet-toggle:hover {
  background: var(--accent-soft);
}

.tweet-date {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.tweet-date .ico {
  width: 14px;
  height: 14px;
}

.tweet-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.stat .ico {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.stat b {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- Download panel ---------- */
.download-panel {
  padding: clamp(17px, 3.2vw, 22px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.005em;
}

.panel-note {
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
}

.quality-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quality-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 98px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.18s var(--ease),
    background 0.18s var(--ease),
    color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.quality-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.quality-chip[aria-pressed="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.quality-chip.is-hls {
  border-style: dashed;
}

.quality-chip-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.4;
}

.quality-chip-label .ico {
  width: 13px;
  height: 13px;
  color: var(--accent);
}

.quality-chip-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.chip-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.size-pending {
  display: inline-block;
  min-width: 34px;
  height: 11px;
  border-radius: 4px;
  background: var(--surface-3);
  animation: softpulse 1.4s ease-in-out infinite;
}

.download-primary {
  margin-top: 14px;
}

.btn-download {
  position: relative;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.btn-download .ico {
  width: 21px;
  height: 21px;
}

.download-size {
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.download-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

.download-hint .ico {
  width: 13px;
  height: 13px;
  color: var(--ok);
}

.download-unavailable {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
}

.download-unavailable-text {
  flex: 1 1 190px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.65;
}

.download-unavailable-text strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.download-unavailable .btn {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 11px;
  font-size: 12.5px;
}

.panel-alert {
  display: flex;
  gap: 9px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--warn-border);
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.7;
}

.panel-alert .ico {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 2px;
}

.panel-alert a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.panel-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.panel-extra .btn {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 11px;
  font-size: 12.5px;
}

/* ---------- Secondary actions ---------- */
.secondary-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 58px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.18s var(--ease),
    color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    transform 0.16s var(--ease);
}

.action-btn .ico {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  transition: color 0.18s var(--ease);
}

.action-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.action-btn:hover .ico {
  color: var(--accent);
}

.action-btn:active {
  transform: scale(0.97);
}

/* ---------- Inline extras (chips as links, quote, caption) ---------- */
a.quality-chip,
a.quality-chip:visited {
  color: var(--text-2);
  text-decoration: none;
}

a.quality-chip:hover {
  color: var(--text);
}

.size-text {
  display: inline-block;
  min-width: 1.5em;
  font-variant-numeric: tabular-nums;
}

.size-text.is-filled {
  min-width: 0;
}

.media-caption-item .ico {
  width: 14px;
  height: 14px;
}

.caption-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.caption-link:hover {
  border-color: var(--accent-border);
  color: var(--text);
}

.caption-link .ico {
  width: 12px;
  height: 12px;
  color: var(--accent);
}

.quote-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.quote-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  color: var(--text-2);
}

.quote-link > .ico {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--accent);
}

.quote-link > .ico:last-child {
  margin-left: auto;
  width: 13px;
  height: 13px;
  color: var(--text-3);
}

.quote-link-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-link-text b {
  color: var(--text-2);
  font-weight: 650;
}

.tweet-toggle .ico {
  width: 14px;
  height: 14px;
  transition: transform 0.2s var(--ease);
}

.tweet-toggle[aria-expanded="true"] .ico {
  transform: rotate(180deg);
}

.error-icon.is-info {
  background: var(--accent-soft);
  color: var(--accent);
}

.history-thumb img {
  position: relative;
  z-index: 1;
}

.sticky-sub .size-text {
  display: inline;
}

/* ---------- Skeleton ---------- */
.result-skeleton {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.sk-media {
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  aspect-ratio: 16 / 9;
}

.sk-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(18px, 3.4vw, 24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.sk-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sk-avatar {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-3);
}

.sk-lines {
  flex: 1;
  min-width: 0;
}

.sk-line {
  height: 13px;
  margin-bottom: 10px;
  border-radius: 7px;
  background: var(--surface-3);
}

.sk-line:last-child {
  margin-bottom: 0;
}

.sk-w25 { width: 25%; }
.sk-w30 { width: 30%; }
.sk-w40 { width: 40%; }
.sk-w60 { width: 60%; }
.sk-w80 { width: 80%; }
.sk-w90 { width: 90%; }

.sk-panel {
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sk-chips {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.sk-chip {
  width: 96px;
  height: 52px;
  border-radius: 13px;
  background: var(--surface-3);
}

.sk-btn {
  height: 54px;
  border-radius: 15px;
  background: var(--surface-3);
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    100deg,
    transparent 15%,
    rgba(255, 255, 255, 0.055) 45%,
    rgba(255, 255, 255, 0.08) 55%,
    transparent 85%
  );
  animation: shimmer 1.7s var(--ease) infinite;
}

[data-theme="light"] .shimmer::after {
  background: linear-gradient(
    100deg,
    transparent 15%,
    rgba(255, 255, 255, 0.75) 45%,
    rgba(255, 255, 255, 0.9) 55%,
    transparent 85%
  );
}

/* ---------- Error card ---------- */
.error-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: clamp(20px, 4vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: fadeUp 0.32s var(--ease) both;
}

.error-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
}

.error-icon .ico {
  width: 22px;
  height: 22px;
}

.error-body {
  min-width: 0;
}

.error-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.error-msg {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.error-tips {
  margin: 12px 0 0;
  padding: 0 0 0 18px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.8;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.error-actions .btn {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 13px;
  font-size: 14px;
}

/* ---------- History ---------- */
.history {
  margin-top: clamp(38px, 6vw, 60px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.005em;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.history-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list.is-collapsed {
  display: none;
}

.history-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.18s var(--ease),
    background 0.18s var(--ease),
    transform 0.16s var(--ease),
    box-shadow 0.2s var(--ease);
}

.history-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.history-card:active {
  transform: translateY(0) scale(0.995);
}

.history-thumb {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-3);
}

.history-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-thumb .ico {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  margin: auto;
  color: var(--text-3);
}

.history-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.history-author {
  overflow: hidden;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-text {
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10.5px;
  opacity: 0.8;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: clamp(44px, 8vw, 80px);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 28px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 32px);
  padding-bottom: calc(26px + var(--safe-b));
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.7;
}

.footer-note {
  max-width: 620px;
  margin: 0;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}

.health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.health[data-state="ok"] .health-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(67, 209, 154, 0.14);
}

.health[data-state="down"] .health-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.health[data-state="checking"] .health-dot {
  background: var(--warn);
  animation: softpulse 1.4s ease-in-out infinite;
}

.footer-sep {
  opacity: 0.45;
}

/* ---------- Sticky download bar (mobile) ---------- */
.sticky-download {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 46;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-bottom: calc(10px + var(--safe-b));
  border-top: 1px solid var(--border);
  background: var(--sticky-bg);
  box-shadow: 0 -14px 40px -20px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  animation: slideUp 0.28s var(--ease) both;
}

.sticky-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.sticky-title {
  overflow: hidden;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-sub {
  overflow: hidden;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-download .btn {
  flex: none;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 14px;
}

.sticky-download .btn .ico {
  width: 18px;
  height: 18px;
}

.sticky-download .download-size {
  font-size: 11px;
  padding: 2px 6px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + var(--safe-b));
  z-index: 80;
  max-width: min(90vw, 440px);
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(3, 3, 6, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.lightbox-inner {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px
    calc(12px + var(--safe-b));
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  flex: none;
}

.lightbox-count {
  padding-left: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.lightbox-close {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.lightbox-stage {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 0;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  background: #0b0b0d;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.lightbox-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: none;
}

.lightbox-actions .action-btn {
  flex-direction: row;
  min-width: 84px;
  min-height: 46px;
  padding: 0 12px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 12.5px;
}

.lightbox-actions .action-btn .ico {
  color: rgba(255, 255, 255, 0.8);
}

.lightbox-actions .action-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.lightbox-actions .action-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.lightbox-download {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 14px;
}

body.lightbox-open {
  overflow: hidden;
}

/* ---------- noscript ---------- */
.noscript {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + var(--safe-b));
  z-index: 100;
  padding: 14px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   Responsive
   ============================================================ */

/* Large phones / small tablets */
@media (min-width: 560px) {
  .history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tablets */
@media (min-width: 700px) {
  .empty {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: clamp(28px, 5vw, 52px);
    padding: clamp(30px, 4vw, 42px) clamp(30px, 5vw, 52px);
  }

  .empty-art-wrap {
    width: clamp(180px, 24vw, 250px);
  }

  .empty-copy p {
    margin-left: 0;
  }

  .feature-list {
    justify-content: flex-start;
  }

  .result-skeleton {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }

  .sk-media {
    aspect-ratio: 16 / 10;
  }

  .history-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Desktop: two-column result */
@media (min-width: 1024px) {
  .result-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: clamp(24px, 3.2vw, 36px);
    align-items: start;
  }

  .media-col {
    position: sticky;
    top: 84px;
    gap: 14px;
  }

  .details-col {
    gap: 16px;
  }

  .history-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Sticky bar only on phones */
@media (min-width: 768px) {
  .sticky-download {
    display: none !important;
  }

  .history-list.is-collapsed {
    display: grid;
  }

  .section-actions [data-action="toggle-history"] {
    display: none;
  }

  .toast {
    bottom: calc(24px + var(--safe-b));
  }
}

/* Phones */
@media (max-width: 559px) {
  .searchbox {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border-radius: 20px;
  }

  .parse-btn {
    width: 100%;
    min-height: 52px;
    border-radius: 14px;
  }

  .field {
    min-height: 52px;
  }

  .hero-title {
    margin-top: 16px;
  }

  .brand-text small {
    display: none;
  }

  .secondary-actions {
    gap: 7px;
  }

  .action-btn {
    min-height: 56px;
    font-size: 11px;
  }

  .tweet-card,
  .download-panel {
    border-radius: 20px;
  }

  .media-card {
    border-radius: 20px;
  }

  body.has-sticky .main {
    padding-bottom: calc(150px + var(--safe-b));
  }

  body.has-sticky .footer-inner {
    padding-bottom: calc(130px + var(--safe-b));
  }
}

/* Very small phones (360px and below) */
@media (max-width: 374px) {
  .hero-title {
    font-size: 27px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .action-btn {
    font-size: 10.5px;
  }

  .quality-chip {
    min-width: 90px;
    padding: 8px 10px;
  }
}

/* ---------- Motion ---------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes softpulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.9;
  }
}

@keyframes livedot {
  0% {
    box-shadow: 0 0 0 0 rgba(109, 139, 255, 0.45);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(109, 139, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(109, 139, 255, 0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
