/* FirasMovies — shared styles. Minimal, dark, professional. */
:root {
  --bg: #0a0a0f;
  --bg-soft: #12121a;
  --card: #16161f;
  --border: #23232f;
  --text: #f4f4f8;
  --muted: #9aa0b4;
  --accent: #e50914;
  --accent-hover: #ff1f2a;
  --accent-soft: rgba(229, 9, 20, 0.12);
  --radius: 12px;
  --maxw: 1200px;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(10, 10, 15, 0.82);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Light theme overrides (toggled from Settings) */
html[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --border: #e3e5ed;
  --text: #15161c;
  --muted: #5d6475;
  --accent-soft: rgba(229, 9, 20, 0.08);
  --shadow-card: 0 10px 30px rgba(20, 24, 40, 0.10);
  --nav-bg: rgba(255, 255, 255, 0.82);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #fff; }

/* Subtle custom scrollbar (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Accessible focus states */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---- Entrance animations (used on landing + shared) ---- */
@keyframes tk-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes tk-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes tk-pop {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
.anim-up { animation: tk-fade-up 0.7s var(--ease) both; }
.anim-in { animation: tk-fade-in 0.9s ease both; }
.anim-pop { animation: tk-pop 0.5s var(--ease) both; }
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }
.delay-4 { animation-delay: 0.32s; }

/* Scroll-reveal helper (activated by IntersectionObserver on the landing page;
   without JS the elements simply stay visible) */
.reveal { opacity: 1; transform: none; }
.reveal.reveal-ready { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.reveal-ready.revealed { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .reveal.reveal-ready { opacity: 1; transform: none; }
}

/* Header */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; transition: opacity .15s; }
.brand:hover { opacity: 0.85; }
.brand span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--muted); font-size: 0.92rem; font-weight: 500; transition: color .15s; position: relative; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 11px 22px; border-radius: var(--radius); font-weight: 700; font-size: 0.95rem;
  transition: background .2s, transform .15s var(--ease), box-shadow .2s; font-family: inherit;
  box-shadow: 0 4px 18px rgba(229, 9, 20, 0.25);
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(229, 9, 20, 0.35); }
.btn:active { transform: scale(.97); box-shadow: 0 2px 10px rgba(229, 9, 20, 0.25); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--muted); box-shadow: none; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* Hero / landing */
.hero {
  position: relative; text-align: center;
  padding: 110px 20px 90px;
  background:
    radial-gradient(1100px 480px at 50% -10%, rgba(229, 9, 20, 0.20), transparent 70%),
    radial-gradient(700px 320px at 15% 10%, rgba(229, 9, 20, 0.06), transparent 70%),
    radial-gradient(700px 320px at 85% 15%, rgba(120, 40, 220, 0.06), transparent 70%);
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(720px, 80vw); height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.hero p { color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.2rem); max-width: 600px; margin: 18px auto 32px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft); color: var(--accent-hover);
  border: 1px solid rgba(229, 9, 20, 0.25);
  padding: 6px 14px; border-radius: 99px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em;
  margin-bottom: 22px;
}
.hero-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: tk-pulse 2s ease-in-out infinite;
}
@keyframes tk-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(229, 9, 20, 0); }
}
.hero .accent-word {
  background: linear-gradient(120deg, var(--accent) 0%, #ff5b63 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.section { padding: 64px 0; }
.section h2 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.section .lead { color: var(--muted); margin-bottom: 36px; max-width: 620px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-link { color: var(--accent); font-weight: 600; font-size: 0.9rem; transition: color .15s; white-space: nowrap; }
.section-link:hover { color: var(--accent-hover); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.feature {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.feature:hover { transform: translateY(-4px); border-color: var(--muted); box-shadow: var(--shadow-card); }
.feature .ico {
  font-size: 1.5rem; margin-bottom: 14px;
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); border: 1px solid rgba(229, 9, 20, 0.18);
}
.feature h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 0.92rem; }

/* Movie grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow-card); }
.card .poster { transition: transform .4s var(--ease); }
.card:hover .poster { transform: scale(1.04); }
.poster { aspect-ratio: 2/3; width: 100%; object-fit: cover; background: var(--bg-soft); }
.poster.placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2rem; }
.card-body { padding: 12px 14px 16px; position: relative; z-index: 1; background: var(--card); }
.card-body h3 { font-size: 0.98rem; font-weight: 700; line-height: 1.3; }
.card-body .meta { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.progress-bar { height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s var(--ease); }

.row-title { font-size: 1.2rem; font-weight: 800; margin: 0 0 16px; }

/* Watch page */
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; margin-top: 24px; box-shadow: var(--shadow-card); }
.player-wrap video { width: 100%; max-height: 78vh; display: block; background: #000; }
.watch-meta { padding: 28px 0; }
.watch-meta h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; }
.watch-meta .tags { color: var(--muted); margin: 8px 0 18px; }
.watch-meta p { color: var(--muted); max-width: 760px; }

/* Forms / auth */
.auth-wrap { max-width: 420px; margin: 60px auto; padding: 0 20px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-card); }
.panel h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.panel .sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  padding: 11px 14px; border-radius: 10px; font-size: 0.95rem; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 90px; }
.form-msg { font-size: 0.88rem; margin: 6px 0 14px; min-height: 18px; }
.form-msg.error { color: #ff6b72; }
.form-msg.ok { color: #4ade80; }
.switch-line { text-align: center; color: var(--muted); font-size: 0.88rem; margin-top: 18px; }
.switch-line a { color: var(--accent); font-weight: 600; }

/* Legal pages */
.legal { max-width: 800px; margin: 0 auto; padding: 60px 20px; }
.legal h1 { font-size: 2rem; margin-bottom: 6px; }
.legal .updated { color: var(--muted); font-size: 0.85rem; margin-bottom: 32px; }
.legal h2 { font-size: 1.2rem; margin: 28px 0 10px; }
.legal p, .legal li { color: var(--muted); margin-bottom: 10px; }
.legal ul { padding-left: 20px; }

/* Admin */
.badge { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; }
.badge.live { background: rgba(74,222,128,0.15); color: #4ade80; }
.badge.locked { background: rgba(255,107,114,0.15); color: #ff6b72; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: 360px 1fr; align-items: start; } }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; transition: border-color .2s; }
.admin-item:hover { border-color: var(--muted); }
.admin-item img { width: 40px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--bg-soft); }
.admin-item .info { flex: 1; min-width: 0; }
.admin-item .info h4 { font-size: 0.92rem; }
.admin-item .info span { color: var(--muted); font-size: 0.8rem; }
.admin-item button { background: transparent; border: none; color: #ff6b72; cursor: pointer; font-size: 0.85rem; }
.hr { height: 1px; background: var(--border); margin: 24px 0; border: none; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 32px 0; margin-top: 40px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.85rem; }
.footer-inner a { color: var(--muted); transition: color .15s; }
.footer-inner a:hover { color: var(--text); }
.footer-links { display: flex; gap: 18px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }

/* ---- Library toolbar: search, sort, genre chips ---- */
.lib-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search-input {
  flex: 1; min-width: 220px; max-width: 500px;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); font-family: inherit; font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input::placeholder { color: var(--muted); }
.sort-select {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); font-family: inherit; font-size: 0.92rem;
  font-weight: 600; cursor: pointer; transition: border-color .2s;
}
.sort-select:hover, .sort-select:focus { border-color: var(--muted); outline: none; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 6px 14px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); font-size: 0.84rem; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: color .15s, border-color .15s, background .15s, transform .15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--muted); transform: translateY(-1px); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.search-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; min-height: 22px; }
.spinner {
  width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: tk-spin 0.8s linear infinite;
}
@keyframes tk-spin { to { transform: rotate(360deg); } }
.indexing-note { text-align: center; padding: 48px 20px; color: var(--muted); }
.indexing-note .spinner { width: 28px; height: 28px; margin: 0 auto 16px; border-width: 3px; }

/* Skeleton shimmer — used while the "Recently added" strip loads */
.skeleton-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--card); }
.skeleton-card .sk-poster { aspect-ratio: 2/3; width: 100%; }
.skeleton-card .sk-line { height: 12px; border-radius: 6px; margin: 12px 14px; }
.skeleton-card .sk-line.short { width: 45%; margin-top: 0; margin-bottom: 16px; }
.sk-shimmer {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: tk-shimmer 1.4s ease-in-out infinite;
}
@keyframes tk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Watch page action bar ---- */
.watch-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.watch-actions .btn { padding: 9px 15px; font-size: 0.9rem; }
.watch-actions .tb-icon { padding: 9px 13px; }
@media (max-width: 640px) {
  .watch-actions { gap: 7px; }
  .watch-actions .btn { padding: 10px 13px; font-size: 0.85rem; }
  /* keep labels but let the row wrap tightly; icons alone for share/trailer/server */
  .watch-actions #share-btn .lbl, .watch-actions #trailer-btn .lbl { display: none; }
}

/* ---- Trailer hover preview (library, desktop) ---- */
.trailer-pop {
  position: fixed; z-index: 90; border-radius: 14px; overflow: hidden;
  background: #000; box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  border: 1px solid var(--border); opacity: 0; transform: scale(0.92);
  transition: opacity .22s var(--ease), transform .22s var(--ease); pointer-events: none;
}
.trailer-pop.show { opacity: 1; transform: scale(1); }
.trailer-pop iframe, .trailer-pop img { width: 100%; display: block; border: 0; }
.trailer-pop .tp-info { padding: 10px 12px; background: var(--card); }
.trailer-pop .tp-info h4 { font-size: 0.95rem; margin: 0 0 2px; }
.trailer-pop .tp-info .meta { color: var(--muted); font-size: 0.78rem; }
@media (hover: none) { .trailer-pop { display: none !important; } }

/* ---- Leaderboard ---- */
.lb-preview { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: none; }
.lb-rank { width: 26px; text-align: center; font-weight: 800; font-size: 0.95rem; flex-shrink: 0; color: var(--muted); }
.lb-row.me { background: var(--accent-soft); margin: 0 -12px; padding: 9px 12px; border-radius: 10px; border-bottom: none; }
.lb-medal { font-size: 1.1rem; }
.lb-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-time { color: var(--accent-hover); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }

/* ---- Wrapped (Spotify-style swipeable recap cards) ---- */
.wrap-stage { position: fixed; inset: 0; z-index: 300; background: #050509; display: none; opacity: 0; transition: opacity .25s ease; }
.wrap-stage.open { display: block; opacity: 1; }
.wrap-track { display: flex; height: 100%; scroll-snap-type: x mandatory; overflow-x: auto; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.wrap-track::-webkit-scrollbar { display: none; }
.wrap-card {
  flex: 0 0 100%; scroll-snap-align: center; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 74px 26px 84px; position: relative; color: #fff; overflow: hidden;
}
/* Distinct cinematic backgrounds per card */
.wc-bg1 { background:
  radial-gradient(120% 80% at 50% -10%, #ff2d38 0%, rgba(255,45,56,0) 55%),
  radial-gradient(90% 60% at 80% 110%, #6a0d17 0%, rgba(106,13,23,0) 60%),
  linear-gradient(160deg, #24060a 0%, #0a0a0f 100%); }
.wc-bg2 { background:
  radial-gradient(110% 70% at 20% 0%, #b0219e 0%, rgba(176,33,158,0) 55%),
  radial-gradient(120% 80% at 90% 100%, #e50914 0%, rgba(229,9,20,0) 55%),
  linear-gradient(160deg, #2a0a3f 0%, #150210 100%); }
.wc-bg3 { background:
  radial-gradient(100% 60% at 50% 0%, #ff3b43 0%, rgba(255,59,67,0) 50%),
  linear-gradient(165deg, #1a0207 0%, #0a0a0f 100%); }
/* Soft rotating shine so cards feel alive */
.wc-glow { position: absolute; inset: -30%; z-index: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,0.12), rgba(255,255,255,0) 70%);
  animation: tk-shine 9s ease-in-out infinite alternate; }
@keyframes tk-shine { 0% { transform: translate(-12%, -8%) scale(1); } 100% { transform: translate(14%, 10%) scale(1.25); } }

.wrap-card .wc-in { max-width: 440px; width: 100%; position: relative; z-index: 2; animation: tk-fade-up .55s var(--ease) both; }
.wrap-top { position: absolute; top: 30px; left: 0; right: 0; text-align: center; z-index: 6;
  font-weight: 800; font-size: 1.05rem; letter-spacing: 0.3px; text-shadow: 0 2px 14px rgba(0,0,0,.4); }
.wrap-top span { color: #ff3b43; }
.wrap-top-tag { color: #fff !important; opacity: 0.55; font-size: 0.62rem; letter-spacing: 3px; vertical-align: middle; margin-left: 4px; }
.wrap-domain { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; z-index: 6;
  font-size: 0.95rem; font-weight: 800; letter-spacing: 1.5px; opacity: 0.95; text-shadow: 0 2px 14px rgba(0,0,0,.45); }

.wrap-card .wc-label { text-transform: uppercase; letter-spacing: 3px; font-size: 0.74rem; font-weight: 800; opacity: 0.8; margin-bottom: 16px; }
.wrap-card .wc-big { font-size: clamp(3.4rem, 20vw, 6.5rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.04em; margin: 4px 0;
  background: linear-gradient(180deg, #fff, #ffd9db); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.wrap-card .wc-sub { font-size: clamp(1.05rem, 4.5vw, 1.4rem); font-weight: 700; margin-top: 8px; opacity: 0.95; }
.wrap-card .wc-note { opacity: 0.82; margin-top: 18px; font-size: 0.95rem; line-height: 1.55; }
.wrap-card .wc-emoji { font-size: 3.2rem; margin-bottom: 8px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.4)); }

/* Stat grid */
.wc-grid { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.wc-stat { flex: 1; min-width: 74px; background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px; padding: 14px 8px; backdrop-filter: blur(4px); }
.wc-stat b { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.wc-stat span { display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 1.2px; opacity: 0.8; margin-top: 6px; }

/* Personality badge */
.wc-persona { margin-top: 22px; display: inline-flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.18); padding: 10px 18px; border-radius: 99px; font-size: 1rem; }
.wc-persona-emoji { font-size: 1.3rem; }

/* Obsession poster */
.wc-poster-wrap { margin: 4px auto 16px; width: 150px; }
.wc-poster { width: 150px; border-radius: 14px; box-shadow: 0 18px 44px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.1), 0 0 40px rgba(255,45,56,.4);
  animation: tk-pop .5s var(--ease) both; }
.wc-title { font-size: clamp(1.5rem, 7vw, 2.3rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.wc-meta { opacity: 0.85; font-size: 0.9rem; margin-top: 8px; }

/* Top 5 list */
.wc-top5 { margin-top: 20px; text-align: left; }
.wc-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.10); }
.wc-row:last-child { border-bottom: none; }
.wc-rank { width: 24px; text-align: center; font-size: 1.3rem; font-weight: 800; opacity: 0.9; flex-shrink: 0; }
.wc-thumb { width: 40px; height: 58px; object-fit: cover; border-radius: 7px; background: rgba(255,255,255,0.12); flex-shrink: 0; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.wc-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wc-row-info strong { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-row-info span { font-size: 0.78rem; opacity: 0.7; }
.wc-share { margin-top: 22px; font-weight: 700; font-size: 0.95rem; opacity: 0.95; }

/* Chrome */
.wrap-dots { position: absolute; top: 14px; left: 12px; right: 12px; display: flex; gap: 5px; justify-content: center; z-index: 7; }
.wrap-dots span { flex: 1; max-width: 60px; height: 3px; border-radius: 3px; background: rgba(255,255,255,0.28); transition: background .25s; }
.wrap-dots span.on { background: #fff; }
.wrap-close { position: absolute; top: 26px; right: 16px; z-index: 8; background: rgba(0,0,0,0.3); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; cursor: pointer; }
/* Instagram-style invisible tap zones */
.wrap-tap { position: absolute; top: 0; bottom: 0; z-index: 5; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wrap-tap.left { left: 0; width: 33%; }
.wrap-tap.right { left: 33%; right: 0; width: 67%; }
.wrap-hint { position: absolute; bottom: 54px; left: 0; right: 0; text-align: center; z-index: 6; color: #fff; font-size: 0.78rem; opacity: 0.7; pointer-events: none; animation: tk-pulse-hint 1.8s ease-in-out infinite; }
@keyframes tk-pulse-hint { 0%,100% { opacity: 0.35; } 50% { opacity: 0.85; } }

/* ---- Page & content entrance animations ---- */
main { animation: tk-fade-in 0.3s ease both; }

/* Cards pop in with a gentle stagger (capped so long grids don't lag) */
.grid .card, .scroll-row .card, .features .feature {
  animation: tk-card-in 0.45s var(--ease) both;
}
@keyframes tk-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.grid .card:nth-child(1), .scroll-row .card:nth-child(1) { animation-delay: 0.03s; }
.grid .card:nth-child(2), .scroll-row .card:nth-child(2) { animation-delay: 0.06s; }
.grid .card:nth-child(3), .scroll-row .card:nth-child(3) { animation-delay: 0.09s; }
.grid .card:nth-child(4), .scroll-row .card:nth-child(4) { animation-delay: 0.12s; }
.grid .card:nth-child(5), .scroll-row .card:nth-child(5) { animation-delay: 0.15s; }
.grid .card:nth-child(6), .scroll-row .card:nth-child(6) { animation-delay: 0.18s; }
.grid .card:nth-child(7), .scroll-row .card:nth-child(7) { animation-delay: 0.21s; }
.grid .card:nth-child(8), .scroll-row .card:nth-child(8) { animation-delay: 0.24s; }
.grid .card:nth-child(9), .scroll-row .card:nth-child(9) { animation-delay: 0.27s; }
.grid .card:nth-child(10), .scroll-row .card:nth-child(10) { animation-delay: 0.30s; }
.grid .card:nth-child(11), .scroll-row .card:nth-child(11) { animation-delay: 0.33s; }
.grid .card:nth-child(12), .scroll-row .card:nth-child(12) { animation-delay: 0.36s; }

/* Posters fade in as they load instead of popping */
img.poster { animation: tk-fade-in 0.45s ease both; }

/* Genre chips slide in softly */
.chip { animation: tk-fade-in 0.35s ease both; }

/* ---- Landing spotlight (rotating featured titles) ---- */
.spotlight {
  position: relative; border-radius: 16px; overflow: hidden;
  min-height: clamp(300px, 45vw, 440px);
  display: flex; align-items: flex-end;
  background: var(--card); border: 1px solid var(--border);
}
.spotlight .sp-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center 20%;
  opacity: 0; transition: opacity 1.1s ease; transform: scale(1.02);
}
.spotlight .sp-bg.on { opacity: 1; }
.spotlight::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(3,3,13,0.92) 0%, rgba(3,3,13,0.45) 45%, rgba(3,3,13,0.05) 100%);
  pointer-events: none;
}
.spotlight .sp-content { position: relative; z-index: 2; padding: clamp(20px, 4vw, 36px); max-width: 640px; }
.spotlight .sp-tag { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-hover); margin-bottom: 8px; }
.spotlight h2 { font-size: clamp(1.5rem, 4.5vw, 2.4rem); color: #fff; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.spotlight .sp-meta { color: #c8cede; font-size: 0.88rem; margin-bottom: 10px; }
.spotlight .sp-desc { color: #aab2c8; font-size: 0.92rem; line-height: 1.55; margin-bottom: 18px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.spotlight .sp-dots { position: absolute; right: 18px; bottom: 18px; z-index: 3; display: flex; gap: 7px; }
.spotlight .sp-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); cursor: pointer; transition: background .2s, transform .2s; }
.spotlight .sp-dots span.on { background: var(--accent); transform: scale(1.25); }

/* ---- Horizontal scroll rows (genre strips) ---- */
.scroll-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 170px;
  gap: 14px; overflow-x: auto; padding: 4px 4px 14px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.scroll-row .card { scroll-snap-align: start; }
@media (max-width: 640px) { .scroll-row { grid-auto-columns: 138px; gap: 10px; } }

/* ---- Save-to-list button on cards ---- */
.save-btn {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(3, 3, 13, 0.65); color: #fff; font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background .2s, transform .15s var(--ease);
}
.save-btn:hover { background: var(--accent); transform: scale(1.1); }
.save-btn.saved { background: var(--accent); }

/* ---- Watch page backdrop ---- */
.watch-backdrop {
  position: absolute; top: 0; left: 0; right: 0; height: 62vh; z-index: -1;
  background-size: cover; background-position: center top; opacity: 0.16;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
  pointer-events: none;
}

/* ---- Resume note on watch page ---- */
.resume-note {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent-soft); border: 1px solid rgba(229, 9, 20, 0.25);
  color: var(--text); border-radius: 10px; padding: 10px 16px;
  font-size: 0.9rem; margin: 4px 0 16px;
}

/* ---- Admin stats ---- */
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 28px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card b { font-size: 1.8rem; display: block; letter-spacing: -0.02em; }
.stat-card span { color: var(--muted); font-size: 0.85rem; }

/* ---- Advertisement placeholders ---- */
.ad-box {
  background: repeating-linear-gradient(45deg, var(--bg-soft), var(--bg-soft) 10px, var(--card) 10px, var(--card) 20px);
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.ad-box small { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; opacity: 0.7; margin-top: 4px; }

/* Side rails — only on wide screens so they never crowd the content */
.ad-rail {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 30;
  width: 160px; height: 600px; display: none;
}
.ad-rail.left { left: 16px; }
.ad-rail.right { right: 16px; }
.ad-rail .ad-box { width: 100%; height: 100%; }
@media (min-width: 1500px) { .ad-rail { display: block; } }

/* In-page banner (bottom of content) */
.ad-banner { max-width: var(--maxw); margin: 8px auto 0; padding: 0 20px; }
.ad-banner .ad-box { height: 110px; width: 100%; }
@media (max-width: 640px) { .ad-banner .ad-box { height: 90px; } }

/* Theme toggle pill */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.switch { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border); border-radius: 99px; cursor: pointer; transition: background .2s; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s var(--ease); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* Pills / select badges for movie visibility */
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 700; }
.pill.public { background: rgba(74,222,128,0.15); color: #4ade80; }
.pill.unlisted { background: rgba(250,204,21,0.16); color: #eab308; }
.pill.private { background: rgba(255,107,114,0.15); color: #ff6b72; }
/* Log status pills (admin Logs tab) */
.pill.success { background: rgba(74,222,128,0.15); color: #4ade80; }
.pill.fail { background: rgba(255,107,114,0.15); color: #ff6b72; }
.pill.unavailable { background: rgba(250,204,21,0.16); color: #eab308; }

/* Tabs (admin) */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { white-space: nowrap; flex-shrink: 0; }
.tabs button { background: none; border: none; color: var(--muted); font-family: inherit; font-size: 0.95rem; font-weight: 600; padding: 12px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }

/* Simple modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.open { display: flex; animation: tk-fade-in 0.2s ease both; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 26px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-card); }
.modal-bg.open .modal { animation: tk-pop 0.25s var(--ease) both; }
.modal h2 { font-size: 1.2rem; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* History rows */
.hist-row { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; transition: border-color .2s; }
.hist-row:hover { border-color: var(--muted); }
.hist-row img { width: 46px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--bg-soft); }
.hist-row .h-info { flex: 1; min-width: 0; }
.hist-row .h-info h4 { font-size: 0.95rem; }
.hist-row .h-info .progress-bar { margin-top: 8px; }
.hist-row .h-info span { color: var(--muted); font-size: 0.8rem; }

.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.6rem; flex-shrink: 0; }
.stat-row { display: flex; gap: 28px; flex-wrap: wrap; margin: 8px 0; }
.stat-row .stat b { display: block; font-size: 1.5rem; }
.stat-row .stat span { color: var(--muted); font-size: 0.82rem; }

/* ---- TV mode: everything bigger, focus loud and obvious ---- */
html.tv-mode { font-size: 20px; }
html.tv-mode .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px; }
html.tv-mode .scroll-row { grid-auto-columns: 230px; gap: 22px; }
html.tv-mode .card:focus, html.tv-mode .btn:focus, html.tv-mode .chip:focus,
html.tv-mode a:focus, html.tv-mode button:focus {
  outline: 4px solid var(--accent); outline-offset: 4px;
}
html.tv-mode .card:focus { transform: scale(1.06); border-color: var(--accent); z-index: 2; }
html.tv-mode .ad-rail, html.tv-mode .pwa-banner { display: none !important; }
html.tv-mode .btn { padding: 15px 30px; }
html.tv-mode .nav-links a { font-size: 1rem; }

/* ---- Bottom tab bar (mobile app navigation) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none;
  background: var(--nav-bg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 7px; color: var(--muted); font-size: 0.66rem; font-weight: 600;
  min-height: 52px; justify-content: center; transition: color .15s;
}
.tabbar a .tb-ico { font-size: 1.25rem; line-height: 1; transition: transform .2s var(--ease); }
.tabbar a.on { color: var(--text); }
.tabbar a.on .tb-ico { transform: translateY(-2px) scale(1.12); }
.tabbar a:active .tb-ico { transform: scale(0.9); }
@media (max-width: 767px) {
  .tabbar { display: flex; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  /* the top nav slims down — the tab bar handles navigation */
  .nav-links a:not(.btn):not(#tk-logout) { display: none; }
}

/* ---- PWA install banner ---- */
.pwa-banner {
  position: fixed; left: 12px; right: 12px; z-index: 70;
  bottom: calc(72px + env(safe-area-inset-bottom));
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: var(--shadow-card);
  animation: tk-fade-up 0.45s var(--ease) both;
}

/* ---- Toast notifications ---- */
.toast {
  position: fixed; left: 50%; transform: translate(-50%, 16px);
  bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 80;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 11px 20px; border-radius: 99px; font-size: 0.88rem; font-weight: 600;
  box-shadow: var(--shadow-card); opacity: 0; transition: opacity .3s, transform .3s var(--ease);
  max-width: calc(100vw - 40px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 768px) { .toast { bottom: 28px; } .pwa-banner { display: none; } }

/* Tablet */
@media (max-width: 900px) {
  .section { padding: 52px 0; }
}

/* Mobile */
@media (max-width: 640px) {
  .nav-inner { padding: 12px 16px; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 0.85rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .hero { padding: 72px 20px 56px; }
  .hero-actions .btn { width: 100%; max-width: 320px; }
  .section { padding: 44px 0; }
  .panel { padding: 24px 20px; }
  .container { padding: 0 16px; }
  /* comfortable thumb targets */
  .btn { min-height: 44px; }
  .chip { padding: 9px 16px; min-height: 38px; }
  .sort-select, .search-input { min-height: 44px; }
  .save-btn { width: 38px; height: 38px; }
  /* 16px inputs stop iOS Safari from zooming the page on focus */
  .search-input, .field input, .field textarea, .field select, .sort-select { font-size: 16px; }
  /* modals slide up like native sheets */
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-width: 100%; max-height: 86vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .modal-bg.open .modal { animation: tk-sheet-up 0.32s var(--ease) both; }
}
@keyframes tk-sheet-up {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.hide-on-mobile { }
@media (max-width: 480px) { .hide-on-mobile { display: none; } }
