:root {
  --background: #030303;
  --foreground: #f5f5f5;
  --primary: #f95454;
  --primary-foreground: #ffffff;
  --primary-hover: #de4040;
  --primary-glow: #ff8585;
  --gradient-primary: linear-gradient(135deg, #f95454 0%, #ff8585 100%);
  --shadow-glow: 0 0 30px rgba(249, 84, 84, 0.3), 0 0 60px rgba(249, 84, 84, 0.1);
  --shadow-glow-sm: 0 0 15px rgba(249, 84, 84, 0.25);
  --card-bg: #0a0a0a;
  --card-border: #1a1a1a;
  --text-muted: #a0a0a0;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --font-heading: "Space Grotesk", sans-serif;
  --font-body: "DM Sans", sans-serif;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(249, 84, 84, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(249, 84, 84, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(249, 84, 84, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

header, main, footer, .seo-print { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; margin: 0; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

.grad {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1rem; }

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(3, 3, 3, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav { display: flex; align-items: center; gap: 2rem; }
.nav a,
.nav .legal-link {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-muted);
  font-family: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}
.nav a:hover,
.nav .legal-link:hover { color: var(--foreground); }

.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5rem 1rem 3rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: 2rem;
  border: 1px solid rgba(249, 84, 84, 0.3);
  background: rgba(249, 84, 84, 0.08);
  color: var(--primary);
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 500;
}

.hero h1 {
  font-size: clamp(2.25rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 56rem;
}

.hero .sub {
  color: var(--text-muted);
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  max-width: 40rem;
  margin: 1.5rem 0 0;
  line-height: 1.7;
}

.hero-form { display: flex; align-items: stretch; width: 100%; max-width: 36rem; margin-top: 2.5rem; }

.input-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-right: none;
  border-radius: 14px 0 0 14px;
  padding: 0.875rem 1rem;
  transition: border-color 0.2s ease;
}

.hero-form:focus-within .input-shell { border-color: var(--primary); }

.input-ico {
  position: relative;
  width: 40px; height: 40px;
  flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(249, 84, 84, 0.08);
}

.input-ico svg { position: absolute; transition: opacity 0.3s ease, transform 0.3s ease; }
.hero-form .ico-link { opacity: 0; transform: scale(0.7); }
.hero-form.is-link .ico-search { opacity: 0; transform: scale(0.7); }
.hero-form.is-link .ico-link { opacity: 1; transform: scale(1); }

#q {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

#q::placeholder { color: #999; }

#submitBtn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 0 1.375rem;
  border: none;
  cursor: pointer;
  border-radius: 0 14px 14px 0;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-glow-sm);
  transition: opacity 0.2s ease, box-shadow 0.3s ease;
}

#submitBtn:hover { box-shadow: var(--shadow-glow); }
#submitBtn:disabled { opacity: 0.7; cursor: wait; }

.btn-icons { position: relative; width: 22px; height: 22px; }
.btn-icons svg { position: absolute; top: 0; left: 0; transition: opacity 0.3s ease, transform 0.3s ease; }
.hero-form:not(.is-link) .btn-icons .ico-link { opacity: 0; transform: scale(0.7); }
.hero-form.is-link .btn-icons .ico-search { opacity: 0; transform: scale(0.7); }

.form-error { color: #f87171; font-size: 0.875rem; margin: 0.6rem 0 0; text-align: left; }

.trust { color: var(--text-muted); font-size: 0.875rem; font-weight: 500; letter-spacing: 0.03em; margin-top: 2rem; }

.section { padding: 6rem 1rem; }
.section-narrow { max-width: 48rem; }

.section h2 {
  text-align: center;
  font-size: clamp(1.875rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 3.5rem;
}

.grid { display: grid; gap: 1.375rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.card:hover { border-color: rgba(249, 84, 84, 0.3); box-shadow: 0 0 20px rgba(249, 84, 84, 0.1); }
.card h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.75rem; }
.card p { color: var(--text-muted); font-size: 0.875rem; line-height: 1.7; margin: 0; }

.card-ico {
  width: 3.5rem; height: 3.5rem;
  margin: 0 auto 1.25rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 1rem;
  background: rgba(249, 84, 84, 0.1);
}

.card-step { position: relative; padding-top: 3.375rem; }

.step-number {
  position: absolute;
  top: -1.5rem; left: 50%;
  transform: translateX(-50%);
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: var(--primary-foreground);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow-sm);
}

.faq-list { display: flex; flex-direction: column; gap: 1rem; }

.faq-list details {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
}

.faq-list details[open] { border-color: rgba(249, 84, 84, 0.3); }

.faq-list summary {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
}

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

.faq-list summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--primary);
  transition: transform 0.3s ease;
}

.faq-list details[open] summary::after { content: "−"; }

.faq-answer { padding: 0 1.5rem 1.25rem; color: var(--text-muted); line-height: 1.7; font-size: 0.95rem; }

.site-footer { border-top: 1px solid var(--card-border); padding: 2.5rem 0; }

.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; text-align: center; }
.tg { color: var(--primary); display: flex; }
.tg:hover { opacity: 0.8; }
.disclaimer { color: #b0b0b0; font-size: 0.75rem; max-width: 40rem; margin: 0; line-height: 1.6; }

.seo-print {
  font-size: 0.6rem;
  color: #2a2a2a;
  opacity: 0.35;
  text-align: center;
  padding: 1.5rem 1rem;
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.6;
}

.seo-print h2 { font-size: 0.75rem; font-weight: 600; color: #b0b0b0; margin-bottom: 0.6rem; }
.seo-print p { margin: 0.3rem 0; }
.seo-tags { font-size: 0.55rem; }

.seo-hidden { display: none; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 3, 3, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayFadeIn 0.25s ease forwards;
}

@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalAnimIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modalSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

.modal {
  display: flex;
  flex-direction: column;
  max-width: 56rem;
  width: 100%;
  max-height: 90vh;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-glow);
  animation: modalAnimIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.modal-head-text { min-width: 0; }

.album-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.3;
  word-break: break-word;
}

.album-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.tag { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); }
.tag-images { color: var(--primary); }
.tag-videos { color: #a78bfa; }

.close-btn {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: 0.375rem;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover { border-color: var(--primary); color: var(--primary); }

.modal-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid rgba(26, 26, 26, 0.5);
}

.ghost-btn {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ghost-btn:hover { border-color: var(--primary); color: var(--primary); }
.selected-count { font-size: 0.75rem; color: var(--text-muted); }

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: #333; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: max-content;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  align-content: start;
}

.media-card {
  position: relative;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  background: #0a0a0a;
  transition: border-color 0.2s ease;
}

.media-card::before { content: ""; display: block; padding-top: 100%; }

.media-card:hover { border-color: rgba(249, 84, 84, 0.4); }
.media-card.selected { border-color: var(--primary); box-shadow: var(--shadow-glow-sm); }

.media-card img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.media-card:hover img { transform: scale(1.05); }
.media-card.thumb-fail img { display: none; }

.type-badge {
  position: absolute;
  top: 0.5rem; left: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  pointer-events: none;
  z-index: 2;
}

.type-badge svg { width: 24px; height: 24px; }

.card-info {
  position: absolute;
  bottom: 0.4rem; left: 0.4rem; right: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 2;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.18rem 0.42rem;
  border-radius: 0.28rem;
  font-family: var(--font-heading);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  background: rgba(3, 3, 3, 0.7);
  border: 1px solid rgba(249, 84, 84, 0.28);
  color: rgba(245, 245, 245, 0.75);
}

.pill:empty { display: none; }

.pill-duration { color: var(--primary-glow); }

.check {
  position: absolute;
  top: 0.35rem; right: 0.35rem;
  width: 24px; height: 24px;
  border-radius: 0.3rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(3, 3, 3, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}

.media-card.selected .check { border-color: var(--primary); background: var(--primary); }
.check svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; display: none; }
.media-card.selected .check svg { display: block; }

.progress-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 3, 3, 0.55);
  pointer-events: none;
}

.progress-text {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary-glow);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(249, 84, 84, 0.6), 0 1px 3px rgba(0, 0, 0, 0.85);
}

.progress-text.is-retry { font-size: 0.7rem; letter-spacing: 0.02em; }

.done-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  pointer-events: none;
  color: #4ade80;
}

.done-overlay svg { width: 32px; height: 32px; filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.5)); }
.media-card.downloaded { border-color: rgba(74, 222, 128, 0.4); }

.status-bar {
  padding: 0.6rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary);
  text-align: center;
  border-top: 1px solid rgba(249, 84, 84, 0.2);
  background: rgba(249, 84, 84, 0.06);
}

.modal-foot {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--card-border);
  background: rgba(10, 10, 10, 0.95);
}

.modal-foot-center { align-items: center; justify-content: center; }

.primary-btn, .secondary-btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

.primary-btn { background: var(--gradient-primary); color: var(--primary-foreground); box-shadow: var(--shadow-glow-sm); }
.primary-btn:hover:not(:disabled) { box-shadow: var(--shadow-glow); transform: translateY(-2px); }
.primary-btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.secondary-btn { background: transparent; color: var(--foreground); border: 1px solid var(--card-border); }
.secondary-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: rgba(249, 84, 84, 0.06); }
.secondary-btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.search-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: max-content;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  align-content: start;
}

.search-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-card:hover { border-color: rgba(249, 84, 84, 0.35); box-shadow: 0 0 20px rgba(249, 84, 84, 0.1); }

.search-card-thumb { position: relative; background: #0a0a0a; }
.search-card-thumb::before { content: ""; display: block; padding-top: 100%; }
.search-card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.search-card-body { padding: 0.6rem 0.75rem 0.75rem; }

.search-card-title {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-card-user {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-card-counts { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; }

.empty-note { grid-column: 1 / -1; padding: 4rem 2rem; text-align: center; color: var(--text-muted); font-size: 1.05rem; }

.overlay-loading { background: rgba(3, 3, 3, 0.92); }
.loading-box { text-align: center; color: var(--text-muted); font-size: 0.95rem; }

.spinner {
  display: block;
  width: 18px; height: 18px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 40px; height: 40px;
  border-width: 3px;
  border-color: rgba(249, 84, 84, 0.25);
  border-top-color: var(--primary);
  margin-bottom: 1rem;
}

body.modal-open { overflow: hidden; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .media-grid, .search-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1520px) and (min-height: 780px) {
  .ad-rail .ad-slot.ad-slot--extra { display: block; }
}

@media (max-width: 768px) {
  .section { padding: 4rem 1rem; }

  .overlay { padding: 0; align-items: flex-end; }

  .modal {
    max-width: 100%;
    max-height: 92vh;
    height: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    animation: modalSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .modal-head { padding: 1rem; }
  .album-title { font-size: 1.05rem; }
  .album-meta { font-size: 0.72rem; gap: 0.4rem; }
  .tag { font-size: 0.68rem; }
  .modal-bar { padding: 0.4rem 1rem; }
  .ghost-btn { font-size: 0.7rem; padding: 0.3rem 0.6rem; }
  .media-grid, .search-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; padding: 0.75rem 1rem; }

  .search-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .type-badge { top: 0.35rem; left: 0.35rem; }
  .type-badge svg { width: 20px; height: 20px; }
  .card-info { bottom: 0.3rem; left: 0.3rem; right: 0.3rem; gap: 0.25rem; }
  .pill { font-size: 0.54rem; padding: 0.14rem 0.36rem; letter-spacing: 0.03em; }
  .modal-foot { padding: 0.75rem 1rem; }
  .status-bar { padding: 0.5rem 1rem; font-size: 0.7rem; }
}

@media (max-width: 640px) {
  .nav a:not(.api-link) { display: none; }
  .nav .api-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.5rem; }
  .nav .legal-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.5rem; margin-right: -0.5rem; }
  .grid-4 { grid-template-columns: 1fr; }

  .hero-form { flex-direction: column; }

  .input-shell {
    border-right: 1px solid #1e1e1e;
    border-radius: 14px;
  }

  #submitBtn { border-radius: 14px; padding: 0.875rem; margin-top: 0.5rem; }

  .modal-foot { flex-direction: column; }
  .media-grid, .search-grid { grid-template-columns: repeat(2, 1fr); }
}

.modal-legal {
  max-width: 720px;
  max-height: 90vh;
}

.legal-body {
  padding: 1.5rem;
  max-height: 65vh;
  overflow-y: auto;
}

.legal-section {
  margin-bottom: 2.5rem;
}

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

.legal-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--foreground);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--card-border);
}

.legal-intro {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.legal-section section {
  margin-top: 1rem;
}

.legal-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-glow);
  margin-bottom: 0.4rem;
}

.legal-section p {
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

@media (max-width: 768px) {
  .modal-legal {
    max-height: 95vh;
  }
  .legal-body {
    padding: 1rem;
    max-height: 70vh;
  }
  .legal-section h3 { font-size: 1rem; }
  .legal-intro { font-size: 0.8rem; }
  .legal-section h4 { font-size: 0.8rem; }
  .legal-section p { font-size: 0.75rem; }
}

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

.ad-slot--hero { margin: 1.75rem auto 0; }
.ad-slot--mid { margin: 0 auto; padding: 2.5rem 1rem 0; min-height: 250px; }
.ad-slot--wide { margin: 0 auto; padding: 2.5rem 1rem 0; min-height: 60px; }
.ad-slot--native { max-width: 72rem; margin: 0 auto; padding: 0 1rem 3.5rem; }
.ad-slot iframe { display: block; border: 0; }

.ad-sponsored-label {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #4d4d4d;
  margin-bottom: 0.5rem;
}

.ad-smartlink {
  margin-top: 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: #4d4d4d;
  text-decoration: none;
  border-bottom: 1px dashed #333;
}
.ad-smartlink:hover { color: var(--primary-glow); border-color: var(--primary); }

.ad-rail { display: none; }
@media (min-width: 1520px) {
  .ad-rail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: fixed;
    top: 6rem;
    z-index: 9;
  }
  .ad-rail--left { left: 1rem; }
  .ad-rail--right { right: 1rem; }
  .ad-rail .ad-slot { width: 160px; }
  .ad-rail .ad-slot--extra { display: none; }
}

@media (max-width: 768px) {
  .modal { max-height: 88vh; max-height: 88dvh; }
  .overlay { padding: 0; padding-bottom: env(safe-area-inset-bottom, 0px); align-items: flex-end; }
  .modal-head { padding: 0.75rem 1rem 0.9rem; }
  .close-btn { width: 44px; height: 44px; font-size: 1.05rem; border-radius: 0.5rem; }
  .modal-bar { padding: 0.5rem 1rem; gap: 0.5rem; }
  .ghost-btn { min-height: 40px; display: inline-flex; align-items: center; padding: 0.45rem 0.9rem; }
  .modal-foot { padding: 0.7rem 1rem; padding-bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px)); gap: 0.5rem; }
  .primary-btn, .secondary-btn { min-height: 48px; padding: 0.7rem 1rem; }
  .status-bar { padding: 0.5rem 1rem; padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); }
  .check { width: 28px; height: 28px; }
  .check svg { width: 16px; height: 16px; }
  .pill { font-size: 0.68rem; padding: 0.2rem 0.45rem; }
  .search-card-body { min-width: 0; }
  .search-card-title, .search-card-user { overflow: hidden; text-overflow: ellipsis; }
  .modal-foot-center { flex-direction: row; align-items: center; }
  .modal-foot-center > .selected-count { flex: 0 0 auto; }
}

@media (max-width: 640px) {
  .modal-foot-center { flex-direction: row; }
}

@media (max-width: 1000px) and (max-height: 500px) {
  .modal { max-height: 94vh; max-height: 94dvh; }
  .modal-head { padding: 0.6rem 1rem; }
  .modal-bar { padding: 0.35rem 1rem; }
  .modal-foot { flex-direction: row; padding: 0.5rem 1rem; padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); }
  .primary-btn, .secondary-btn { min-height: 44px; }
}


#mediaGrid.erd-batch .media-card { cursor: progress; }
#mediaGrid.erd-batch .media-card .check { opacity: 0.3; }
#mediaGrid.erd-batch .media-card:hover img { transform: none; }
#mediaGrid.erd-batch .media-card:hover { border-color: var(--card-border); }

#mediaGrid .media-card.erd-dl {
  border-color: rgba(249, 84, 84, 0.65);
  animation: erd-dl-pulse 1.1s ease-in-out infinite;
}

@keyframes erd-dl-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 84, 84, 0.35); }
  50%      { box-shadow: 0 0 0 3px rgba(249, 84, 84, 0.16); }
}

#mediaGrid .media-card.erd-fail { border-color: rgba(248, 113, 113, 0.5); }

@media (prefers-reduced-motion: reduce) {
  #mediaGrid .media-card.erd-dl { animation: none; }
}

/* ---------- SEO/content additions ---------- */
.album-title { font-family: var(--font-heading); }
.section-lead { margin: .55rem 0 0; color: var(--text-muted); font-size: .9rem; max-width: 46rem; line-height: 1.65; }
.guides-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 1.6rem; }
.guide-card { display: block; padding: 1.15rem 1.25rem; border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card-bg); transition: border-color .2s ease, transform .2s ease; }
.guide-card:hover { border-color: rgba(249, 84, 84, .45); transform: translateY(-2px); }
.guide-card h3 { font-size: 1rem; margin: 0 0 .4rem; }
.guide-card p { margin: 0; font-size: .82rem; color: var(--text-muted); line-height: 1.55; }
.shots-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.6rem; }
@media (min-width: 820px) { .shots-grid { grid-template-columns: 1.45fr 1fr; } }
.shots-grid figure { margin: 0; border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; background: var(--card-bg); }
.shots-grid img { display: block; width: 100%; height: auto; }
.shots-grid figcaption { padding: .7rem .95rem; font-size: .76rem; color: var(--text-muted); }
.seo-print { font-size: .82rem; color: var(--text-muted); opacity: 1; line-height: 1.7; }
.seo-print h2 { font-size: 1.05rem; color: var(--foreground); letter-spacing: 0; }
.seo-langs { font-size: .8rem; }
.seo-langs a { color: var(--primary); }
.ad-slot--hero, .ad-slot--wide { min-height: 100px; }
.ad-slot--mid { min-height: 250px; }

/* ---------- content pages ---------- */
.hero-cta { margin-top: 2rem; }
.hero-cta .primary-btn { display: inline-block; text-decoration: none; }
.section-narrow p { color: var(--text-muted); font-size: .95rem; line-height: 1.78; margin: .85rem 0 0; }
.section-narrow h2 { font-size: 1.3rem; margin: 2.4rem 0 0; }
.section-narrow > h2:first-child { margin-top: 0; }
.section-narrow p a, .page-list a { color: var(--primary); }
.page-list { margin: 1rem 0 0 1.15rem; color: var(--text-muted); font-size: .93rem; line-height: 1.75; }
.page-list li { margin: .35rem 0; }
.section-narrow code { background: #141414; border: 1px solid var(--card-border); border-radius: .35rem;
  padding: .08rem .35rem; font-size: .85em; color: #e9c5c5; }
.section > .section-lead { text-align: center; margin-left: auto; margin-right: auto; }
.shots-grid img { display: block; width: 100%; height: 420px; object-fit: cover; object-position: top center; }
@media (max-width: 819px) { .shots-grid img { height: 280px; } }

.hero--page { min-height: auto; padding: 6.5rem 1.15rem 2.6rem; }
.hero--page h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
.hero--page .sub { max-width: 42rem; margin-left: auto; margin-right: auto; }
@media (max-width: 640px) { .hero--page { padding-top: 5rem; } }

/* download controller (dl-v1) */
.erd-status { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex: 1; font-size: .82rem; color: var(--primary); font-weight: 500; }
.erd-status-text { min-width: 0; }
.erd-cancel { flex: none; border: 1px solid var(--card-border); background: transparent; color: var(--text-muted); border-radius: 999px; padding: .35rem .9rem; font-size: .75rem; }
.erd-cancel:hover { border-color: var(--primary); color: var(--foreground); }
#mediaGrid.erd-locked { pointer-events: none; }
#mediaGrid.erd-locked .media-card { opacity: .5; }
#mediaGrid.erd-locked .media-card.downloaded { opacity: .85; }
#downloadSelectedBtn.erd-idle { opacity: .5; }
#downloadSelectedBtn.erd-idle:hover { opacity: .7; }

/* iOS: input com menos de 16px provoca zoom ao focar */
#q, .input-shell input { font-size: 16px; touch-action: manipulation; }
@media (min-width: 760px) { #q, .input-shell input { font-size: 0.95rem; } }
.status-bar { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap; }
.status-bar .erd-cancel { margin: 0; }

.ad-anchor {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
  background: rgba(8, 8, 10, 0.94);
  border-top: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ad-anchor[hidden] { display: none !important; }
.ad-anchor__host { line-height: 0; overflow: hidden; }
.ad-anchor__close {
  position: absolute;
  right: 8px; top: -30px;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(8, 8, 10, 0.94);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font: 600 15px/1 system-ui, sans-serif;
  cursor: pointer;
}
.ad-anchor__close:hover { color: var(--foreground); }
body.ad-anchor-on { padding-bottom: 64px; }
.ad-slot--album { flex: 0 0 auto; min-height: 50px; margin: 0 1rem 0.7rem; }
.ad-slot--album[hidden] { display: none !important; }
.ad-slot__host { line-height: 0; }
.ad-slot__host iframe { display: block; border: 0; margin: 0 auto; }
@media (min-width: 768px) {
  .ad-slot--album { min-height: 90px; margin: 0 1.5rem 0.85rem; }
  body.ad-anchor-on { padding-bottom: 104px; }
}
@media (max-height: 520px) { .ad-slot--album { display: none; } }

.ad-card {
  position: relative;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0a0a0a;
}
.ad-card::before { content: ""; display: block; padding-top: 100%; }
.ad-card iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: 0;
  display: block;
}
.ad-card .type-badge {
  top: auto;
  left: 0.5rem;
  bottom: 0.5rem;
  opacity: 0.4;
  color: #f95454;
}

.search-ad { cursor: default; }
.search-ad .search-card-thumb iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: 0;
  display: block;
}

.erd-thanks {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(3, 3, 3, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: erdThanksIn 0.25s ease;
}
.erd-thanks__box {
  max-width: 26rem;
  width: 100%;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-glow);
}
.erd-thanks__icon {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(249, 84, 84, 0.12);
  color: #f95454;
}
.erd-thanks__icon svg { width: 28px; height: 28px; }
.erd-thanks__title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  color: var(--foreground);
}
.erd-thanks__text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}
.erd-thanks__bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.erd-thanks__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f95454, #fe6868);
}
@keyframes erdThanksIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 640px) {
  .erd-thanks__box { padding: 1.6rem 1.15rem; }
  .erd-thanks__title { font-size: 1.15rem; }
}

.xh-quality { height: 32px; border-radius: 8px; border: 1px solid var(--card-border);
  background: #0f0f0f; color: var(--foreground); padding: 0 10px; font-size: 13px;
  font-weight: 600; margin-right: 10px; margin-left: 0; cursor: pointer; }
.xh-quality:focus { outline: none; border-color: var(--primary); }
