:root {
  /* Default Theme: Light Mode (soft warm cream & gold) */
  --bg-h: 36;
  --bg-s: 18%;
  --bg-l: 95%; /* #f5f3ef */
  --bg: hsl(var(--bg-h), var(--bg-s), var(--bg-l));

  --bg2-h: 36;
  --bg2-s: 12%;
  --bg2-l: 92%; /* #eeece8 */
  --bg2: hsl(var(--bg2-h), var(--bg2-s), var(--bg2-l));

  --bg3-h: 36;
  --bg3-s: 10%;
  --bg3-l: 88%; /* #e6e3de */
  --bg3: hsl(var(--bg3-h), var(--bg3-s), var(--bg3-l));

  --border: rgba(0, 0, 0, 0.08);
  --border-mid: rgba(0, 0, 0, 0.14);
  --text: #1a1916;
  --text-mid: #6b6660;
  --text-dim: #a8a4a0;
  --accent: #c49a20;
  --accent-dim: rgba(196, 154, 32, 0.12);
  --accent-glow: rgba(196, 154, 32, 0.25);
  --card-bg: #ffffff;
  --input-bg: var(--bg3);

  /* Glassmorphism Settings (Light Mode) */
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);

  --yt:          #ff3c3c;
  --ig:          #e1306c;
  --tw:          #1d9bf0;
  --fb:          #1877f2;
  --tt:          #010101;
  --pin:         #e60023;
  --radius:      14px;
  --radius-sm:   8px;
  --radius-pill: 100px;
  --font-display: 'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;
  --transition:   0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --card-shadow:  0 0 0 1px var(--glass-border), var(--glass-shadow);
}

[data-theme="dark"] {
  /* Override Theme: Dark Mode (rich pitch black & warm gold) */
  --bg-h: 240;
  --bg-s: 4%;
  --bg-l: 5%; /* #0c0c0d */
  --bg: hsl(var(--bg-h), var(--bg-s), var(--bg-l));

  --bg2-h: 240;
  --bg2-s: 5%;
  --bg2-l: 7%; /* #111113 */
  --bg2: hsl(var(--bg2-h), var(--bg2-s), var(--bg2-l));

  --bg3-h: 240;
  --bg3-s: 5%;
  --bg3-l: 10%; /* #18181b */
  --bg3: hsl(var(--bg3-h), var(--bg3-s), var(--bg3-l));

  --border: rgba(255, 255, 255, 0.06);
  --border-mid: rgba(255, 255, 255, 0.12);
  --text: #f0ede8;
  --text-mid: #8a8782;
  --text-dim: #4a4845;
  --accent: #e8c468;
  --accent-dim: rgba(232, 196, 104, 0.15);
  --accent-glow: rgba(232, 196, 104, 0.35);
  --card-bg: var(--bg2);
  --input-bg: var(--bg3);

  /* Glassmorphism Settings (Dark Mode) */
  --glass-bg: rgba(17, 17, 19, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --card-shadow: 0 0 0 1px var(--glass-border), var(--glass-shadow);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* ── Background grid ───────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 30%, transparent 100%);
}

/* ── Header ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 900px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: transparent;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  margin-right: 6px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-mid);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color var(--transition);
}

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

.theme-toggle {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; }

[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ── User chip in header (sitewide) ───────────────────── */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .75rem;
  background: rgba(232, 196, 104, .1);
  border: 1px solid rgba(232, 196, 104, .25);
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--accent, #e8c468);
  text-decoration: none;
}

.user-chip:hover {
  background: rgba(232, 196, 104, .18);
}

.user-chip svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.login-btn {
  padding: .35rem .9rem;
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  transition: all .15s;
  font-family: inherit;
}

.login-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ── Main layout ───────────────────────────────────────── */
/* Base stretch fix: only index.html sets main_class="main-content",
   so every other page's <main> was left shrink-wrapped by body's
   align-items:center. This low-specificity rule fixes that everywhere
   without affecting .main-content's own (homepage-specific) styling. */
main {
  width: 100%;
  flex: 1 1 auto;
}

.main-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  padding: 0 20px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  flex: 1;
}

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding-top: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.5s ease both;
}

.hero-eyebrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.platform-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid;
}

.platform-pill.yt  { color: var(--yt);  border-color: rgba(255,60,60,0.3);   background: rgba(255,60,60,0.07); }
.platform-pill.ig  { color: var(--ig);  border-color: rgba(225,48,108,0.3);  background: rgba(225,48,108,0.07); }
.platform-pill.tw  { color: var(--tw);  border-color: rgba(29,155,240,0.3);  background: rgba(29,155,240,0.07); }
.platform-pill.fb  { color: var(--fb);  border-color: rgba(24,119,242,0.3);  background: rgba(24,119,242,0.07); }
.platform-pill.tt  { color: #555;       border-color: rgba(0,0,0,0.2);       background: rgba(0,0,0,0.05); }
.platform-pill.pin { color: var(--pin); border-color: rgba(230,0,35,0.3);    background: rgba(230,0,35,0.07); }
[data-theme="dark"] .platform-pill.tt { color: #ccc; border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); }

.hero-title {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--text);
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-mid);
  letter-spacing: 0.03em;
}

/* ── Download card ─────────────────────────────────────── */
.card-wrap {
  width: 100%;
  animation: fadeUp 0.55s 0.1s ease both;
}

.download-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.download-card:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: var(--glass-shadow), 0 12px 40px 0 rgba(0, 0, 0, 0.12);
  border-color: var(--border-mid);
}

.download-card:focus-within {
  border-color: var(--accent);
  box-shadow: var(--card-shadow), 0 0 0 3px var(--accent-dim);
  transform: translateY(-4px) scale(1.015);
}

/* Step onboarding cards styling */
.step-card {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border) !important;
  border-radius: 18px;
  padding: 2rem;
  text-align: left;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.step-card:hover {
  transform: translateY(-6px) scale(1.025);
  border-color: var(--accent) !important;
  box-shadow: var(--glass-shadow), 0 12px 36px rgba(0, 0, 0, 0.12);
}

/* ── URL input row ─────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 10px;
}

.url-field-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  gap: 10px;
  transition: border-color var(--transition);
}

.url-field-wrap:focus-within { border-color: var(--border-mid); }

.url-icon {
  flex-shrink: 0;
  color: var(--text-dim);
  display: flex;
}

.url-icon svg { width: 16px; height: 16px; }

.url-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text);
  padding: 13px 0;
  min-width: 0;
  caret-color: var(--accent);
}

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

.clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
  flex-shrink: 0;
}

.clear-btn:hover { color: var(--text); }
.clear-btn svg { width: 14px; height: 14px; }

.fetch-btn {
  padding: 0 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 46px;
}

.fetch-btn:hover { background: #f0ce78; transform: translateY(-1px); }
.fetch-btn:active { transform: translateY(0); }
.fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Error banner ──────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,60,60,0.1);
  border: 1px solid rgba(255,60,60,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #ff7070;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  animation: slideDown 0.2s ease;
}

.error-banner svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Media preview ─────────────────────────────────────── */
.media-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideDown 0.25s ease;
}

.preview-thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg3);
}

.preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-duration {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
}

.platform-badge {
  position: absolute;
  top: 4px;
  left: 5px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.platform-badge.yt  { background: var(--yt);  color: #fff; }
.platform-badge.ig  { background: var(--ig);  color: #fff; }
.platform-badge.tw  { background: var(--tw);  color: #fff; }
.platform-badge.facebook  { background: var(--fb);  color: #fff; }
.platform-badge.tiktok    { background: #010101;    color: #fff; }
.platform-badge.pinterest { background: var(--pin); color: #fff; }

.preview-meta-below {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-title {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-channel {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mid);
}

/* ── Options row ───────────────────────────────────────── */
.options-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 120px;
}

.option-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toggle-group {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--text-mid);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.toggle-btn svg { width: 13px; height: 13px; }
.toggle-btn:hover { color: var(--text); }

.toggle-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.select-wrap {
  position: relative;
}

.custom-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.custom-select:focus { border-color: var(--accent); }

.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--text-mid);
  pointer-events: none;
}

/* ── Download button ───────────────────────────────────── */
.download-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.download-btn svg { width: 17px; height: 17px; }
.download-btn:hover { background: #f0ce78; transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.download-btn:active { transform: translateY(0); box-shadow: none; }
.download-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Status row ────────────────────────────────────────── */
.status-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-bar-wrap {
  height: 8px;
  background: var(--bg3);
  border-radius: 6px;
  overflow: hidden;
}

.status-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, #f5d98a 100%);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.status-bar.indeterminate {
  width: 40%;
  animation: barSlide 1.2s ease-in-out infinite;
}

.status-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-mid);
}

.status-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1.1em;
}

.progress-bytes {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mid);
}

.progress-speed {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

/* ── Platforms section ─────────────────────────────────── */
.platforms-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeUp 0.6s 0.2s ease both;
}

.platforms-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.platform-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.platform-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: all var(--transition);
}

.platform-chip:hover {
  border-color: var(--border-mid);
  color: var(--text);
}

.chip-icon { width: 16px; height: 16px; }
.yt-color  { color: var(--yt); }
.ig-color  { color: var(--ig); }
.tw-color  { color: var(--tw); }
.fb-color  { color: var(--fb); }
.tt-color  { color: #555; }
[data-theme="dark"] .tt-color { color: #ccc; }
.pin-color { color: var(--pin); }

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color var(--transition);
}

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

/* ── Spinner ───────────────────────────────────────────── */
.spin {
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes barSlide {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* ── Utility ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 560px) {
  /* Header */
  .site-header {
    padding: 16px 16px;
    gap: 12px;
  }

  .logo {
    font-size: 1rem;
  }

  .logo-mark {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  /* Main content */
  .main-content {
    padding: 0 16px 60px;
    gap: 32px;
  }

  /* Hero */
  .hero {
    padding-top: 32px;
    gap: 12px;
  }

  .hero-title {
    font-size: 2.5rem;
    line-height: 1;
  }

  .hero-sub {
    font-size: 0.75rem;
  }

  /* Card */
  .download-card {
    padding: 16px;
    gap: 14px;
  }

  /* Input row */
  .input-row {
    flex-direction: column;
    gap: 10px;
  }

  .url-input {
    font-size: 0.82rem;
    padding: 12px 0;
  }

  .fetch-btn {
    width: 100%;
    justify-content: center;
    padding: 13px;
    font-size: 0.86rem;
  }

  /* Media preview */
  .preview-thumb-wrap {
    aspect-ratio: 16/9;
  }

  .preview-title {
    font-size: 0.85rem;
  }

  .preview-channel {
    font-size: 0.7rem;
  }

  /* Options */
  .options-row {
    flex-direction: column;
    gap: 10px;
  }

  .option-group {
    min-width: auto;
  }

  .toggle-btn {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .toggle-btn svg {
    width: 12px;
    height: 12px;
  }

  .custom-select {
    font-size: 0.78rem;
    padding: 7px 28px 7px 10px;
  }

  /* Download button */
  .download-btn {
    padding: 12px;
    font-size: 0.9rem;
  }

  /* Platforms */
  .platforms-section {
    gap: 10px;
  }

  .platform-chips {
    gap: 8px;
  }

  .platform-chip {
    padding: 6px 12px;
    font-size: 0.76rem;
  }

  .chip-icon {
    width: 14px;
    height: 14px;
  }

  /* Nav (hidden on mobile) */
  .nav-links {
    display: none;
  }

  .theme-toggle {
    margin-left: auto;
  }

  /* Footer */
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 20px 16px;
  }

  /* Cookie hint */
  .cookie-hint {
    padding: 12px 14px;
  }

  .cookie-hint-header {
    font-size: 0.8rem;
  }

  .cookie-steps li {
    font-size: 0.72rem;
  }
}

/* Small phones */
@media (max-width: 360px) {
  .hero-title {
    font-size: 2.2rem;
  }

  .platform-pill {
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  .site-header {
    padding: 14px 12px;
  }

  .download-card {
    padding: 14px;
  }

  .main-content {
    padding: 0 12px 50px;
  }

  .hero {
    padding-top: 28px;
  }
}

/* ── Cookie hint ────────────────────────────────────────── */
.cookie-hint {
  background: rgba(232,196,104,0.08);
  border: 1px solid rgba(232,196,104,0.3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  animation: slideDown 0.25s ease;
}

.cookie-hint-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.cookie-hint-header svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.cookie-steps {
  list-style: decimal;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cookie-steps li {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-mid);
  line-height: 1.5;
}

.cookie-steps em {
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}

.cookie-steps code {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--accent);
  font-size: 0.72rem;
}

/* ── Touch device enhancements ─────────────────────────────── */
.touch-device .clear-btn,
.touch-device .theme-toggle,
.touch-device .fetch-btn,
.touch-device .download-btn,
.touch-device .toggle-btn {
  min-height: 44px;
}

.touch-device .clear-btn {
  padding: 8px;
}

.touch-device .url-input {
  font-size: 16px;
}

/* Prevent horizontal scroll on mobile */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .main-content,
  .site-header,
  .site-footer {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}


/* GitHub-Style Premium Alert Card */
.alert-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-align: left;
  background: rgba(255, 92, 92, 0.08);
  border: 1px solid rgba(255, 92, 92, 0.2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  animation: slideDown 0.25s ease both;
  width: 100%;
}

/* Light mode overrides for text contrast */
[data-theme="light"] .alert-card {
  background: rgba(220, 38, 38, 0.05);
  border-color: rgba(220, 38, 38, 0.15);
}

.alert-card-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.alert-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.alert-card-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.alert-card-text {
  font-family: 'Lora', serif;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-mid);
}

.alert-card-text strong {
  color: var(--text);
  font-family: var(--font-display);
}

.alert-card-subtext {
  font-family: 'Lora', serif;
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 0.25rem;
  line-height: 1.55;
}

/* --- Mobile Optimization Query --- */
@media (max-width: 480px) {
  .alert-card {
    padding: 1rem 1.1rem;
    gap: 0.75rem;
  }
  .alert-card-icon {
    font-size: 1.1rem;
  }
  .alert-card-title {
    font-size: 0.95rem;
  }
  .alert-card-text {
    font-size: 0.85rem;
  }
  .alert-card-subtext {
    font-size: 0.78rem;
  }
}

/* ── Account sidebar system (shared: navbar hamburger + drawer/dock) ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  font-family: var(--font-display);
  border: none;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #f0d070; box-shadow: 0 0 20px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text-mid); border: 1px solid var(--border-mid); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: .38rem .75rem; font-size: .78rem; }

.account-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--border-mid);
  color: var(--text);
  cursor: pointer;
}
.account-hamburger svg { width: 18px; height: 18px; }

.account-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 998;
}

.account-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100dvh;
  overflow-y: auto;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  flex-shrink: 0;
  z-index: 999;
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(0.4, 0, 0.2, 1);
}
.account-sidebar.open { transform: translateX(0); }
.account-sidebar.open ~ .account-sidebar-backdrop,
.account-sidebar-backdrop.open { display: block; }

.sidebar-logo { padding: 0 1.4rem 1.5rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem 1.4rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  border-left: 2px solid transparent;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-section {
  padding: .4rem 1.4rem .2rem;
  font-size: .7rem;
  color: var(--text-dim);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: .5rem;
}
.sidebar-footer { padding: 1rem 1.4rem; border-top: 1px solid var(--border); margin-top: auto; }

.admin-chip { display: flex; align-items: center; gap: .7rem; }
.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  flex-shrink: 0;
}
.admin-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-name { font-size: .82rem; font-weight: 600; line-height: 1.2; }

/* ── Tab/page system (account.html) ─────────────────────────────── */
.account-main { min-width: 0; }
.page { display: none; padding: 2rem; width: 100%; max-width: 100%; }
.page.active { display: block; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; }
.page-sub { color: var(--text-mid); font-size: .9rem; margin-top: .3rem; }
.coming-soon { text-align: center; padding: 4rem 1rem; color: var(--text-mid); }
.coming-soon svg { width: 40px; height: 40px; color: var(--text-dim); margin-bottom: 1rem; }

/* ── Layout rules: hamburger vs docked sidebar ─────────────────────
   Below 901px (tablet/mobile): sidebar is always an overlay drawer,
   triggered by the hamburger, on every page.
   At 901px+ (laptop/desktop): sidebar is permanently docked on EVERY
   page while logged in -- no hamburger at all at this width. Targets
   the shared <main> (used by every page via base.html) for the
   margin-left shift, not just account.html's own content, so this is
   uniform across the whole site. Sidebar stays position:fixed
   throughout, so this never requires restructuring base.html's
   layout or making the sidebar and content share a flex parent. */
body.has-account-sidebar .account-hamburger { display: flex; }

@media (min-width: 901px) {
  body.has-account-sidebar .account-sidebar {
    transform: none;
  }
  body.has-account-sidebar .account-hamburger { display: none; }
  body.has-account-sidebar main {
    margin-left: 240px;
    /* Without this, main keeps width:100% while gaining a 240px
       margin, so its outer box is 240px wider than the viewport.
       body's `align-items: center` then centers that oversized box,
       splitting the 240px overflow ~evenly: half pushed left (behind
       the fixed sidebar) and half pushed past the right edge, clipped
       by body's overflow-x:hidden. Shrinking the width here keeps
       main's outer size exactly equal to the remaining space next to
       the sidebar -- the same effective content width the admin
       dashboard gets for free from its #main{flex:1} layout. */
    width: calc(100% - 240px);
  }
}
