/* Anime HD Zero v2 — Design tokens + base */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&family=DM+Serif+Display:ital@0;1&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&display=swap');

:root {
  /* Light mode (default, pastel-cream) */
  --bg: 40 33% 97%;           /* cream */
  --bg-elev: 0 0% 100%;
  --bg-soft: 30 30% 94%;
  --fg: 340 25% 12%;          /* deep plum-black */
  --fg-muted: 340 12% 40%;
  --fg-faint: 340 8% 60%;
  --border: 340 15% 88%;
  --border-strong: 340 15% 78%;
  --accent: 350 80% 68%;      /* pastel rose */
  --accent-fg: 0 0% 100%;
  --accent-soft: 350 80% 94%;
  --chip: 40 33% 92%;

  --radius: 18px;
  --radius-sm: 10px;

  --font-display: 'Instrument Serif', 'DM Serif Display', serif;
  --font-ui: 'Geist', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;

  --density-row: 180px;
  --density-gap: 14px;
}
[data-theme='dark'] {
  --bg: 0 0% 4%;
  --bg-elev: 0 0% 8%;
  --bg-soft: 0 0% 11%;
  --fg: 0 0% 98%;
  --fg-muted: 0 0% 68%;
  --fg-faint: 0 0% 48%;
  --border: 0 0% 16%;
  --border-strong: 0 0% 26%;
  --accent-soft: 350 50% 18%;
  --chip: 0 0% 10%;
}
[data-type='alt'] {
  --font-display: 'Fraunces', serif;
  --font-ui: 'Plus Jakarta Sans', system-ui, sans-serif;
}
[data-density='compact'] {
  --density-row: 150px;
  --density-gap: 10px;
}

html, body { background: hsl(var(--bg)); color: hsl(var(--fg)); font-family: var(--font-ui); }
body { font-feature-settings: 'ss01', 'cv11'; }
.font-display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
.font-mono { font-family: var(--font-mono); }

/* scrollbar */
.hide-scroll { scrollbar-width: none; }
.hide-scroll::-webkit-scrollbar { display: none; }
.thin-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.thin-scroll::-webkit-scrollbar-thumb { background: hsl(var(--border-strong)); border-radius: 10px; }
.thin-scroll::-webkit-scrollbar-track { background: transparent; }

/* Reusable chip */
.chip { background: hsl(var(--chip)); border: 1px solid hsl(var(--border)); color: hsl(var(--fg-muted)); padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.chip-accent { background: hsl(var(--accent) / 0.12); color: hsl(var(--accent)); border: 1px solid hsl(var(--accent) / 0.3); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; font-weight: 500; transition: transform .2s, background .2s; }
.btn-primary { background: hsl(var(--accent)); color: hsl(var(--accent-fg)); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: hsl(var(--bg-elev)); color: hsl(var(--fg)); border: 1px solid hsl(var(--border)); }
.btn-ghost:hover { background: hsl(var(--bg-soft)); }

/* Title card */
.poster-card { position: relative; border-radius: var(--radius); overflow: hidden; background: hsl(var(--bg-soft)); aspect-ratio: 2 / 3; }
.poster-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.poster-card:hover img { transform: scale(1.06); }
.land-card { position: relative; border-radius: var(--radius); overflow: hidden; background: hsl(var(--bg-soft)); aspect-ratio: 16 / 9; }
.land-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.land-card:hover img { transform: scale(1.06); }

/* Gradient overlays */
.grad-bot { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.85)); pointer-events: none; }
.grad-hero { position: absolute; inset: 0; background:
  linear-gradient(90deg, hsl(var(--bg)) 0%, hsl(var(--bg) / 0.2) 50%, hsl(var(--bg) / 0.6) 100%),
  linear-gradient(180deg, hsl(var(--bg) / 0.1) 0%, hsl(var(--bg)) 100%);
  pointer-events: none;
}

/* Blobs (decorative) */
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; pointer-events: none; }

/* Marquee */
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee-track { animation: marquee 40s linear infinite; }

/* Grain */
.grain::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* tilt hover for hero poster */
.tilt { transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2,.7,.2,1); }

/* Player scrubber */
.scrubber { height: 4px; background: rgba(255,255,255,.18); border-radius: 999px; overflow: hidden; }
.scrubber > div { height: 100%; background: hsl(var(--accent)); border-radius: 999px; }

/* star */
.star-svg { width: 14px; height: 14px; display: inline-block; }

/* page fade wrapper */
.page-fade { opacity: 0; transform: translateY(12px); }

/* Hover glow halo */
.halo { position: absolute; inset: -30%; background: radial-gradient(circle at center, hsl(var(--accent) / 0.45), transparent 55%); filter: blur(40px); opacity: 0; transition: opacity .4s; pointer-events: none; }
.poster-card:hover .halo { opacity: 1; }

/* underline grow */
.u-grow { background-image: linear-gradient(hsl(var(--accent)),hsl(var(--accent))); background-size: 0% 2px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .3s; }
.u-grow:hover { background-size: 100% 2px; }

/* hero pager dot */
.pager-dot { width: 28px; height: 4px; background: hsl(var(--fg) / 0.15); border-radius: 999px; transition: background .3s, width .3s; cursor: pointer; }
.pager-dot.active { width: 56px; background: hsl(var(--accent)); }

/* Tabs */
.tab { padding: 10px 0; position: relative; color: hsl(var(--fg-muted)); font-weight: 500; }
.tab.active { color: hsl(var(--fg)); }
.tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: hsl(var(--accent)); border-radius: 2px; }

/* Genre tile glow */
.genre-tile { position: relative; overflow: hidden; border-radius: var(--radius); padding: 20px; border: 1px solid hsl(var(--border)); background: hsl(var(--bg-elev)); transition: transform .3s, border-color .3s; }
.genre-tile:hover { transform: translateY(-4px); border-color: hsl(var(--accent) / 0.4); }
.genre-tile::before {
  content: ''; position: absolute; inset: -40%; border-radius: 50%; opacity: 0; transition: opacity .4s;
  background: radial-gradient(circle at 50% 50%, hsl(var(--hue) 70% 70% / 0.4), transparent 60%);
  filter: blur(20px);
}
.genre-tile:hover::before { opacity: 1; }

/* Progress ring */
.ring-bg { stroke: hsl(var(--border)); fill: none; }
.ring-fg { stroke: hsl(var(--accent)); fill: none; stroke-linecap: round; transition: stroke-dashoffset 1s; }

/* Watchlist heart */
.heart { transition: transform .2s; }
.heart:active { transform: scale(.85); }

/* Key-focus */
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: 2px; border-radius: 8px; }

/* reveal */
.reveal { opacity: 0; transform: translateY(20px); }

/* skeleton shimmer */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.shimmer { background: linear-gradient(90deg, hsl(var(--bg-soft)) 0%, hsl(var(--bg-elev)) 50%, hsl(var(--bg-soft)) 100%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }

/* Soft glass */
.glass { background: hsl(var(--bg-elev) / 0.7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid hsl(var(--border)); }

/* Tweaks panel */
.tweak-panel { position: fixed; right: 20px; bottom: 20px; z-index: 120; width: 320px; border-radius: 20px; padding: 18px; }
.tweak-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed hsl(var(--border)); }
.tweak-row:last-child { border-bottom: 0; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid hsl(var(--bg-elev)); box-shadow: 0 0 0 1px hsl(var(--border)); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px hsl(var(--fg)); }
.seg { display: inline-flex; background: hsl(var(--bg-soft)); border-radius: 999px; padding: 3px; }
.seg button { padding: 6px 12px; border-radius: 999px; font-size: 12px; color: hsl(var(--fg-muted)); }
.seg button.on { background: hsl(var(--bg-elev)); color: hsl(var(--fg)); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

/* Star rating text */
.rating-pill { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 999px; background: hsl(var(--fg) / 0.08); color: hsl(var(--fg)); font-size: 12px; }

/* Episode list hover accent bar */
.ep-row { transition: background .2s; }
.ep-row:hover { background: hsl(var(--accent) / 0.07); }

/* Sticker labels (angled) */
.sticker { position: absolute; top: 10px; left: 10px; background: hsl(var(--accent)); color: hsl(var(--accent-fg)); padding: 3px 8px; border-radius: 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; transform: rotate(-4deg); box-shadow: 0 4px 10px hsl(var(--accent) / 0.4); }

/* editorial card */
.ed-card { position: relative; border-radius: var(--radius); overflow: hidden; background: hsl(var(--bg-elev)); border: 1px solid hsl(var(--border)); transition: transform .3s; }
.ed-card:hover { transform: translateY(-4px); }

/* Soft divider */
.hr-soft { border: 0; border-top: 1px solid hsl(var(--border)); }

/* Shape decorations */
.dot-pattern {
  background-image: radial-gradient(hsl(var(--fg) / 0.12) 1px, transparent 1px);
  background-size: 16px 16px;
}
