:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --text: #1e2433;
  --muted: #5d677d;
  --coral: #ff5e7e;
  --coral-dark: #e64566;
  --cyan: #00b4d8;
  --yellow: #ffd166;
  --green: #10b981;
  --border: #e6ebf5;
  --shadow: 0 10px 25px rgba(30, 36, 51, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, .logo {
  font-family: 'Fredoka', 'Nunito', sans-serif;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header / Hero */
.hero {
  background: linear-gradient(135deg, #fff5f7 0%, #eef8ff 55%, #fffbeb 100%);
  border-bottom: 2px solid var(--border);
  padding: 24px 0 28px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
}

.logo-badge {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--coral), #ff8fa3);
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(255, 94, 126, 0.3);
}

.safety-pill {
  background: #e6f9f1;
  color: #047857;
  border: 1.5px solid #a7f3d0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
}

.hero h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  margin-bottom: 10px;
}

.highlight {
  color: var(--coral);
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
  max-width: 650px;
  margin-bottom: 20px;
}

/* Controls */
.controls-box {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.type-switch {
  display: inline-flex;
  background: var(--surface);
  padding: 5px;
  border-radius: 14px;
  border: 2px solid var(--border);
  gap: 4px;
}

.switch-btn {
  border: none;
  background: transparent;
  padding: 9px 18px;
  border-radius: 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.switch-btn.active {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 94, 126, 0.28);
}

.search-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 1rem;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 12px 40px 12px 42px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#searchInput:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.14);
}

.clear-btn {
  position: absolute;
  right: 10px;
  border: none;
  background: #edf2f7;
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 800;
}

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.pill {
  white-space: nowrap;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pill:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.pill.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 28px 20px 48px;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-select {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--cyan);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.load-more-btn {
  border: none;
  background: var(--coral);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 94, 126, 0.28);
  transition: transform 0.15s ease, background 0.15s ease;
}

.load-more-btn:hover {
  background: var(--coral-dark);
  transform: translateY(-2px);
}

.load-more-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status-bar h2 {
  font-size: 1.4rem;
}

.results-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.card-cover-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #e9eef7;
  overflow: hidden;
}

.card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge-top-left {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(16, 185, 129, 0.94);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.badge-age {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(30, 36, 51, 0.85);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
}

.card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Skeleton */
.skeleton {
  height: 320px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #eef2f9 25%, #f7f9fd 50%, #eef2f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

.hidden {
  display: none !important;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 26, 40, 0.65);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-width: 740px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 24px;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #edf2f7;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.modal-header {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
}

.modal-poster {
  width: 130px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.modal-info h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  padding-right: 28px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag {
  background: #eef4ff;
  color: #2b4c7e;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.modal-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.free-box {
  background: #ecfdf5;
  border: 1.5px solid #a7f3d0;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.free-box h4 {
  color: #065f46;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.free-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-free {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 8px 14px;
  border-radius: 10px;
}

.buy-box {
  background: #f0f7ff;
  border: 1.5px solid #bae6fd;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.buy-box h4 {
  color: #0369a1;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.btn-channel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: var(--text);
  border: 1.5px solid #cbd5e1;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.btn-channel:hover {
  border-color: var(--cyan);
  color: #0369a1;
  transform: translateY(-1px);
}

.trailer-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.trailer-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.footer {
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  padding: 18px 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.badge-top-left.badge-ita {
  background: rgba(0, 180, 216, 0.94);
}

.footer-links {
  margin-top: 8px;
}

.footer-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.footer-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

@media (max-width: 600px) {
  .modal-header {
    flex-direction: column;
  }
  .modal-poster {
    width: 110px;
  }
}
