/* =========================================================
   TT Downloader — Modern Responsive App UI v5
   Created for urduaiacademy.com
   ========================================================= */

:root {
  color-scheme: light;

  --page-max: 1180px;
  --content-pad: clamp(16px, 3vw, 32px);

  --bg: #f4f7fb;
  --bg-elevated: rgba(255, 255, 255, 0.88);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;

  --text: #101828;
  --text-2: #344054;
  --text-3: #667085;

  --line: #e4e7ec;
  --line-strong: #d0d5dd;

  --brand: #111827;
  --brand-2: #3448ff;
  --brand-3: #ff2e78;
  --brand-soft: #eef2ff;

  --success: #079455;
  --success-soft: #ecfdf3;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warning: #dc6803;
  --warning-soft: #fffaeb;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, 0.07);
  --shadow-md: 0 12px 32px rgba(16, 24, 40, 0.10);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.13);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --header-h: 72px;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #090d16;
  --bg-elevated: rgba(15, 23, 42, 0.82);
  --surface: #111827;
  --surface-2: #151e2e;
  --surface-3: #1e293b;

  --text: #f8fafc;
  --text-2: #d0d5dd;
  --text-3: #98a2b3;

  --line: #263244;
  --line-strong: #344054;

  --brand: #f8fafc;
  --brand-2: #7c8cff;
  --brand-3: #ff5d98;
  --brand-soft: rgba(124, 140, 255, 0.12);

  --success: #47cd89;
  --success-soft: rgba(7, 148, 85, 0.12);
  --danger: #f97066;
  --danger-soft: rgba(217, 45, 32, 0.12);
  --warning: #fdb022;
  --warning-soft: rgba(220, 104, 3, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 16px 38px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 30px 76px rgba(0, 0, 0, 0.42);
}

/* ---------- Reset ---------- */

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

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% -10%, rgba(52, 72, 255, 0.10), transparent 34rem),
    radial-gradient(circle at 88% 4%, rgba(255, 46, 120, 0.08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

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

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(52, 72, 255, 0.22);
}

:focus-visible {
  outline: 3px solid rgba(52, 72, 255, 0.28);
  outline-offset: 3px;
}

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

/* ---------- Shared Layout ---------- */

.app-shell {
  min-height: 100dvh;
}

.content-container,
.header-container {
  width: min(100%, var(--page-max));
  margin-inline: auto;
  padding-inline:
    max(
      var(--content-pad),
      env(safe-area-inset-left)
    )
    max(
      var(--content-pad),
      env(safe-area-inset-right)
    );
}

main {
  display: block;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--brand-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading,
.center-section-heading {
  margin-bottom: 24px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading-spaced {
  margin-bottom: 18px;
}

.section-heading h2,
.section-heading h3,
.center-section-heading h2 {
  margin: 0;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.center-section-heading {
  max-width: 680px;
  margin-inline: auto;
  text-align: center;
}

.center-section-heading h2 {
  font-size: clamp(1.65rem, 4vw, 2.35rem);
}

.center-section-heading p {
  margin: 8px 0 0;
  color: var(--text-3);
}

/* ---------- Header / App Bar ---------- */

.site-header {
  position: sticky;
  z-index: 60;
  top: 0;
  min-height: var(--header-h);
  border-bottom: 1px solid rgba(208, 213, 221, 0.72);
  background: var(--bg-elevated);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

html[data-theme="dark"] .site-header {
  border-bottom-color: rgba(52, 64, 84, 0.72);
}

.header-container {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  flex: 0 0 auto;
}

.brand-logo-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.brand-logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-copy {
  min-width: 0;
  display: grid;
  line-height: 1.08;
}

.brand-name {
  overflow: hidden;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-credit {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 650;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-button,
.icon-button,
.secondary-button,
.text-button,
.install-main-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 750;
  box-shadow: var(--shadow-xs);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.header-button,
.secondary-button,
.install-main-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.icon-button {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.header-button:hover,
.icon-button:hover,
.secondary-button:hover,
.install-main-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.install-header-button {
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero-section {
  position: relative;
  overflow: hidden;
  padding: clamp(54px, 8vw, 104px) 0 clamp(42px, 6vw, 82px);
}

.hero-section::before,
.hero-section::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(1px);
}

.hero-section::before {
  width: 480px;
  height: 480px;
  left: -250px;
  top: -200px;
  background: radial-gradient(circle, rgba(52, 72, 255, 0.13), transparent 68%);
}

.hero-section::after {
  width: 430px;
  height: 430px;
  right: -230px;
  top: -140px;
  background: radial-gradient(circle, rgba(255, 46, 120, 0.10), transparent 68%);
}

.hero-container {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 780px;
  margin: 0 auto 32px;
  text-align: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 auto 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--text-2);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  box-shadow: var(--shadow-xs);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #12b76a;
  box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.10);
}

.hero-copy h1 {
  max-width: 760px;
  margin: 0 auto;
  color: var(--text);
  font-size: clamp(2.55rem, 7vw, 5.45rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-highlight {
  background: linear-gradient(100deg, #0ba5ec 0%, #3448ff 52%, #ff2e78 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-description {
  max-width: 660px;
  margin: 22px auto 0;
  color: var(--text-3);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.7;
}

/* ---------- Download Composer ---------- */

.download-card {
  width: min(100%, 900px);
  margin-inline: auto;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.download-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.url-control {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 0 8px 0 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.url-control:focus-within {
  border-color: rgba(52, 72, 255, 0.45);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(52, 72, 255, 0.08);
}

.url-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  opacity: 0.72;
}

.url-input {
  min-width: 0;
  flex: 1;
  height: 48px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 600;
}

.url-input::placeholder {
  color: var(--text-3);
  opacity: 0.86;
}

.field-action {
  min-width: 44px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--line);
}

.clear-button {
  font-size: 1.25rem;
}

.primary-download-button {
  min-width: 150px;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 15px;
  background:
    linear-gradient(135deg, #111827 0%, #263247 100%);
  color: #ffffff;
  font-weight: 850;
  box-shadow:
    0 12px 26px rgba(17, 24, 39, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition:
    transform 160ms ease,
    filter 160ms ease,
    box-shadow 160ms ease;
}

.primary-download-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow:
    0 16px 32px rgba(17, 24, 39, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.primary-download-button:active {
  transform: translateY(0);
}

.primary-download-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-arrow {
  font-size: 1.05rem;
}

.form-message {
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 650;
}

.form-message.error {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.form-message.success {
  border-color: color-mix(in srgb, var(--success) 28%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.trust-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 13px 8px 2px;
  color: var(--text-3);
  font-size: 0.76rem;
  font-weight: 700;
}

/* ---------- Processing ---------- */

.processing-section,
.result-section,
.error-section,
.recent-section {
  padding: 0 0 40px;
}

.processing-card,
.error-card {
  width: min(100%, 900px);
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.processing-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.processing-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--surface-3);
  border-top-color: var(--brand-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.processing-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.processing-copy strong {
  color: var(--text);
}

.processing-copy span {
  color: var(--text-3);
  font-size: 0.9rem;
}

.processing-progress {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.processing-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ba5ec, #3448ff, #ff2e78);
  transition: width 320ms ease;
}

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

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

.result-card {
  width: min(100%, 980px);
  margin-inline: auto;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.result-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.result-topbar h2 {
  margin: 8px 0 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.result-success-badge,
.platform-badge,
.recommended-badge,
.quality-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
}

.result-success-badge {
  padding: 6px 10px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.76rem;
}

.media-overview {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-2);
}

.media-thumbnail-wrap {
  width: 126px;
  aspect-ratio: 9 / 12;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(145deg, var(--surface-3), var(--surface));
  box-shadow: var(--shadow-sm);
}

.media-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-content {
  min-width: 0;
}

.media-heading {
  display: grid;
  gap: 9px;
}

.platform-badge {
  width: fit-content;
  padding: 5px 9px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 0.72rem;
}

.media-heading h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.4;
}

.media-meta-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.media-meta-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.meta-label {
  display: block;
  margin-bottom: 3px;
  color: var(--text-3);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.media-meta-item strong {
  display: block;
  overflow: hidden;
  color: var(--text-2);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-section,
.download-options-section {
  margin-top: 26px;
}

.video-player-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #020617;
  box-shadow: var(--shadow-md);
}

.video-player-shell video {
  width: 100%;
  max-height: min(72vh, 720px);
  margin: auto;
  background: #020617;
}

/* ---------- Download Options ---------- */

.featured-download-button {
  position: relative;
  width: 100%;
  min-height: 72px;
  margin-bottom: 14px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(52, 72, 255, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(52, 72, 255, 0.12), rgba(255, 46, 120, 0.08)),
    var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.featured-download-button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.20), transparent 65%);
  transform: translateX(-120%);
  transition: transform 520ms ease;
}

.featured-download-button:hover {
  transform: translateY(-1px);
  border-color: rgba(52, 72, 255, 0.44);
  box-shadow: var(--shadow-md);
}

.featured-download-button:hover::after {
  transform: translateX(120%);
}

.featured-download-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #111827, #344054);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
}

.featured-download-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.featured-download-copy strong {
  font-size: 0.98rem;
  font-weight: 850;
}

.featured-download-copy > span {
  overflow: hidden;
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-download-arrow {
  color: var(--brand-2);
  font-size: 1.25rem;
  font-weight: 900;
}

.mobile-download-help {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 24%, var(--line));
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--text-2);
  font-size: 0.78rem;
  line-height: 1.55;
}

.quality-list {
  display: grid;
  gap: 10px;
}

.quality-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.quality-option:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface);
}

.quality-option-main {
  min-width: 0;
}

.quality-option-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text);
  font-weight: 820;
}

.recommended-badge {
  padding: 4px 8px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.67rem;
}

.quality-option-details {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 650;
}

.quality-download-button {
  min-width: 138px;
  min-height: 48px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 13px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.86rem;
  font-weight: 850;
  box-shadow: var(--shadow-sm);
  transition:
    transform 160ms ease,
    opacity 160ms ease,
    box-shadow 160ms ease;
}

html[data-theme="dark"] .quality-download-button {
  background: #f8fafc;
  color: #101828;
}

.quality-download-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.download-notice {
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.78rem;
}

/* ---------- Error ---------- */

.error-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
}

.error-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 900;
}

.error-copy h2 {
  margin: 0;
  font-size: 1rem;
}

.error-copy p {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 0.86rem;
}

/* ---------- Recent ---------- */

.recent-section {
  padding-top: 8px;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.recent-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.recent-thumbnail {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 11px;
  background: var(--surface-3);
}

.recent-copy {
  min-width: 0;
}

.recent-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 780;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recent-meta {
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-3);
  font-size: 0.78rem;
}

.text-button:hover {
  color: var(--text);
}

/* ---------- Ads ---------- */

.native-ad-section {
  padding: 14px 0 46px;
}

.native-ad-section .content-container {
  width: min(100%, 980px);
}

.native-ad-section .section-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--text-3);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
}

.native-ad-slot {
  min-height: 80px;
  overflow: hidden;
  border-radius: 16px;
}

/* ---------- Informational Sections ---------- */

.info-section,
.install-section,
.privacy-section,
.faq-section {
  padding: clamp(56px, 8vw, 92px) 0;
}

.info-section,
.privacy-section {
  border-top: 1px solid var(--line);
}

.steps-grid,
.privacy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.step-card,
.privacy-item {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.step-card {
  padding: 20px;
}

.step-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 0.82rem;
  font-weight: 900;
}

.step-card h3,
.privacy-item h3 {
  margin: 0;
  font-size: 0.96rem;
}

.step-card p,
.privacy-item p {
  margin: 8px 0 0;
  color: var(--text-3);
  font-size: 0.86rem;
  line-height: 1.65;
}

/* ---------- Install Card ---------- */

.install-section {
  padding-top: 20px;
}

.install-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: clamp(26px, 5vw, 64px);
  padding: clamp(24px, 5vw, 52px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(52, 72, 255, 0.07), rgba(255, 46, 120, 0.04)),
    var(--surface);
  box-shadow: var(--shadow-md);
}

.install-visual {
  display: grid;
  place-items: center;
}

.phone-preview {
  width: 150px;
  aspect-ratio: 0.56;
  position: relative;
  display: grid;
  place-items: center;
  border: 4px solid var(--text);
  border-radius: 28px;
  background:
    linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--brand-3) 8%, var(--surface)));
  box-shadow: var(--shadow-lg);
}

.phone-preview::before {
  content: "";
  position: absolute;
  top: 8px;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--text);
}

.phone-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--text);
  color: var(--surface);
  font-weight: 900;
}

.install-content h2 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.install-content p {
  max-width: 600px;
  margin: 14px 0 0;
  color: var(--text-3);
  line-height: 1.7;
}

.install-main-button {
  margin-top: 18px;
  min-height: 48px;
  background: var(--text);
  color: var(--surface);
  border-color: transparent;
}

html[data-theme="dark"] .install-main-button {
  background: #f8fafc;
  color: #101828;
}

.ios-install-help {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.8rem;
}

/* ---------- Privacy / Trust ---------- */

.privacy-grid {
  gap: 12px;
}

.privacy-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  padding: 17px;
}

.privacy-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-weight: 900;
}

/* ---------- FAQ ---------- */

.faq-section {
  border-top: 1px solid var(--line);
}

.faq-container {
  max-width: 820px;
}

.faq-list {
  display: grid;
  gap: 9px;
}

.faq-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.faq-item summary {
  min-height: 54px;
  padding: 15px 46px 15px 16px;
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 780;
}

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

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  color: var(--text-3);
  font-size: 1.2rem;
  font-weight: 500;
}

.faq-item[open] summary::after {
  content: "–";
}

.faq-item p {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--text-3);
  font-size: 0.86rem;
  line-height: 1.65;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 56%, transparent);
  padding:
    28px
    0
    max(
      28px,
      calc(18px + env(safe-area-inset-bottom))
    );
}

.footer-main {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.footer-brand {
  display: grid;
  gap: 4px;
}

.footer-brand strong {
  font-size: 0.9rem;
}

.footer-brand span {
  color: var(--text-3);
  font-size: 0.76rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
}

.footer-links a {
  color: var(--text-3);
  font-size: 0.76rem;
  font-weight: 700;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-bottom {
  margin-top: 20px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 0.7rem;
}

.footer-bottom p {
  margin: 0;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom:
    max(
      18px,
      calc(10px + env(safe-area-inset-bottom))
    );
  width: min(calc(100% - 28px), 440px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-size: 0.84rem;
  font-weight: 700;
}

.toast-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-weight: 900;
}

.noscript-message {
  margin: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--warning-soft);
  color: var(--text);
  text-align: center;
}

/* ---------- Legal Pages ---------- */

.legal-page {
  padding: clamp(42px, 7vw, 82px) 0;
}

.legal-wrapper {
  width: min(100%, 860px);
  margin-inline: auto;
}

.legal-header {
  margin-bottom: 24px;
  text-align: center;
}

.legal-header h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.legal-header p {
  max-width: 660px;
  margin: 14px auto 0;
  color: var(--text-3);
  line-height: 1.7;
}

.legal-updated {
  width: fit-content;
  margin: 14px auto 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 700;
}

.legal-card {
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.legal-section + .legal-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.legal-section h2 {
  margin: 0 0 12px;
  font-size: clamp(1.08rem, 3vw, 1.35rem);
  letter-spacing: -0.02em;
}

.legal-section p,
.legal-section li {
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.75;
}

.legal-section p {
  margin: 0 0 12px;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section ul,
.legal-section ol {
  padding-left: 22px;
}

.legal-inline-links a,
.legal-section a {
  color: var(--brand-2);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-navigation {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

/* ---------- PWA / Standalone ---------- */

body.is-pwa .site-header {
  padding-top: env(safe-area-inset-top);
}

body.is-pwa .hero-section {
  padding-top: clamp(42px, 6vw, 72px);
}

/* ---------- Responsive: Tablet ---------- */

@media (max-width: 980px) {
  .media-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .install-card {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .steps-grid,
  .privacy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps-grid .step-card:last-child,
  .privacy-grid .privacy-item:last-child {
    grid-column: 1 / -1;
  }
}

/* ---------- Responsive: Mobile App ---------- */

@media (max-width: 767px) {
  :root {
    --header-h: 64px;
    --content-pad: 14px;
  }

  body {
    background:
      radial-gradient(circle at 18% -8%, rgba(52, 72, 255, 0.10), transparent 22rem),
      var(--bg);
  }

  .site-header {
    position: sticky;
  }

  .header-container {
    min-height: var(--header-h);
    gap: 10px;
  }

  .brand {
    gap: 9px;
  }

  .brand-logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand-name {
    max-width: 152px;
    font-size: 0.88rem;
  }

  .brand-credit {
    font-size: 0.65rem;
  }

  .header-button {
    min-height: 42px;
    padding-inline: 10px;
    font-size: 0.78rem;
  }

  .install-header-button span:last-child {
    display: none;
  }

  .icon-button {
    width: 42px;
    min-height: 42px;
  }

  .hero-section {
    padding: 38px 0 38px;
  }

  .hero-copy {
    margin-bottom: 24px;
  }

  .eyebrow {
    margin-bottom: 12px;
    padding: 6px 9px;
    font-size: 0.66rem;
  }

  .hero-copy h1 {
    max-width: 520px;
    font-size: clamp(2.3rem, 12vw, 3.75rem);
    line-height: 0.98;
  }

  .hero-description {
    margin-top: 16px;
    font-size: 0.94rem;
    line-height: 1.65;
  }

  .download-card {
    padding: 10px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
  }

  .download-form {
    grid-template-columns: 1fr;
  }

  .url-control,
  .primary-download-button {
    min-height: 56px;
  }

  .primary-download-button {
    width: 100%;
    min-width: 0;
  }

  .trust-strip {
    justify-content: flex-start;
    padding: 12px 5px 3px;
    gap: 7px 12px;
    font-size: 0.68rem;
  }

  .processing-section,
  .result-section,
  .error-section,
  .recent-section {
    padding-bottom: 28px;
  }

  .processing-card {
    padding: 15px;
    border-radius: 18px;
  }

  .result-card {
    padding: 14px;
    border-radius: 22px;
  }

  .result-topbar {
    align-items: center;
    margin-bottom: 16px;
  }

  .result-topbar h2 {
    font-size: 1.35rem;
  }

  .result-topbar .secondary-button {
    min-height: 40px;
    padding-inline: 10px;
    font-size: 0.76rem;
  }

  .media-overview {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 13px;
    padding: 12px;
    border-radius: 16px;
  }

  .media-thumbnail-wrap {
    width: 88px;
    border-radius: 13px;
  }

  .media-heading h3 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.9rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .media-meta-grid {
    margin-top: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .media-meta-item {
    padding: 8px;
  }

  .meta-label {
    font-size: 0.59rem;
  }

  .media-meta-item strong {
    font-size: 0.72rem;
  }

  .preview-section,
  .download-options-section {
    margin-top: 20px;
  }

  .video-player-shell {
    border-radius: 16px;
  }

  .video-player-shell video {
    max-height: 64vh;
  }

  .section-heading {
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }

  .section-heading h3 {
    font-size: 1rem;
  }

  .quality-count {
    flex: 0 0 auto;
    padding: 5px 8px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 0.67rem;
  }

  .featured-download-button {
    min-height: 76px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    padding: 13px;
    border-radius: 17px;
  }

  .featured-download-copy strong {
    font-size: 0.94rem;
  }

  .quality-option {
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 12px;
  }

  .quality-download-button {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    border-radius: 13px;
    font-size: 0.9rem;
  }

  .download-notice {
    font-size: 0.73rem;
  }

  .error-card {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 14px;
  }

  .error-card .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .recent-grid {
    grid-template-columns: 1fr;
  }

  .native-ad-section {
    padding-bottom: 32px;
  }

  .info-section,
  .install-section,
  .privacy-section,
  .faq-section {
    padding: 52px 0;
  }

  .steps-grid,
  .privacy-grid {
    grid-template-columns: 1fr;
  }

  .steps-grid .step-card:last-child,
  .privacy-grid .privacy-item:last-child {
    grid-column: auto;
  }

  .step-card {
    padding: 17px;
    border-radius: 17px;
  }

  .install-section {
    padding-top: 12px;
  }

  .install-card {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 22px 18px;
    text-align: center;
    border-radius: 22px;
  }

  .install-visual {
    order: 2;
  }

  .install-content {
    order: 1;
  }

  .install-content h2 {
    font-size: 1.75rem;
  }

  .install-main-button {
    width: 100%;
  }

  .phone-preview {
    width: 122px;
  }

  .privacy-item {
    padding: 15px;
    border-radius: 16px;
  }

  .faq-item {
    border-radius: 14px;
  }

  .footer-main,
  .footer-bottom {
    flex-direction: column;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .footer-bottom {
    gap: 7px;
  }

  .toast {
    bottom:
      max(
        12px,
        calc(8px + env(safe-area-inset-bottom))
      );
  }

  .legal-page {
    padding: 36px 0 54px;
  }

  .legal-card {
    padding: 18px 15px;
    border-radius: 20px;
  }

  .legal-section + .legal-section {
    margin-top: 24px;
    padding-top: 24px;
  }

  .legal-section p,
  .legal-section li {
    font-size: 0.88rem;
  }
}

/* ---------- Very Small Phones ---------- */

@media (max-width: 420px) {
  .brand-name {
    max-width: 128px;
  }

  .brand-credit {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(2.15rem, 13vw, 3.05rem);
  }

  .url-icon {
    display: none;
  }

  .url-control {
    padding-left: 12px;
  }

  .paste-button {
    min-width: 58px;
  }

  .media-overview {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .media-thumbnail-wrap {
    width: 74px;
  }

  .featured-download-button {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .featured-download-arrow {
    display: none;
  }

  .featured-download-icon {
    width: 44px;
    height: 44px;
  }
}

/* ---------- Landscape Phones ---------- */

@media (max-height: 520px) and (orientation: landscape) {
  .hero-section {
    padding-top: 26px;
    padding-bottom: 28px;
  }

  .hero-copy h1 {
    font-size: clamp(2rem, 7vw, 3.3rem);
  }

  .video-player-shell video {
    max-height: 74vh;
  }
}

/* ---------- Coarse Pointer / Touch ---------- */

@media (pointer: coarse) {
  .header-button,
  .icon-button,
  .secondary-button,
  .text-button,
  .field-action,
  .primary-download-button,
  .quality-download-button,
  .install-main-button,
  .featured-download-button {
    touch-action: manipulation;
  }
}

/* ---------- Reduced Motion ---------- */

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

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

/* ---------- High Contrast ---------- */

@media (forced-colors: active) {
  .primary-download-button,
  .quality-download-button,
  .featured-download-icon,
  .phone-icon {
    border: 1px solid ButtonText;
  }
}

/* =========================================================
   V7 — QUICK DOWNLOAD PRODUCT EXPERIENCE
   Simpler, faster, installable, download-first
   ========================================================= */

:root {
  --v7-max: 1180px;
  --v7-radius-xl: 28px;
  --v7-radius-lg: 22px;
  --v7-radius-md: 16px;
}

body[data-ui-version="7"] .content-container,
body[data-ui-version="7"] .header-container {
  width: min(var(--v7-max), calc(100% - 32px));
}

body[data-ui-version="7"] .hero-section {
  padding-top: clamp(34px, 6vw, 72px);
  padding-bottom: 26px;
}

body[data-ui-version="7"] .hero-container {
  max-width: 920px;
}

body[data-ui-version="7"] .hero-copy {
  max-width: 780px;
  margin-inline: auto;
  text-align: center;
}

body[data-ui-version="7"] .hero-copy h1 {
  max-width: 820px;
  margin-inline: auto;
  font-size: clamp(2.25rem, 6vw, 4.8rem);
  letter-spacing: -0.055em;
  line-height: 0.98;
}

body[data-ui-version="7"] .hero-description {
  max-width: 720px;
  margin-inline: auto;
  font-size: clamp(0.98rem, 1.5vw, 1.08rem);
  line-height: 1.72;
}

body[data-ui-version="7"] .download-card {
  max-width: 900px;
  margin-inline: auto;
  margin-top: 28px;
  border-radius: var(--v7-radius-xl);
}

.auto-fetch-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 0.76rem;
  font-weight: 750;
  text-align: center;
}

.auto-fetch-icon {
  color: var(--brand-2);
}

.quick-install-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--surface) 96%, transparent),
      color-mix(in srgb, var(--surface-2) 88%, transparent)
    );
}

.quick-install-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quick-install-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.quick-install-copy > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-install-copy strong {
  color: var(--text-1);
  font-size: 0.86rem;
}

.quick-install-copy span:not(.quick-install-icon) {
  color: var(--text-3);
  font-size: 0.72rem;
  line-height: 1.45;
}

.quick-install-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-install-button,
.quick-install-help-button {
  min-height: 42px;
  border-radius: 12px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.quick-install-button {
  padding-inline: 15px;
  border: 0;
  color: #fff;
  background: var(--brand);
}

.quick-install-help-button {
  padding-inline: 12px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
}

.result-card-v7 {
  overflow: visible;
  border-radius: var(--v7-radius-xl);
}

.quick-result-summary {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin: 18px 0 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
}

.quick-thumbnail-wrap {
  min-height: 170px;
}

.quick-result-copy {
  min-width: 0;
}

.quick-meta-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.quick-meta-row span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.quick-meta-row b {
  color: var(--text-3);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-meta-row strong {
  overflow: hidden;
  color: var(--text-1);
  font-size: 0.77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-download-panel {
  margin-top: 0;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 100% 0%,
      color-mix(in srgb, var(--brand) 12%, transparent),
      transparent 38%
    ),
    var(--surface);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.download-first-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.download-first-heading h3 {
  margin: 4px 0 4px;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
}

.download-first-heading p {
  margin: 0;
  color: var(--text-3);
  font-size: 0.78rem;
}

.featured-download-button-v7 {
  min-height: 68px;
  margin: 14px 0 16px;
  border-radius: 18px;
  box-shadow: 0 16px 38px rgba(64, 81, 255, 0.22);
}

.quality-list-v7 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quality-list-v7 .quality-option {
  min-width: 0;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.quality-list-v7 .quality-option-main {
  align-self: center;
}

.quality-list-v7 .quality-option-title > span:first-child {
  font-size: 1rem;
  font-weight: 900;
}

.quality-list-v7 .quality-option-details {
  margin-top: 4px;
}

.quality-list-v7 .quality-download-button {
  min-width: 124px;
  min-height: 48px;
  border-radius: 13px;
  font-weight: 900;
}

.preview-disclosure {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.preview-disclosure summary {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.preview-disclosure summary::-webkit-details-marker {
  display: none;
}

.preview-disclosure summary > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-disclosure summary strong {
  color: var(--text-1);
  font-size: 0.86rem;
}

.preview-disclosure summary small {
  color: var(--text-3);
  font-size: 0.7rem;
}

.preview-chevron {
  color: var(--text-3);
  transition: transform 160ms ease;
}

.preview-disclosure[open] .preview-chevron {
  transform: rotate(180deg);
}

.preview-disclosure-body {
  padding: 0 14px 14px;
}

.install-section-v7 {
  padding-block: clamp(54px, 7vw, 86px);
}

.install-guide-card {
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(
      circle at 92% 0%,
      color-mix(in srgb, var(--brand) 13%, transparent),
      transparent 38%
    ),
    var(--surface);
  box-shadow: var(--shadow-lg);
}

.install-guide-heading {
  max-width: 720px;
  margin-bottom: 22px;
}

.install-guide-heading h2 {
  margin: 8px 0 8px;
}

.install-guide-heading p {
  margin: 0 0 18px;
  color: var(--text-2);
  line-height: 1.7;
}

.install-device-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.install-device-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-2);
}

.install-device-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 13px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.install-device-card h3 {
  margin: 0 0 7px;
  font-size: 0.98rem;
}

.install-device-card p {
  margin: 0;
  color: var(--text-3);
  font-size: 0.78rem;
  line-height: 1.6;
}

.install-guide-modal[hidden] {
  display: none !important;
}

.install-guide-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.install-guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.install-guide-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 32px 90px rgba(2, 6, 23, 0.35);
}

.install-guide-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
}

.install-guide-dialog h2 {
  margin: 8px 42px 8px 0;
}

.install-guide-dialog > p {
  color: var(--text-2);
  line-height: 1.6;
}

.install-guide-steps {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
  counter-reset: install-step;
}

.install-guide-steps li {
  counter-increment: install-step;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.82rem;
  line-height: 1.5;
}

.install-guide-steps li::before {
  content: counter(install-step);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.install-guide-done {
  width: 100%;
}

body.install-guide-open {
  overflow: hidden;
}

/* Mobile: everything important stays above the fold and reachable */
@media (max-width: 767px) {
  body[data-ui-version="7"] .content-container,
  body[data-ui-version="7"] .header-container {
    width: min(100% - 22px, var(--v7-max));
  }

  body[data-ui-version="7"] .hero-section {
    padding-top: 22px;
  }

  body[data-ui-version="7"] .hero-copy {
    text-align: left;
  }

  body[data-ui-version="7"] .hero-copy h1 {
    font-size: clamp(2.15rem, 12vw, 3.15rem);
  }

  body[data-ui-version="7"] .hero-description {
    margin-inline: 0;
    font-size: 0.92rem;
  }

  body[data-ui-version="7"] .download-card {
    margin-top: 20px;
    padding: 13px;
    border-radius: 20px;
  }

  .download-form {
    gap: 9px;
  }

  .primary-download-button {
    min-height: 54px;
  }

  .auto-fetch-hint {
    justify-content: flex-start;
    border-radius: 13px;
    text-align: left;
  }

  .quick-install-card {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .quick-install-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .quick-install-button {
    width: 100%;
  }

  .result-card-v7 {
    padding: 13px;
  }

  .result-topbar {
    align-items: flex-start;
  }

  .result-topbar h2 {
    font-size: 1.2rem;
  }

  .quick-result-summary {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 12px;
    margin: 12px 0 14px;
    padding: 10px;
    border-radius: 16px;
  }

  .quick-thumbnail-wrap {
    min-height: 112px;
  }

  .quick-meta-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
  }

  .quick-meta-row span {
    padding: 7px;
  }

  .quick-download-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .download-first-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .featured-download-button-v7 {
    position: sticky;
    z-index: 30;
    bottom: max(10px, env(safe-area-inset-bottom));
    min-height: 62px;
    box-shadow: 0 18px 48px rgba(64, 81, 255, 0.3);
  }

  .quality-list-v7 {
    grid-template-columns: 1fr;
  }

  .quality-list-v7 .quality-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .quality-list-v7 .quality-download-button {
    min-width: 118px;
  }

  .preview-disclosure {
    margin-top: 14px;
  }

  .install-device-grid {
    grid-template-columns: 1fr;
  }

  .install-guide-dialog {
    padding: 20px;
    border-radius: 20px;
  }
}

/* Tiny phones */
@media (max-width: 380px) {
  .brand-credit {
    display: none;
  }

  .quick-install-actions {
    grid-template-columns: 1fr;
  }

  .quality-list-v7 .quality-option {
    grid-template-columns: 1fr;
  }

  .quality-list-v7 .quality-download-button {
    width: 100%;
  }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 1100px) {
  .quick-meta-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

/* Touch and keyboard */
@media (pointer: coarse) {
  .quick-install-button,
  .quick-install-help-button,
  .quality-download-button,
  .install-guide-close {
    min-height: 44px;
  }
}

.quick-install-button:focus-visible,
.quick-install-help-button:focus-visible,
.install-guide-close:focus-visible,
.preview-disclosure summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 48%, transparent);
  outline-offset: 3px;
}

/* =========================================================
   V8 — INSTALL ONCE + AUTO UPDATE
   ========================================================= */

.app-update-status {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-3);
  background: var(--surface-2);
  font-size: 0.68rem;
  font-weight: 800;
}

.app-update-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.app-update-status.is-checking .app-update-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.app-update-status.is-updating .app-update-dot {
  background: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}

.app-update-status.is-offline .app-update-dot {
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.14);
}

body.app-update-reloading::before {
  content: "Updating TT Downloader…";
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-weight: 900;
  text-align: center;
}

@media (max-width: 767px) {
  .app-update-status {
    margin-left: 0;
    border-radius: 12px;
  }
}


/* =========================================================
   V11 — STABLE PWA UPDATE UX
   No full-screen automatic update overlay.
   ========================================================= */

body.app-update-reloading::before {
  display: none !important;
  content: none !important;
}

body.app-update-reloading {
  overflow: auto !important;
}
