/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.35);
    --accent-soft: rgba(139, 92, 246, 0.12);
    --bg: #0b0b10;
    --bg-secondary: #12121c;
    --surface: #1a1a28;
    --surface-hover: #242436;
    --text: #f0eeeb;
    --text-secondary: #a8a4a0;
    --text-dim: #6b6763;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
    --bg: #f5f3f0;
    --bg-secondary: #eeebe6;
    --surface: #ffffff;
    --surface-hover: #f0eeeb;
    --text: #1a1714;
    --text-secondary: #6b6560;
    --text-dim: #a89e95;
    --glass: rgba(0, 0, 0, 0.04);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-hover: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.20);
}

[data-accent="blue"] {
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.35);
    --accent-soft: rgba(59, 130, 246, 0.12);
}
[data-accent="red"] {
    --accent: #ef4444;
    --accent-glow: rgba(239, 68, 68, 0.35);
    --accent-soft: rgba(239, 68, 68, 0.12);
}
[data-accent="green"] {
    --accent: #22c55e;
    --accent-glow: rgba(34, 197, 94, 0.35);
    --accent-soft: rgba(34, 197, 94, 0.12);
}
[data-accent="white"] {
    --accent: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.20);
    --accent-soft: rgba(255, 255, 255, 0.12);
}
[data-accent="black"] {
    --accent: #111111;
    --accent-glow: rgba(0, 0, 0, 0.20);
    --accent-soft: rgba(0, 0, 0, 0.12);
}

[data-font="serif"] {
    --font-family: 'Georgia', 'Times New Roman', serif;
}
[data-font="mono"] {
    --font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
[data-font="sans"] {
    --font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family, 'Inter', 'Segoe UI', system-ui, sans-serif);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.4s ease, color 0.4s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 999px;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================================
   GLASS MIXIN
   ============================================================ */
.glass {
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
#toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 28px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.30);
    background: #22c55e;
    color: #fff;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#toast.error {
    background: #ef4444;
}
#toast.info {
    background: #3b82f6;
}
#toast.warning {
    background: #f59e0b;
}

/* ============================================================
   DYNAMIC ISLAND
   ============================================================ */
#dynamicIsland {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    padding: 6px 18px 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.50);
    user-select: none;
    min-height: 36px;
}

#dynamicIsland:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: translateX(-50%) scale(1.02);
}

.island-logo {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.island-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.island-label {
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.island-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #22c55e;
    animation: pulse-dot 2s infinite;
}

.island-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.60);
    font-weight: 500;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

/* ============================================================
   ISLAND MENU
   ============================================================ */
#islandMenu {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%) scale(0.92) translateY(-8px);
    z-index: 9997;
    background: rgba(11, 11, 16, 0.92);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 12px 16px;
    min-width: 220px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
}

#islandMenu.open {
    opacity: 1;
    pointer-events: all;
    transform: translateX(-50%) scale(1) translateY(0);
}

.menu-item {
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item:hover {
    background: var(--glass-hover);
    color: var(--text);
}

.menu-item .menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 6px 0;
}

/* ============================================================
   SETTINGS PANEL
   ============================================================ */
#settingsPanel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: 9996;
    background: rgba(11, 11, 16, 0.94);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 28px 32px;
    max-width: 420px;
    width: 90%;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
    max-height: 85vh;
    overflow-y: auto;
}

#settingsPanel.open {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.settings-header h3 {
    font-size: 20px;
    font-weight: 800;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--glass-hover);
    color: var(--text);
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 8px;
}

.color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-options button {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-options button:hover {
    transform: scale(1.1);
}
.color-options button.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.font-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.font-options button {
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.font-options button:hover {
    background: var(--glass-hover);
    color: var(--text);
}
.font-options button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.theme-options {
    display: flex;
    gap: 8px;
}

.theme-options .btn-glass {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
}

.dev-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--glass);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.dev-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    overflow: hidden;
    border: 2px solid var(--accent);
    flex-shrink: 0;
}

.dev-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dev-info .dev-name {
    font-weight: 700;
    font-size: 15px;
}

.dev-info .dev-skill {
    font-size: 12px;
    color: var(--text-dim);
}

/* ============================================================
   LOGIN MODAL
   ============================================================ */
#loginModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9995;
    background: rgba(0, 0, 0, 0.60);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s ease;
}

#loginModal.active {
    opacity: 1;
    pointer-events: all;
}

.login-card {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    transform: scale(0.92) translateY(20px);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

#loginModal.active .login-card {
    transform: scale(1) translateY(0);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 800;
}

.login-header .login-sub {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 4px;
}

.login-header .close-btn {
    position: absolute;
    top: -8px;
    right: -8px;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--glass);
    border-radius: 10px;
    padding: 4px;
}

.login-tab {
    flex: 1;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.login-tab.active {
    background: var(--accent);
    color: #fff;
}

.login-tab:hover:not(.active) {
    background: var(--glass-hover);
    color: var(--text);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.input-group input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--text);
    font-size: 14px;
    transition: border 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input::placeholder {
    color: var(--text-dim);
}

.btn-login {
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
}

.login-register {
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
}

.login-register a {
    color: var(--accent);
    font-weight: 600;
}

.login-register a:hover {
    text-decoration: underline;
}

.btn-google {
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-google:hover {
    background: #f5f5f5;
}

/* ============================================================
   INSTALL BANNER
   ============================================================ */
#installBanner {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    background: rgba(11, 11, 16, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px 20px;
    display: none;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

#installBanner.show {
    display: flex;
}

.install-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.install-info strong {
    display: block;
    font-size: 14px;
}

.install-info small {
    color: var(--text-dim);
    font-size: 12px;
}

.btn-install {
    padding: 6px 20px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-install:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    padding: 4px 8px;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 10px 0;
    background: rgba(11, 11, 16, 0.70);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.3s;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}

.logo img {
    height: 32px;
    width: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.logo .accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--glass-hover);
}

.nav-links a.active {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--glass-hover);
    color: var(--text);
}

.btn-glass {
    padding: 6px 18px;
    border-radius: var(--radius-sm);
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-glass:hover {
    background: var(--glass-hover);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-accent:hover {
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-large {
    padding: 14px 32px;
    font-size: 15px;
}

.btn-login.logged-in {
    background: var(--glass);
    color: var(--text);
    border-color: var(--glass-border);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 4px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
    transition: all 0.3s;
}

/* ============================================================
   MAIN
   ============================================================ */
main {
    margin-top: 68px;
    padding: 20px 0 80px;
    min-height: calc(100vh - 140px);
}

.page {
    display: none;
    animation: fadeUp 0.4s ease both;
}

.page.active {
    display: block;
}

@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(18px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HERO
   ============================================================ */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    padding: 20px 0 30px;
}

.hero-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
    border: 1px solid var(--glass-border);
}

.hero-text h1 {
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 16px;
}

.hero-text h1 .gradient {
    background: linear-gradient(135deg, var(--accent), #a78bfa, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin-bottom: 24px;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image img {
    max-width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
}

/* ============================================================
   SECTION
   ============================================================ */
.section-wrap {
    margin-top: 32px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-head h2 {
    font-size: 1.4rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-head .pill {
    font-size: 0.55rem;
    background: var(--accent);
    padding: 2px 12px;
    border-radius: 999px;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-head a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color 0.2s;
}

.section-head a:hover {
    color: var(--accent);
}

.browse-tabs {
    display: flex;
    gap: 6px;
}

.browse-tabs .btn-glass {
    font-size: 12px;
    padding: 4px 14px;
}

/* ============================================================
   GRID CARDS
   ============================================================ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.card:hover {
    transform: translateY(-6px);
    background: var(--surface-hover);
    border-color: var(--accent);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.40);
}

.card-img {
    aspect-ratio: 2/3;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card:hover .card-img img {
    transform: scale(1.05);
}

.card-img .badge-ep {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-img .badge-status {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.20);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.20);
}

.card-img .btn-play-glass {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.60);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.20);
    color: #fff;
    font-size: 20px;
    opacity: 0;
    transition: all 0.3s ease;
}

.card:hover .btn-play-glass {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.card-body {
    padding: 12px 14px;
}

.card-body h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-body .meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.card-body .meta .dot {
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: var(--text-dim);
}

/* ============================================================
   EPISODE SCROLL
   ============================================================ */
.scroll-x {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.scroll-x::-webkit-scrollbar {
    height: 4px;
}

.ep-card {
    flex: 0 0 200px;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    scroll-snap-align: start;
    cursor: pointer;
}

.ep-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.ep-card .ep-img {
    aspect-ratio: 16/9;
    background: var(--bg-secondary);
    overflow: hidden;
    position: relative;
}

.ep-card .ep-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.ep-card:hover .ep-img img {
    transform: scale(1.04);
}

.ep-card .ep-info {
    padding: 10px 12px;
}

.ep-card .ep-info h4 {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ep-card .ep-info .ep-meta {
    font-size: 0.65rem;
    color: var(--text-dim);
}

/* ============================================================
   GENRE
   ============================================================ */
.genre-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.genre-tag {
    padding: 6px 18px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.genre-tag:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

/* ============================================================
   PROFILE
   ============================================================ */
.profile-card {
    max-width: 480px;
    margin: 0 auto;
    padding: 32px;
    border-radius: var(--radius);
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 999px;
    margin: 0 auto 12px;
    overflow: hidden;
    border: 2px solid var(--accent);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card h2 {
    font-size: 1.4rem;
    font-weight: 800;
}

.profile-card .sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 16px 0 24px;
}

.profile-stats .num {
    font-size: 1.3rem;
    font-weight: 800;
}

.profile-stats .label {
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* ============================================================
   DETAIL PAGE
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}

.detail-poster {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
}

.detail-poster img {
    width: 100%;
    display: block;
}

.detail-poster .btn-play-glass {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.60);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.20);
    color: #fff;
    font-size: 24px;
    transition: all 0.3s ease;
}

.detail-poster .btn-play-glass:hover {
    transform: translate(-50%, -50%) scale(1.05);
    background: var(--accent);
    border-color: var(--accent);
}

.detail-info h1 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 8px;
}

.rating-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.rating-section .stars {
    color: #fbbf24;
    font-size: 18px;
    letter-spacing: 1px;
}

.rating-section .rating-num {
    font-size: 1.3rem;
    font-weight: 800;
}

.rating-section .rating-count {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.genre-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.genre-list span {
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    font-size: 0.75rem;
}

.synopsis {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 12px 0;
}

/* ============================================================
   COMMENT SECTION
   ============================================================ */
.comment-section {
    margin-top: 24px;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
}

.comment-section textarea {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    color: var(--text);
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    font-size: 14px;
    transition: border 0.2s;
}

.comment-section textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-list {
    margin-top: 16px;
}

.comment-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--glass-border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-item .name {
    font-weight: 700;
    font-size: 0.85rem;
}

.comment-item .time {
    color: var(--text-dim);
    font-size: 0.7rem;
    margin-left: 8px;
}

.comment-item .text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ============================================================
   CHAT BUTTON
   ============================================================ */
.chat-float {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 80;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 8px 32px var(--accent-glow);
    transition: all 0.3s ease;
}

.chat-float:hover {
    transform: scale(1.08);
}

/* ============================================================
   CHAT PANEL
   ============================================================ */
#chatPanel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    z-index: 79;
    width: 360px;
    max-width: 90vw;
    max-height: 460px;
    background: rgba(11, 11, 16, 0.92);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 16px;
    display: none;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

#chatPanel.open {
    display: flex;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chat-header h4 {
    font-size: 1rem;
    font-weight: 700;
}

.chat-header button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    max-height: 300px;
}

.chat-messages .msg {
    padding: 6px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    background: var(--glass);
    font-size: 0.85rem;
}

.chat-messages .msg .user {
    font-weight: 700;
    color: var(--accent);
}

.chat-input {
    display: flex;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.85rem;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-input button {
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 700;
}

.chat-input button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   SWITCH WRAP
   ============================================================ */
.switch-wrap {
    text-align: center;
    margin-top: 32px;
}

.btn-switch {
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 700;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    border-top: 1px solid var(--glass-border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    background: var(--bg-secondary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-text p {
        margin: 0 auto 20px;
    }
    .hero-buttons {
        justify-content: center;
    }
    .hero-image {
        order: -1;
    }
    .hero-image img {
        max-width: 340px;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-poster {
        max-width: 280px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(11, 11, 16, 0.92);
        backdrop-filter: blur(20px);
        padding: 12px 20px;
        border-bottom: 1px solid var(--glass-border);
    }
    .nav-links.open {
        display: flex;
    }
    .nav-links a {
        padding: 10px 14px;
        width: 100%;
    }
    .hamburger {
        display: flex;
    }
    .header-actions .btn-glass:not(.btn-accent) {
        display: none;
    }
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    .ep-card {
        flex: 0 0 160px;
    }
    .island-label {
        font-size: 11px;
    }
    #islandMenu {
        min-width: 200px;
        padding: 12px 14px;
    }
    #settingsPanel {
        padding: 20px;
    }
    #chatPanel {
        right: 10px;
        width: calc(100vw - 20px);
        max-height: 380px;
        bottom: 80px;
    }
    #installBanner {
        padding: 8px 14px;
        flex-wrap: wrap;
        justify-content: center;
        top: 68px;
    }
    .profile-stats {
        gap: 20px;
    }
    .detail-poster {
        max-width: 220px;
    }
    .detail-info h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .ep-card {
        flex: 0 0 140px;
    }
    .container {
        padding: 0 12px;
    }
    .profile-stats {
        gap: 16px;
    }
    .profile-stats .num {
        font-size: 1.1rem;
    }
    #dynamicIsland {
        padding: 4px 12px 4px 8px;
        min-height: 30px;
    }
    .island-logo {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
    .island-label {
        font-size: 10px;
    }
    .island-time {
        font-size: 9px;
    }
}