/* =========================================================
   RAYKO STREAM — VIOLET DARK PREMIUM
========================================================= */

:root {
    --background: #08070d; --background-soft: #0d0b14; --surface: #11101a;
    --surface-light: #191624; --surface-hover: #211b30;
    --purple: #a855f7; --purple-light: #c084fc; --purple-dark: #7e22ce;
    --text: #f5f0fa; --text-soft: #c4bbd0; --muted: #898194;
    --border: rgba(192, 132, 252, 0.14); --border-strong: rgba(168, 85, 247, 0.35);
    --success: #4ade80; --danger: #fb7185;
    --radius: 12px; --radius-large: 18px;
    --shadow-purple: 0 0 35px rgba(168, 85, 247, 0.16); --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45);
    --transition: 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scrollbar-color: #4c1d95 #08070d; }
body { min-height: 100vh; overflow-x: hidden; background: radial-gradient(ellipse at 50% -20%, rgba(126, 34, 206, 0.18), transparent 50%), var(--background); color: var(--text); font-family: Inter, "Segoe UI", Arial, sans-serif; line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* BACKGROUND */
.background-effects { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.background-glow { position: absolute; width: 55vw; height: 55vw; border-radius: 50%; opacity: 0.22; background: radial-gradient(circle, rgba(168, 85, 247, 0.45), transparent 70%); transform: translateZ(0); }
.glow-one { top: -22vw; left: -12vw; }
.glow-two { bottom: -25vw; right: -15vw; background: radial-gradient(circle, rgba(109, 40, 217, 0.4), transparent 70%); }
.background-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(ellipse at 50% 0%, black 30%, transparent 80%); }

/* HEADER */
.header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; padding: 0 max(24px, calc((100vw - 1400px) / 2)); min-height: 74px; border-bottom: 1px solid var(--border); background: rgba(8, 7, 13, 0.92); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: white; font-weight: 900; text-decoration: none; }
.brand-icon svg { width: 42px; height: 42px; filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 20px; font-weight: 900; letter-spacing: 1px; }
.brand-name span { color: var(--purple-light); }
.brand-subtitle { font-size: 8px; letter-spacing: 2.5px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.header-nav { display: flex; align-items: center; gap: 6px; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 6px; color: var(--text-soft); font-size: 13px; font-weight: 600; text-decoration: none; transition: background var(--transition), color var(--transition); }
.nav-link:hover { color: white; background: rgba(168, 85, 247, 0.08); }
.nav-link.active { color: white; background: rgba(168, 85, 247, 0.15); }
.header-right { display: flex; align-items: center; gap: 18px; }
.api-status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; background: rgba(168, 85, 247, 0.05); color: var(--text-soft); font-size: 11px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.profile-avatar { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: white; font-weight: 900; font-size: 15px; cursor: pointer; }

/* HERO */
.hero { position: relative; display: flex; align-items: center; min-height: 500px; padding: 80px max(24px, calc((100vw - 1400px) / 2)) 90px; overflow: hidden; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 7, 13, 0) 40%, var(--background) 100%), radial-gradient(ellipse at 70% 30%, rgba(168, 85, 247, 0.14), transparent 55%); pointer-events: none; }
.hero-content { position: relative; z-index: 2; width: min(680px, 100%); }
.hero-label { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 30px; background: rgba(168, 85, 247, 0.08); color: var(--purple-light); font-size: 10px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 22px; }
.hero-label-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 8px var(--purple); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.hero h1 { margin-bottom: 18px; font-size: clamp(40px, 6vw, 72px); font-weight: 900; letter-spacing: -3px; line-height: 1.05; }
.hero h1 span { background: linear-gradient(135deg, var(--purple-light), var(--purple)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-description { max-width: 540px; margin-bottom: 28px; color: var(--text-soft); font-size: 15px; line-height: 1.8; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-button { display: inline-flex; align-items: center; gap: 9px; padding: 13px 24px; border-radius: 6px; background: white; color: #08070d; font-size: 14px; font-weight: 800; text-decoration: none; transition: background var(--transition); }
.hero-button:hover { background: rgba(255, 255, 255, 0.88); }
.hero-bottom-line { position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }

/* SEARCH */
.search-section { position: relative; z-index: 3; width: min(780px, calc(100% - 40px)); margin: -40px auto 60px; }
.section-heading { margin-bottom: 18px; text-align: center; }
.section-eyebrow { display: block; color: var(--purple-light); font-size: 10px; font-weight: 800; letter-spacing: 3px; margin-bottom: 8px; }
.section-heading h2, .catalog-heading h2 { font-size: clamp(22px, 3.5vw, 32px); font-weight: 900; letter-spacing: -1px; }
.search-form { display: flex; gap: 10px; padding: 9px; border: 1px solid var(--border-strong); border-radius: 12px; background: rgba(17, 16, 26, 0.96); box-shadow: var(--shadow-card), var(--shadow-purple); }
.search-input-wrapper { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.search-icon { position: absolute; left: 15px; color: var(--muted); font-size: 17px; pointer-events: none; }
#searchInput { width: 100%; height: 50px; padding: 0 60px 0 44px; border: 0; outline: none; background: transparent; color: white; font-size: 15px; }
#searchInput::placeholder { color: var(--muted); }
kbd { position: absolute; right: 12px; padding: 3px 7px; border: 1px solid var(--border); border-radius: 4px; background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
#searchButton { display: inline-flex; align-items: center; gap: 8px; padding: 0 26px; height: 50px; border: 0; border-radius: 8px; background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: white; font-size: 14px; font-weight: 800; cursor: pointer; transition: filter var(--transition); }
#searchButton:hover { filter: brightness(1.15); }

/* REPRENDRE LA LECTURE */
.resume-section { width: min(1400px, calc(100% - 48px)); margin: 0 auto 60px; scroll-margin-top: 90px; }
.resume-section .catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.resume-clear { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: color var(--transition), background var(--transition); }
.resume-clear:hover { color: var(--danger); background: rgba(251, 113, 133, 0.08); }
.scroll-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 0 12px; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: #4c1d95 transparent; }
.scroll-row::-webkit-scrollbar { height: 6px; }
.scroll-row::-webkit-scrollbar-thumb { background: #4c1d95; border-radius: 3px; }
.anime-card { flex: 0 0 170px; scroll-snap-align: start; border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer; transition: transform var(--transition); position: relative; }
.anime-card:hover { transform: translateY(-4px); }
.anime-card .img-container { position: relative; aspect-ratio: 2/3; overflow: hidden; background: #171321; }
.anime-card .img-container img { width: 100%; height: 100%; object-fit: cover; display: block; }
.resume-card .img-container { aspect-ratio: 2/3; }
.progress-bar-wrap { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0, 0, 0, 0.55); overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, #8b5cf6, #a855f7); border-radius: 0 3px 3px 0; transition: width 0.6s ease; }
.resume-badge { position: absolute; top: 8px; right: 8px; padding: 2px 7px; border-radius: 10px; background: rgba(0, 0, 0, 0.78); color: #c084fc; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; backdrop-filter: blur(4px); }
.resume-remove { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.7); color: var(--muted); font-size: 11px; cursor: pointer; opacity: 0; transition: opacity var(--transition), color var(--transition), background var(--transition); }
.anime-card:hover .resume-remove { opacity: 1; }
.resume-remove:hover { color: var(--danger); background: rgba(251, 113, 133, 0.2); }
.anime-info { padding: 10px 10px 12px; }
.anime-info h3 { overflow: hidden; margin-bottom: 3px; color: white; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.anime-info p { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* EXPLORATEUR (CATALOGUE) */
.catalog-section { width: min(1400px, calc(100% - 48px)); margin: 0 auto 80px; scroll-margin-top: 90px; }
.catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.heading-accent { color: var(--purple-light); }
.catalog-count { display: inline-flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: 13px; }
#resultCount { color: var(--purple-light); font-size: 20px; font-weight: 900; }
.explorer-layout { display: grid; grid-template-columns: 260px 1fr; gap: 30px; align-items: start; margin-top: 20px; }
.explorer-sidebar { position: sticky; top: 100px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; max-height: calc(100vh - 120px); overflow-y: auto; }
.explorer-sidebar::-webkit-scrollbar { width: 4px; }
.explorer-sidebar::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 4px; }
.filter-group { margin-bottom: 25px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group h3 { color: var(--purple-light); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.filter-btn { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 4px; background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--text-soft); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.filter-btn:hover { background: rgba(168, 85, 247, 0.08); color: white; }
.filter-btn.active { background: rgba(168, 85, 247, 0.15); border-color: var(--purple); color: var(--purple-light); font-weight: 800; }
.filter-input { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-light); color: white; outline: none; font-size: 13px; }
.filter-input:focus { border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }
.explorer-content { min-width: 0; }
#catalogMessage { padding: 20px 0 30px; text-align: left; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
#catalogMessage h3 { font-size: 20px; color: white; margin-bottom: 4px; }
#catalogMessage p { color: var(--muted); font-size: 13px; margin: 0; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; contain: layout style; }
.media-card { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: transform var(--transition); }
.media-card:hover { transform: translateY(-5px); }
.media-poster { position: relative; overflow: hidden; aspect-ratio: 2/3; background: #171321; }
.media-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.media-card:hover .media-poster img { transform: scale(1.04); }
.media-type { position: absolute; top: 9px; right: 9px; padding: 4px 8px; border-radius: 4px; background: rgba(10, 8, 15, 0.85); border: 1px solid var(--border-strong); color: var(--purple-light); font-size: 9px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; z-index: 1; }
.poster-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: radial-gradient(circle, rgba(168, 85, 247, 0.18), transparent 70%), var(--surface-light); color: var(--purple-light); font-size: 48px; font-weight: 900; }
.media-card-info { padding: 12px 13px 15px; }
.media-card-info h3 { overflow: hidden; margin-bottom: 3px; font-size: 14px; font-weight: 700; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.media-card-info span { color: var(--muted); font-size: 11px; }

/* LIVE TV SPECIFIC */
.live-logo-container { width: 100%; }
.live-logo-container img { transition: transform 0.3s ease; }
.live-card:hover .live-logo-container img { transform: scale(1.05); }

/* DETAILS / SAISONS / ÉPISODES */
.detail-section { width: min(1400px, calc(100% - 48px)); margin: 40px auto 80px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--surface); scroll-margin-top: 90px; }
.detail-topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border); background: rgba(0, 0, 0, 0.2); }
.detail-topbar-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 2px; }
#detailContent { position: relative; min-height: 300px; }
.detail-loading, .season-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; min-height: 220px; color: var(--text-soft); text-align: center; }
.loading-spinner { width: 38px; height: 38px; border: 3px solid rgba(168, 85, 247, 0.2); border-top-color: var(--purple-light); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.detail-backdrop { position: absolute; inset: 0 0 auto; height: 400px; background-position: center 30%; background-size: cover; opacity: 0.25; }
.detail-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 7, 13, 0.3), var(--surface) 95%); }
.detail-layout { position: relative; z-index: 1; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 40px; padding: 40px; }
.detail-poster { overflow: hidden; align-self: start; aspect-ratio: 2/3; border-radius: 12px; background: var(--surface-light); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-information { min-width: 0; padding-top: 8px; }
.detail-information h1 { margin-bottom: 16px; font-size: clamp(28px, 4.5vw, 44px); font-weight: 900; letter-spacing: -1.5px; line-height: 1.1; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.detail-meta span { padding: 5px 11px; border: 1px solid var(--border); border-radius: 20px; background: rgba(168, 85, 247, 0.06); color: var(--text-soft); font-size: 12px; font-weight: 600; }
.detail-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.detail-categories span { padding: 4px 10px; border-radius: 4px; background: rgba(168, 85, 247, 0.15); color: var(--purple-light); font-size: 11px; font-weight: 700; }
.detail-information > h3 { margin: 22px 0 8px; color: var(--purple-light); font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.detail-overview { max-width: 850px; color: var(--text-soft); font-size: 14px; line-height: 1.8; }

#moviePlayButton, .episode-play-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border: 0; border-radius: 6px; background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: white; font-size: 13px; font-weight: 800; cursor: pointer; transition: filter var(--transition); }
#moviePlayButton:hover, .episode-play-button:hover { filter: brightness(1.15); }
#moviePlayButton { margin-top: 24px; }
.back-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-light); color: var(--text-soft); font-size: 12px; font-weight: 700; cursor: pointer; }
.back-button:hover { border-color: var(--purple); color: white; }

#seasonSelector { margin-top: 32px; }
.season-selector { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0, 0, 0, 0.25); }
.season-selector label { color: var(--text); font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
#seasonSelect { min-width: 220px; min-height: 44px; padding: 0 38px 0 14px; border: 1px solid var(--border-strong); border-radius: 6px; outline: none; background: var(--surface-light); color: white; font-size: 13px; font-weight: 700; cursor: pointer; }
#seasonSelect:focus { border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }
#seasonSelect option { background: var(--surface-light); }
.loading-text { color: var(--muted); font-size: 13px; }

.episodes-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 28px 0 16px; }
.episodes-header h3 { font-size: 18px; font-weight: 900; }
.episodes-header span { color: var(--muted); font-size: 12px; }
.episodes-list { display: flex; flex-direction: column; gap: 10px; }
.episode-card { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0, 0, 0, 0.2); transition: border-color var(--transition), background var(--transition); }
.episode-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.episode-thumbnail { position: relative; overflow: hidden; aspect-ratio: 16/9; border-radius: 6px; background: var(--surface-light); }
.episode-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.episode-number-badge { position: absolute; bottom: 4px; left: 4px; padding: 2px 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.78); color: var(--purple-light); font-size: 10px; font-weight: 800; letter-spacing: 0.4px; pointer-events: none; }
.episode-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: radial-gradient(circle, rgba(168, 85, 247, 0.18), transparent 70%), #171321; color: var(--purple-light); font-size: 24px; }
.episode-info { min-width: 0; }
.episode-info h4 { overflow: hidden; margin-bottom: 4px; color: white; font-size: 14px; font-weight: 800; text-overflow: ellipsis; }
.episode-info p { display: -webkit-box; overflow: hidden; max-width: 650px; color: var(--muted); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.episode-play-button { min-height: 38px; padding: 0 16px; white-space: nowrap; }

/* MESSAGES */
.error-message, .empty-message { padding: 22px; border: 1px solid rgba(251, 113, 133, 0.25); border-radius: 10px; background: rgba(251, 113, 133, 0.07); color: #fda4af; font-size: 13px; }
.empty-message { border-color: var(--border); background: rgba(168, 85, 247, 0.04); color: var(--text-soft); }

/* PLAYER + TÉLÉCHARGEMENTS */
.player-section { width: min(1200px, calc(100% - 48px)); margin: 40px auto 80px; padding: 26px; border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--surface); scroll-margin-top: 90px; }
.player-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
#playerTitle { font-size: clamp(17px, 3vw, 24px); font-weight: 900; }
#closePlayerButton { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-light); color: var(--text-soft); font-size: 12px; font-weight: 700; cursor: pointer; }
#closePlayerButton:hover { border-color: var(--danger); background: rgba(251, 113, 133, 0.1); color: var(--danger); }
#playerMessage { margin-top: 12px; color: var(--muted); font-size: 13px; }
.video-js { width: 100%; overflow: hidden; border-radius: 10px; background: #000; font-family: inherit; }
.video-js .vjs-big-play-button { top: 50%; left: 50%; width: 80px; height: 80px; margin: 0; transform: translate(-50%, -50%); border: 2px solid rgba(255, 255, 255, 0.4); border-radius: 50%; background: rgba(168, 85, 247, 0.9); line-height: 76px; }
.video-js:hover .vjs-big-play-button { background: var(--purple-dark); }
.video-js .vjs-play-progress, .video-js .vjs-volume-level { background: var(--purple); }
.video-js .vjs-control-bar { background: rgba(8, 7, 13, 0.94); }

.episode-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0, 0, 0, 0.25); }
.episode-navigation > span { color: var(--text-soft); font-size: 13px; font-weight: 700; letter-spacing: 0.5px; text-align: center; flex: 1; }
#previousEpisodeButton, #nextEpisodeButton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-light); color: var(--text); font-size: 13px; font-weight: 800; cursor: pointer; transition: background var(--transition), border-color var(--transition), filter var(--transition); white-space: nowrap; }
#previousEpisodeButton:hover, #nextEpisodeButton:hover { border-color: var(--purple); background: var(--surface-hover); color: white; }
#nextEpisodeButton { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); border-color: transparent; color: white; }
#nextEpisodeButton:hover { filter: brightness(1.15); }

.download-panel { margin-top: 22px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; gap: 14px; }
.download-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.download-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 6px; background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: white; font-size: 13px; font-weight: 800; cursor: pointer; transition: filter var(--transition), background var(--transition), border-color var(--transition); white-space: nowrap; }
.download-button:hover { filter: brightness(1.15); }
.download-button.secondary { background: var(--surface-light); border-color: var(--border-strong); color: var(--text); }
.download-button.secondary:hover { background: var(--surface-hover); border-color: var(--purple); color: white; }
.download-range-box { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: rgba(168, 85, 247, 0.05); }
.download-range-box[hidden] { display: none !important; }
.download-range-fields { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; min-width: 0; }
.download-range-fields label { display: flex; flex-direction: column; gap: 6px; color: var(--text-soft); font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; flex: 1; min-width: 120px; }
.download-range-fields input { height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 6px; outline: none; background: var(--surface-light); color: white; font-size: 14px; font-weight: 700; }
.download-range-fields input:focus { border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }
.download-progress-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: rgba(0, 0, 0, 0.2); }
.download-progress-box[hidden] { display: none !important; }
.download-progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.download-progress-heading strong { color: var(--text); font-size: 13px; font-weight: 800; }
#downloadProgressPercent { color: var(--purple-light); font-size: 14px; font-weight: 900; letter-spacing: 0.5px; }
.download-progress-track { height: 9px; background: #30283b; border-radius: 20px; overflow: hidden; }
.download-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--purple-light)); border-radius: 20px; transition: width 0.3s ease; }
#downloadProgressMessage { color: var(--muted); font-size: 12px; line-height: 1.5; min-height: 18px; }
.download-progress-buttons { display: flex; justify-content: flex-end; }
.download-cancel-button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border: 1px solid rgba(251, 113, 133, 0.35); border-radius: 6px; background: rgba(251, 113, 133, 0.08); color: var(--danger); font-size: 12px; font-weight: 800; cursor: pointer; }
.download-cancel-button:hover { background: rgba(251, 113, 133, 0.18); border-color: var(--danger); }

/* FOOTER */
.footer { margin-top: 80px; padding: 48px max(24px, calc((100vw - 1400px) / 2)) 32px; border-top: 1px solid var(--border); background: #06050a; color: var(--muted); }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 10px; color: white; font-size: 18px; font-weight: 900; letter-spacing: 1px; }
.footer-brand span span { color: var(--purple-light); }
.footer-dragon { font-size: 22px; }
.footer p { font-size: 13px; margin-bottom: 28px; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; border-top: 1px solid var(--border); font-size: 11px; letter-spacing: 1px; }
.footer-credit { color: var(--purple-light); font-weight: 800; }

/* RESPONSIVE */
@media (max-width: 960px) {
    .explorer-layout { grid-template-columns: 1fr; }
    .explorer-sidebar { position: static; max-height: none; display: flex; overflow-x: auto; padding: 15px; gap: 15px; }
    .filter-group { margin-bottom: 0; flex-shrink: 0; }
    .filter-group h3 { display: none; }
    .filter-btn { display: inline-block; width: auto; margin-right: 6px; white-space: nowrap; }

    .detail-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 26px; padding: 26px; }
    .episode-card { grid-template-columns: 130px minmax(0, 1fr); }
    .episode-play-button { grid-column: 2; justify-self: start; }
}
@media (max-width: 700px) {
    .header { min-height: 64px; padding: 0 16px; }
    .brand-name { font-size: 16px; }
    .brand-subtitle { display: none; }
    .brand-icon svg { width: 34px; height: 34px; }
    .nav-link { padding: 6px 10px; font-size: 12px; }
    .api-status { display: none; }
    .profile-avatar { width: 32px; height: 32px; font-size: 13px; }

    .hero { min-height: 400px; padding: 60px 20px 70px; }
    .hero h1 { letter-spacing: -1.8px; }

    .search-section { width: calc(100% - 28px); margin-top: -28px; }
    .search-form { gap: 6px; padding: 6px; }
    #searchInput { height: 44px; padding: 0 12px 0 38px; font-size: 13px; }
    kbd { display: none; }
    #searchButton { height: 44px; padding: 0 16px; font-size: 12px; }
    #searchButton span:first-child { display: none; }

    .resume-section, .catalog-section { width: calc(100% - 28px); margin-bottom: 40px; }
    .resume-section .catalog-heading, .catalog-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
    .anime-card { flex: 0 0 140px; }
    .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

    .detail-section { width: calc(100% - 20px); margin-top: 20px; }
    .detail-topbar { padding: 12px 16px; }
    .detail-topbar-label { display: none; }
    .detail-layout { grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 18px; }
    .detail-information h1 { font-size: 22px; letter-spacing: -0.5px; }
    .detail-overview { font-size: 12px; }
    #seasonSelector { grid-column: 1 / -1; }
    .season-selector { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
    #seasonSelect { width: 100%; min-width: 0; }

    .episode-card { grid-template-columns: 100px minmax(0, 1fr); gap: 10px; padding: 10px; }
    .episode-play-button { grid-column: 1 / -1; width: 100%; }
    .episode-info h4 { font-size: 12px; }
    .episode-info p { -webkit-line-clamp: 2; font-size: 11px; }

    .player-section { width: calc(100% - 20px); padding: 16px; margin-bottom: 50px; }

    .episode-navigation { flex-wrap: wrap; justify-content: center; padding: 12px; gap: 10px; }
    .episode-navigation > span { order: -1; flex-basis: 100%; font-size: 12px; }
    #previousEpisodeButton, #nextEpisodeButton { flex: 1; min-width: 0; padding: 0 12px; font-size: 12px; }

    .download-panel { padding: 14px; }
    .download-actions { flex-direction: column; }
    .download-button { width: 100%; }
    .download-range-box { flex-direction: column; align-items: stretch; }
    .download-range-fields { flex-direction: column; }
    .download-range-fields label { min-width: 0; }

    .footer { padding: 36px 20px 26px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
}