@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

:root {
  --bg:       #0f0f0f;
  --bg2:      #161616;
  --bg3:      #1f1f1f;
  --bg4:      #272727;
  --accent:   #7c3aed;
  --accent2:  #a78bfa;
  --accent3:  #6d28d9;
  --red:      #ef4444;
  --text:     #f0f0f0;
  --text2:    #888888;
  --text3:    #444444;
  --border:   rgba(255,255,255,0.06);
  --border2:  rgba(255,255,255,0.1);
  --bottom-nav: 64px;
  --glow: 0 0 40px rgba(124,58,237,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--bottom-nav) + 20px);
}

a { text-decoration: none; color: inherit; }
img { display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
::-webkit-scrollbar { display: none; }

/* ── TOP NAV ── */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  background: rgba(12,10,14,0.88);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.topnav-logo {
  font-family: 'Outfit', sans-serif; font-size: 21px;
  font-weight: 800; letter-spacing: -0.5px; cursor: pointer; color: var(--text);
}
.topnav-logo span { color: var(--accent2); }
.topnav-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0; background: var(--bg3);
  border: 1px solid var(--border); color: var(--text2); transition: all 0.15s;
}
.icon-btn:active { background: var(--bg4); color: var(--text); }

/* ── HERO SLIDER ── */
.hero-slider {
  position: relative; overflow: hidden; margin-bottom: 24px;
  min-height: calc(100vw * 9 / 16); max-height: 270px;
}
.hero-slides { display: flex; transition: transform 0.45s cubic-bezier(0.4,0,0.2,1); }
.hero-slide { flex-shrink: 0; width: 100%; aspect-ratio: 16/9; position: relative; cursor: pointer; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    rgba(12,10,14,1) 0%,
    rgba(12,10,14,0.6) 40%,
    rgba(12,10,14,0.1) 70%,
    transparent 100%
  );
}
.hero-slide-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 20px 18px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent); color: white;
  font-family: 'Outfit', sans-serif; font-size: 9px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; padding: 3px 8px;
  border-radius: 0; margin-bottom: 8px;
}
.hero-title { font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 800; line-height: 1.25; letter-spacing: -0.3px; }
.hero-ep { font-size: 12px; color: var(--text2); margin-top: 4px; font-weight: 400; }
.hero-dots {
  position: absolute; top: 12px; right: 14px;
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.55); backdrop-filter: blur(8px);
  padding: 3px 9px; border-radius: 0; letter-spacing: 0.5px; font-family: 'Outfit', sans-serif;
}
.hero-dot-nav { position: absolute; bottom: 62px; left: 18px; display: flex; gap: 5px; }
.hero-dot { width: 16px; height: 2px; background: rgba(255,255,255,0.25); cursor: pointer; transition: all 0.25s; }
.hero-dot.active { background: var(--accent2); width: 28px; }

/* ── ANNOUNCEMENT ── */
.announcement {
  margin: 0 18px 16px;
  background: rgba(124,58,237,0.08); border: 1px solid rgba(124,58,237,0.2);
  border-radius: 0; border-left: 3px solid var(--accent);
  padding: 10px 14px; display: flex; align-items: flex-start; gap: 10px;
}
.announcement-icon { flex-shrink: 0; color: var(--accent2); margin-top: 1px; }
.announcement-body { flex: 1; }
.announcement-title { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 12px; color: var(--text); margin-bottom: 2px; }
.announcement-text { font-size: 11px; color: var(--text2); line-height: 1.5; }
.announcement-close { flex-shrink: 0; color: var(--text3); font-size: 18px; line-height: 1; }

/* ── SEARCH BAR ── */
.search-wrap { padding: 0 0 4px; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-bottom: 1px solid var(--border2); border-radius: 0;
  padding: 12px 16px; margin: 0 18px 18px;
  transition: border-color 0.2s, background 0.2s;
}
.search-bar:focus-within { border-color: var(--accent2); background: var(--bg3); }
.search-bar svg { color: var(--text3); flex-shrink: 0; }
.search-bar input { flex: 1; background: none; border: none; outline: none; font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text); }
.search-bar input::placeholder { color: var(--text3); }

/* ── SECTION ── */
.section { margin-bottom: 10px; }
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 0 18px 14px; }
.section-title {
  font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 800;
  letter-spacing: -0.2px; display: flex; align-items: center; gap: 10px; text-transform: uppercase;
}
.section-title::before { content: ''; width: 3px; height: 16px; background: var(--accent2); border-radius: 0; }
.section-more, .section-link {
  font-size: 11px; font-weight: 600; color: var(--text3);
  letter-spacing: 0.5px; text-transform: uppercase;
  font-family: 'Outfit', sans-serif; transition: color 0.15s;
}
.section-more:active, .section-link:active { color: var(--accent2); }

/* ── FILTER CHIPS ── */
.filter-chips, .chips-wrap {
  display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none; padding: 0 18px 16px;
}
.chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: 0;
  font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text3); background: var(--bg2); border: 1px solid var(--border); transition: all 0.15s;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: white; }
.chip:active { background: var(--bg4); }

/* ── ANIME GRID ── */
.anime-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 18px; }

/* ── ANIME CARD ── */
.anime-card {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--bg2); animation: fadeUp 0.4s ease both;
  border-radius: 0; -webkit-tap-highlight-color: transparent;
}
.anime-card:nth-child(1)  { animation-delay: 0.00s; }
.anime-card:nth-child(2)  { animation-delay: 0.04s; }
.anime-card:nth-child(3)  { animation-delay: 0.08s; }
.anime-card:nth-child(4)  { animation-delay: 0.12s; }
.anime-card:nth-child(5)  { animation-delay: 0.16s; }
.anime-card:nth-child(6)  { animation-delay: 0.20s; }
.anime-card:nth-child(7)  { animation-delay: 0.24s; }
.anime-card:nth-child(8)  { animation-delay: 0.28s; }
.anime-card:nth-child(9)  { animation-delay: 0.32s; }
.anime-card:nth-child(10) { animation-delay: 0.36s; }
.anime-card:nth-child(11) { animation-delay: 0.40s; }
.anime-card:nth-child(12) { animation-delay: 0.44s; }
.anime-card-poster { position: relative; aspect-ratio: 2/3; overflow: hidden; }
.anime-card-poster img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.35s ease; filter: brightness(0.88);
}
.anime-card:active .anime-card-poster img { transform: scale(1.05); filter: brightness(1); }
.anime-card-poster-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    rgba(12,10,14,1) 0%,
    rgba(12,10,14,0.55) 38%,
    transparent 62%
  );
}
.anime-card-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 7px 7px 8px; }
.anime-card-title {
  font-family: 'Outfit', sans-serif; font-size: 10.5px; font-weight: 700;
  line-height: 1.3; color: #fff;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; letter-spacing: -0.1px; text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.anime-card-ep {
  font-size: 9.5px; color: var(--accent2); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600; font-family: 'Outfit', sans-serif;
}
.anime-card-meta {
  font-size: 9px; color: rgba(255,255,255,0.35); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400;
}
.anime-card-badge {
  position: absolute; top: 0; left: 0;
  font-family: 'Outfit', sans-serif; font-size: 7.5px; font-weight: 800;
  padding: 3px 6px; color: white; letter-spacing: 0.8px;
  text-transform: uppercase; border-radius: 0; line-height: 1;
}
.badge-tv          { background: var(--accent); }
.badge-movie       { background: #b45309; }
.badge-special     { background: #047857; }
.badge-live-action { background: #0369a1; }
.badge-ova         { background: #6d28d9; }
.status-dot {
  position: absolute; top: 7px; right: 7px;
  width: 6px; height: 6px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.4);
}
.status-dot.ongoing   { background: #22c55e; box-shadow: 0 0 5px #22c55e; }
.status-dot.completed { background: #444; }

/* ── LOAD MORE ── */
.load-more-wrap { padding: 18px; }
.load-more-btn, .btn-load-more {
  width: 100%; padding: 13px; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: 0;
  font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text2);
  cursor: pointer; transition: all 0.15s;
}
.load-more-btn:active, .btn-load-more:active { background: var(--bg3); color: var(--text); }

/* ── SKELETON ── */
.skeleton-card { overflow: hidden; background: var(--bg2); }
.skeleton-poster { aspect-ratio: 2/3; background: var(--bg3); animation: pulse 1.6s ease-in-out infinite; }
.skeleton-line { height: 9px; margin: 8px 8px 4px; background: var(--bg3); border-radius: 0; animation: pulse 1.6s ease-in-out infinite; }
.skeleton-line.short { width: 55%; margin-bottom: 8px; }

/* ── EMPTY STATE ── */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 64px 24px; text-align: center; gap: 12px; color: var(--text3); }
.empty-state h3 { font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 700; color: var(--text2); }
.empty-state p { font-size: 13px; line-height: 1.6; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: var(--bottom-nav);
  background: rgba(12,10,14,0.94);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border2);
  display: flex; align-items: stretch; z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; color: var(--text3);
  cursor: pointer; transition: color 0.2s; padding: 8px 0;
  -webkit-tap-highlight-color: transparent; position: relative;
}
.nav-item::after {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%;
  height: 1px; background: transparent; transition: background 0.2s;
}
.nav-item.active::after { background: var(--accent2); }
.nav-item svg { width: 20px; height: 20px; stroke-width: 1.8; }
.nav-item span { font-family: 'Outfit', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.nav-item.active { color: var(--accent2); }
.nav-item.active svg { stroke: var(--accent2); }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: calc(var(--bottom-nav) + 14px); left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg4); color: var(--text); border: 1px solid var(--border2);
  padding: 10px 20px; border-radius: 0;
  font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1); z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg:      #f8f8ff;
  --bg2:     #efefff;
  --bg3:     #e4e4f0;
  --bg4:     #d8d8ee;
  --accent:  #7c3aed;
  --accent2: #a78bfa;
  --accent3: #6d28d9;
  --text:    #1a1a2e;
  --text2:   #4a4a6a;
  --text3:   #9090b0;
  --border:  rgba(124,58,237,0.08);
  --border2: rgba(124,58,237,0.14);
  --glow: 0 0 40px rgba(124,58,237,0.12);
}
[data-theme="light"] .topnav { background: rgba(248,248,255,0.88); }
[data-theme="light"] .bottom-nav { background: rgba(248,248,255,0.92); }
[data-theme="light"] .hero-slide-overlay {
  background: linear-gradient(to top, rgba(248,248,255,1) 0%, rgba(248,248,255,0.6) 40%, rgba(248,248,255,0.1) 70%, transparent 100%);
}
[data-theme="light"] .anime-card-poster-overlay {
  background: linear-gradient(to top, rgba(248,248,255,1) 0%, rgba(248,248,255,0.55) 38%, transparent 62%);
}
[data-theme="light"] .anime-card-title { color: #1a1a2e; text-shadow: none; }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
@keyframes spin { to { transform: rotate(360deg); } }
