/* ============================================
   OTAKIROKU - ANIME PAGE STYLES
   Page-specific styles only
   ============================================ */

/* === HERO SECTION === */
.hero-section {
    position: relative;
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 60px;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 8px;
    background: var(--primary-subtle);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    animation: fadeInUp 0.6s ease 0.1s forwards;
    opacity: 0;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    animation: fadeInUp 0.6s ease 0.2s forwards;
    opacity: 0;
}

/* Mobile-only elements - Hidden on desktop */
.mobile-only {
    display: none;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Search */
.hero-search {
    animation: fadeInUp 0.6s ease 0.3s forwards;
    opacity: 0;
}

.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-container input {
    width: 100%;
    padding: 16px 100px 16px 52px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.search-container input::placeholder {
    color: #9ca3af;
}

.search-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-subtle), 0 20px 40px -10px rgba(0, 0, 0, 0.3);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #9ca3af;
    pointer-events: none;
}

.search-shortcut {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}

.search-shortcut kbd {
    padding: 4px 8px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: #9ca3af;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* === TRANSLATE BUTTON (inside search input) === */
.search-action-btn.translate-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-action-btn.translate-btn:hover {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary);
}

.search-action-btn.translate-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.search-action-btn.translate-btn svg {
    width: 18px;
    height: 18px;
}

/* Undo mode - button changes appearance */
.search-action-btn.translate-btn.undo-mode {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-action-btn.translate-btn.undo-mode:hover {
    background: var(--primary-hover, #7c3aed);
    border-color: var(--primary-hover, #7c3aed);
}

/* === ADVANCED SEARCH BUTTON (outside search input) === */
.advanced-toggle-btn {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.advanced-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-subtle);
}

.advanced-toggle-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px var(--primary-subtle);
}

.advanced-toggle-btn svg {
    width: 22px;
    height: 22px;
}

.search-container {
    position: relative;
    flex: 1;
}

.search-container input {
    padding-right: 56px;
}

/* Clear search button */
.search-clear-btn {
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: none;
    border-radius: 50%;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.search-clear-btn svg {
    width: 14px;
    height: 14px;
}

/* === SEARCH ROW (Search + Mood Button) === */
.search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 560px;
    margin: 0 auto;
}

.search-row .search-container {
    flex: 1;
    max-width: none;
}

/* === ADVANCED SEARCH PANEL === */
.advanced-panel {
    display: none;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.advanced-panel.active { display: block; }

/* Header */
.adv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.adv-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.adv-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.adv-clear {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}
.adv-clear:hover { color: var(--primary); background: rgba(139,92,246,0.1); }
.adv-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.adv-close svg {
    width: 18px;
    height: 18px;
}
.adv-close:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* Active filters */
.adv-active {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(139,92,246,0.08);
    border-radius: 8px;
}
.active-tag {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}
.active-tag.include { background: rgba(34,197,94,0.15); color: #22c55e; }
.active-tag.exclude { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Selects row */
.adv-filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.adv-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.adv-filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.adv-filter-group select {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.adv-filter-group select:hover { 
    border-color: #9ca3af; 
}
.adv-filter-group select:focus { 
    outline: none; 
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}
.adv-filter-group.year-range {
    grid-column: span 1;
}
.year-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.year-inputs select {
    flex: 1;
    padding: 8px 10px;
    padding-right: 28px;
}
.year-sep {
    color: #9ca3af;
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    .adv-filters {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 450px) {
    .adv-filters {
        grid-template-columns: 1fr;
    }
}

/* Tabs */
.adv-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}
.adv-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #9ca3af;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.adv-tab:hover { color: var(--text-primary); }
.adv-tab.active {
    color: var(--primary);
    background: rgba(139,92,246,0.1);
    border-color: rgba(139,92,246,0.3);
}

/* Tab content */
.adv-content { margin-bottom: 12px; }
.adv-pane { display: none; }
.adv-pane.active { display: block; }

/* Tags grid */
.ftags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}
.ftags::-webkit-scrollbar { width: 4px; }
.ftags::-webkit-scrollbar-track { background: transparent; }
.ftags::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.ftags::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Explicit genres section */
.ftags-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.ftags-section .ftags {
    max-height: none;
    overflow: visible;
}
.ftags-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.ftag {
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}
.ftag:hover {
    border-color: #9ca3af;
    color: var(--text-primary);
}
.ftag.include {
    background: rgba(34,197,94,0.15);
    border-color: rgba(34,197,94,0.4);
    color: #22c55e;
}
.ftag.exclude {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.4);
    color: #ef4444;
}

/* Studio search */
.studio-search {
    width: 100%;
    padding: 6px 10px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.studio-search:focus { outline: none; border-color: var(--primary); }
.studio-search::placeholder { color: #9ca3af; }

/* Footer */
.adv-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.adv-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.7rem;
    color: #9ca3af;
}
.leg-inc, .leg-exc {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}
.leg-inc { background: #22c55e; }
.leg-exc { background: #ef4444; }
.adv-sort {
    display: flex;
    align-items: center;
    gap: 6px;
}
.adv-sort select {
    padding: 5px 8px;
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
}
.adv-sort select:focus { outline: none; border-color: var(--primary); }
.adv-apply {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.adv-apply:hover { background: var(--primary-hover); }

/* Responsive */
@media (max-width: 600px) {
    .adv-selects select { min-width: 70px; font-size: 0.75rem; }
    .adv-footer { flex-direction: column; gap: 10px; }
    .adv-legend { order: 2; }
    .adv-sort { order: 1; }
}

/* === MAIN CONTENT === */
.main-content {
    position: relative;
    z-index: 1;
    padding-bottom: 80px;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Browse Mode Toggle (Entries vs Series) */
.browse-mode-toggle {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 8px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn svg {
    width: 18px;
    height: 18px;
}

.mode-btn:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.mode-btn.active {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.mode-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

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

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab svg {
    width: 16px;
    height: 16px;
}

.tab:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.tab.active {
    color: var(--text-primary);
    background: var(--primary);
    border-color: var(--primary);
}

/* Mobile type dropdown - hidden on desktop */
.type-dropdown-mobile {
    display: none;
}

.type-dropdown-mobile select {
    padding: 8px 32px 8px 12px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-height: 36px;
    transition: all 0.2s ease;
}

.type-dropdown-mobile select:hover {
    border-color: var(--border-hover);
}

.type-dropdown-mobile select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-dropdown select {
    padding: 10px 36px 10px 14px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
}

.sort-dropdown select:hover {
    border-color: var(--border-hover);
}

.sort-dropdown select:focus {
    outline: none;
    border-color: var(--primary);
}

.view-switcher {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}

.view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

.view-btn:hover {
    color: var(--text-secondary);
}

.view-btn.active {
    color: var(--text-primary);
    background: var(--primary);
}

/* Results Bar */
.results-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.results-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.count-number {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.count-label {
    font-size: 0.9rem;
    color: #9ca3af;
}

.clear-filters-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.clear-filters-btn svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   GRID VIEW
   ============================================ */
.media-grid.view-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
}

@media (max-width: 1400px) { .media-grid.view-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1100px) { .media-grid.view-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }
@media (max-width: 850px) { .media-grid.view-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (max-width: 550px) { .media-grid.view-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
@media (max-width: 400px) { .media-grid.view-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }

/* Grid view uses .oku-card from shared style.css */
.media-grid.view-grid .oku-card {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: var(--delay);
    opacity: 0;
}

.media-grid.view-grid {
    overflow: visible;
}

/* ============================================
   EXPANDED VIEW (oku-card with panels always open)
   ============================================ */
.media-grid.view-expanded {
    display: grid;
    grid-template-columns: repeat(auto-fill, 190px);
    gap: 1.5rem calc(266px + 1.5rem);
    overflow: visible;
}

/* In expanded view, slide panels are always visible */
.media-grid.view-expanded .oku-card-slide {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    left: 100%;
}

/* No image shift needed since panels are always open */
.media-grid.view-expanded .oku-card:hover .oku-card-image {
    transform: none;
}
.media-grid.view-expanded .oku-card:hover .oku-card-slide {
    left: 100%;
}

/* Slide-left variant stays consistent */
.media-grid.view-expanded .oku-card.slide-left .oku-card-slide {
    right: 100%;
}
.media-grid.view-expanded .oku-card.slide-left:hover .oku-card-slide {
    right: 100%;
}
.media-grid.view-expanded .oku-card.slide-left:hover .oku-card-image {
    transform: none;
}

@media (max-width: 1400px) {
    .media-grid.view-expanded { grid-template-columns: repeat(auto-fill, 170px); }
}
@media (max-width: 768px) {
    /* On mobile, fall back to a simple grid since slide panels are hidden */
    .media-grid.view-expanded {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
}

/* ============================================
   LIST VIEW
   ============================================ */
.media-grid.view-list {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.list-row {
    display: grid;
    grid-template-columns: 50px 60px 1fr 100px 120px;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
    animation: fadeInUp 0.4s ease forwards;
    animation-delay: var(--delay);
    opacity: 0;
}

.list-row:last-child {
    border-bottom: none;
}

.list-row:hover {
    background: var(--bg-hover);
}

.row-rank {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: #9ca3af;
    text-align: center;
}

.row-poster {
    width: 60px;
    height: 85px;
    border-radius: 6px;
    overflow: hidden;
}

.row-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.row-info {
    min-width: 0;
}

.row-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.row-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.row-score {
    text-align: center;
}

.score-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--success);
}

.score-users {
    font-size: 0.7rem;
    color: #9ca3af;
}

.row-format, .row-season {
    text-align: center;
}

.format-type, .season-text {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.format-eps, .season-status {
    font-size: 0.7rem;
    color: #9ca3af;
}

@media (max-width: 900px) {
    .list-row {
        grid-template-columns: 40px 50px 1fr 80px;
        gap: 16px;
        padding: 12px 16px;
    }
    .row-season { display: none; }
}

@media (max-width: 600px) {
    .list-row {
        grid-template-columns: 45px 1fr;
        gap: 12px;
    }
    .row-rank { display: none; }
    .row-poster { width: 45px; height: 64px; }
}

/* ============================================
   GENRE PILLS
   ============================================ */
.genre {
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.genre.action { background: rgba(239, 68, 68, 0.12); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.genre.comedy { background: rgba(250, 204, 21, 0.12); color: #fbbf24; border-color: rgba(250, 204, 21, 0.2); }
.genre.drama { background: rgba(168, 85, 247, 0.12); color: #c084fc; border-color: rgba(168, 85, 247, 0.2); }
.genre.adventure { background: rgba(34, 197, 94, 0.12); color: #4ade80; border-color: rgba(34, 197, 94, 0.2); }
.genre.fantasy { background: rgba(59, 130, 246, 0.12); color: #60a5fa; border-color: rgba(59, 130, 246, 0.2); }
.genre.scifi { background: rgba(6, 182, 212, 0.12); color: #22d3ee; border-color: rgba(6, 182, 212, 0.2); }
.genre.romance { background: rgba(236, 72, 153, 0.12); color: #f472b6; border-color: rgba(236, 72, 153, 0.2); }
.genre.horror { background: rgba(185, 28, 28, 0.15); color: #fca5a5; border-color: rgba(185, 28, 28, 0.25); }
.genre.supernatural { background: rgba(var(--primary-rgb), 0.12); color: var(--primary-light); border-color: rgba(var(--primary-rgb), 0.2); }
.genre.mystery { background: rgba(79, 70, 229, 0.12); color: #818cf8; border-color: rgba(79, 70, 229, 0.2); }

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */
.loader-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
    color: #9ca3af;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton-card .skeleton,
.skeleton-card-horizontal .skeleton,
.skeleton-list-item .skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 2/3;
    margin-bottom: 12px;
}

.skeleton-title {
    height: 16px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-meta {
    height: 12px;
    width: 50%;
}

/* Card view skeletons */
.skeleton-card-horizontal {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.skeleton-image-h {
    width: 120px;
    height: 170px;
    flex-shrink: 0;
}

.skeleton-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-title-h {
    height: 20px;
    width: 70%;
}

.skeleton-meta-h {
    height: 14px;
    width: 40%;
}

.skeleton-desc {
    height: 60px;
    width: 100%;
}

/* List view skeletons */
.skeleton-list-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.skeleton-image-list {
    width: 50px;
    height: 70px;
    flex-shrink: 0;
}

.skeleton-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: #9ca3af;
    opacity: 0.5;
}

.empty-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: #9ca3af;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    /* Match character/staff page layout */
    .hero-section {
        padding: 70px 12px 0;
        min-height: auto;
    }

    .hero-content {
        padding-top: 10px;
        max-width: none;
        text-align: center;
    }

    /* Hide desktop hero text on mobile */
    .hero-title,
    .hero-subtitle,
    .hero-badge {
        display: none;
    }

    /* Show mobile header - match character/staff pages exactly */
    .mobile-only {
        display: block;
    }

    .search-header {
        text-align: center;
        margin-bottom: 20px;
    }

    .search-header h1 {
        font-family: var(--font-display);
        font-size: 1.75rem;
        font-weight: 800;
        color: var(--text-primary);
        line-height: 1.2;
        letter-spacing: normal;
        margin-bottom: 10px;
    }

    /* Search box styling to match character/staff pages */
    .hero-search {
        margin-bottom: 16px;
        padding: 0 12px;
    }

    .search-row {
        display: flex;
        align-items: center;
        gap: 10px;
        max-width: 500px;
        margin: 0 auto;
    }

    .search-container {
        position: relative;
        display: flex;
        align-items: center;
        gap: 14px;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 12px 16px;
        flex: 1;
        min-width: 0;
    }

    .search-container input {
        flex: 1;
        padding: 0 44px 0 0;
        font-size: 16px; /* Prevent iOS zoom */
        border-radius: 0;
        background: transparent;
        border: none;
    }

    .search-icon {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    .search-shortcut {
        display: none;
    }

    .search-clear-btn {
        position: absolute;
        right: 48px;
        top: 50%;
        transform: translateY(-50%);
        width: 28px;
        height: 28px;
    }

    /* Translate button inside search */
    .search-action-btn.translate-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
        right: 8px;
    }

    .search-action-btn.translate-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Advanced search button outside */
    .advanced-toggle-btn {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .advanced-toggle-btn svg {
        width: 20px;
        height: 20px;
    }

    .results-page {
        padding-bottom: 100px;
    }

    .detail-body {
        padding-bottom: 100px;
    }

    .content-container {
        padding: 0 12px;
    }

    /* ===== Browse Mode Toggle (Entries/Series) - Compact ===== */
    .browse-mode-toggle {
        display: flex;
        gap: 6px;
        padding: 4px 0;
        margin-bottom: 6px;
    }

    .mode-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 12px;
        font-size: 0.75rem;
        border-radius: 8px;
        min-height: 36px;
        gap: 6px;
    }

    .mode-btn svg {
        width: 14px;
        height: 14px;
    }

    .mode-badge {
        font-size: 0.5rem;
        padding: 1px 4px;
    }

    /* ===== Filter Bar - Single Row Compact ===== */
    .filter-bar {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        padding: 6px 0;
        margin-bottom: 10px;
        border-bottom: none;
    }

    /* ===== Hide Desktop Tabs, Show Mobile Dropdown ===== */
    .filter-tabs {
        display: none !important;
    }

    .type-dropdown-mobile {
        display: block;
        flex-shrink: 0;
    }

    /* ===== Unified Dropdown Styling for Mobile ===== */
    .type-dropdown-mobile select,
    .sort-dropdown select {
        padding: 8px 30px 8px 12px;
        font-size: 0.8rem;
        font-weight: 500;
        color: var(--text-primary);
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        min-height: 36px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
        background-size: 10px;
        appearance: none;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .type-dropdown-mobile select:focus,
    .sort-dropdown select:focus {
        border-color: var(--primary);
        outline: none;
    }

    /* ===== Filter Actions - Compact ===== */
    .filter-actions {
        display: flex;
        gap: 6px;
        align-items: center;
        flex-shrink: 0;
        margin-left: auto;
    }

    /* ===== Sort Dropdown - Compact ===== */
    .sort-dropdown {
        flex-shrink: 0;
    }

    .sort-dropdown label {
        display: none;
    }

    /* ===== View Switcher - Compact ===== */
    .view-switcher {
        flex-shrink: 0;
        padding: 2px;
        border-radius: 6px;
        gap: 1px;
    }

    .view-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        border-radius: 4px;
    }

    .view-btn svg {
        width: 14px;
        height: 14px;
    }

    /* ===== Results Bar - Minimal ===== */
    .results-bar {
        margin-bottom: 10px;
        gap: 10px;
    }

    .count-number {
        font-size: 1rem;
    }

    .count-label {
        font-size: 0.7rem;
    }

    .clear-filters-btn {
        padding: 6px 10px;
        font-size: 0.65rem;
        min-height: 28px;
    }

    /* ===== Series Filter Bar ===== */
    #seriesFilterBar {
        padding: 6px 0;
        margin-bottom: 10px;
    }

    #seriesFilterBar .filter-actions {
        width: auto;
    }

    #seriesFilterBar .sort-dropdown label {
        display: none;
    }
}

/* ===== Extra Small Mobile (480px) ===== */
@media (max-width: 480px) {
    /* Hero - Match character/staff pages */
    .hero-section {
        padding: 70px 10px 0;
    }

    .search-header h1 {
        font-size: 1.4rem;
    }

    .search-container {
        padding: 10px 14px;
    }

    .search-container input {
        font-size: 16px; /* Prevent iOS zoom */
    }

    .search-clear-btn {
        right: 42px;
        width: 24px;
        height: 24px;
    }

    .search-clear-btn svg {
        width: 12px;
        height: 12px;
    }

    /* Translate button - smaller on 480px */
    .search-action-btn.translate-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        right: 6px;
    }

    .search-action-btn.translate-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Advanced search button outside - smaller on 480px */
    .advanced-toggle-btn {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    .advanced-toggle-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Browse Mode Toggle - Even more compact */
    .browse-mode-toggle {
        gap: 4px;
    }

    .mode-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        min-height: 32px;
        gap: 4px;
    }

    .mode-btn svg {
        width: 12px;
        height: 12px;
    }

    .mode-badge {
        display: none;
    }

    /* Both Dropdowns - Ultra compact but consistent */
    .type-dropdown-mobile select,
    .sort-dropdown select {
        padding: 6px 26px 6px 10px;
        font-size: 0.75rem;
        min-height: 32px;
        border-radius: 6px;
    }

    /* View Switcher - Ultra compact */
    .view-switcher {
        padding: 2px;
    }

    .view-btn {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
    }

    .view-btn svg {
        width: 12px;
        height: 12px;
    }

    /* Results Bar - Minimal */
    .results-bar {
        margin-bottom: 8px;
    }

    .count-number {
        font-size: 0.9rem;
    }

    .count-label {
        font-size: 0.65rem;
    }

    .clear-filters-btn {
        padding: 4px 8px;
        font-size: 0.6rem;
        min-height: 24px;
    }
}


/* ============================================
   DETAIL VIEW STYLES - OTAKIROKU STYLE
   ============================================ */

.detail-view {
    padding-top: 0; /* Banner starts from top, behind navbar */
}

/* Loading & Error States */
.detail-loading,
.detail-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    gap: 16px;
    padding: 100px 24px;
}

.detail-error {
    display: none;
}

.error-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: #9ca3af;
}

.error-icon svg {
    width: 40px;
    height: 40px;
}

.detail-error h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-primary);
}

.detail-error p {
    color: #9ca3af;
}

/* === BANNER === */
.detail-banner {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center 20%;
    background-color: var(--bg-surface);
}

.detail-banner .back-btn {
    position: absolute;
    top: 70px;
    left: 24px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.detail-banner .back-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}

.detail-banner .back-btn svg {
    width: 18px;
    height: 18px;
}

.detail-banner.banner-blur {
    background-size: 200%;
    background-position: center;
}

.detail-banner.banner-blur::before {
    content: '';
    position: absolute;
    inset: 0;
    backdrop-filter: blur(40px);
    background: rgba(10, 10, 15, 0.4);
}

.detail-banner .banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, 
        rgba(10, 10, 15, 0.3) 0%,
        rgba(10, 10, 15, 0.6) 50%,
        var(--bg-deep) 100%
    );
}

/* === HEADER SECTION === */
.detail-header {
    position: relative;
    margin-top: -200px;
    z-index: 10;
    padding: 0 24px;
}

.header-container {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    gap: 32px;
}

.header-poster {
    flex-shrink: 0;
    width: 220px;
}

.header-poster img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.poster-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.btn-add-list {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-add-list:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--primary-glow);
}

.btn-add-list svg {
    width: 18px;
    height: 18px;
}

.btn-add-list.in-list {
    background: var(--success, #22c55e);
    box-shadow: none;
    cursor: default;
}

.btn-add-list.in-list:hover {
    background: var(--success, #22c55e);
    transform: none;
    box-shadow: none;
}

.btn-favorite {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-favorite:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.btn-favorite.active {
    background: rgba(255, 107, 107, 0.15);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.btn-favorite.active svg {
    fill: #ff6b6b;
}

.btn-favorite svg {
    width: 22px;
    height: 22px;
}

.header-info {
    flex: 1;
    padding-top: 120px;
    min-width: 0;
}

.title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.detail-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}

.title-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(var(--primary-rgb), 0.15);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 20px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 8px;
}

.title-toggle-btn:hover {
    background: rgba(var(--primary-rgb), 0.25);
    border-color: var(--primary);
}

.title-toggle-btn svg {
    width: 14px;
    height: 14px;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.header-meta .dot {
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
}

.header-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.genre {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.genre:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.header-synopsis {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-height: 9.5em;
    overflow: hidden;
    position: relative;
    transition: max-height 0.4s ease;
}

.header-synopsis:not(.expanded):not(.no-truncate) {
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.header-synopsis.expanded {
    max-height: 4000px;
}

/* No truncation needed for short synopses */
.header-synopsis.no-truncate {
    max-height: none;
}

.header-synopsis.no-truncate::after {
    display: none;
}

.synopsis-toggle {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.synopsis-toggle:hover {
    background: var(--primary-subtle);
    border-color: var(--primary);
}

.synopsis-toggle:active {
    transform: scale(0.98);
}

/* === BODY SECTION === */
.detail-body {
    background: transparent;
    padding: 40px 24px 80px;
    position: relative;
}

/* Add spotlight effect to detail view */
.detail-view {
    padding-top: 0;
    background: var(--bg-deep);
    min-height: 100vh;
}

.detail-view::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: radial-gradient(ellipse 100% 80% at 50% 0%, rgba(var(--primary-rgb), 0.18), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.detail-view > * {
    position: relative;
    z-index: 1;
}

.body-container {
    max-width: var(--max-w);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
}

/* === SIDEBAR === */
.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

/* Contribute Section - blends with other sidebar sections */
.sidebar-contribute {
    padding: 16px;
}

.sidebar-contribute h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.btn-suggest-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-suggest-edit svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.btn-suggest-edit:hover {
    background: var(--bg-hover);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

.btn-suggest-edit:hover svg {
    color: var(--text-secondary);
}

.contribute-hint {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 8px;
    line-height: 1.4;
}

.data-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

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

.data-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.data-value {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.data-value.rating-adult {
    color: #ef4444;
    font-weight: 600;
}

.rating-count {
    font-size: 0.8rem;
    color: #9ca3af;
    font-weight: 400;
}

.data-genres a {
    display: inline-block;
    color: var(--primary);
    margin-right: 6px;
    transition: color 0.2s;
}

.data-genres a:hover {
    color: var(--primary-hover);
}

/* === MAIN CONTENT === */
.detail-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Content Tabs */
.content-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
}

.content-tabs .tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
}

.content-tabs .tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.content-tabs .tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.content-tabs .tab svg {
    width: 18px;
    height: 18px;
}

.content-section h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

/* === RELATIONS === */
.relations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.relation-card {
    display: flex;
    gap: 16px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s var(--ease-out);
}

.relation-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.relation-img {
    width: 70px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.relation-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.relation-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.relation-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.relation-format {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* === CHARACTERS === */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.character-card {
    display: flex;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s var(--ease-out);
}

.character-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.char-side,
.va-side {
    display: flex;
    gap: 12px;
    padding: 10px;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.char-side:hover .char-name,
.va-side:hover .va-name {
    color: var(--primary);
}

.va-side {
    text-align: right;
    flex-direction: row-reverse;
}

.char-img,
.va-img {
    width: 58px;
    height: 82px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.va-img-placeholder {
    width: 58px;
    height: 82px;
    background: var(--bg-surface);
    border-radius: 8px;
}

.char-info,
.va-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.va-info {
    align-items: center;
}

.char-name,
.va-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.char-role {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
}

.va-lang {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* === STAFF === */
.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.staff-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s var(--ease-out);
    text-decoration: none;
}

.staff-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.staff-avatar {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-subtle), var(--bg-surface));
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--primary);
    flex-shrink: 0;
}

.staff-avatar svg {
    width: 24px;
    height: 24px;
}

.staff-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.staff-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

.staff-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.staff-card:hover .staff-name {
    color: var(--primary);
}

.staff-role {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* === TAGS === */
.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tag-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.tag-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tag-rank {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

/* === RECOMMENDATIONS === */
.recs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.recs-header h2 {
    margin: 0;
}

.recs-tabs {
    display: flex;
    gap: 8px;
}

.recs-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.recs-tab:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.recs-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.recs-tab .gem-icon {
    width: 14px;
    height: 14px;
}

.recs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    overflow: visible;
}

.recs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

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

.rec-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    transition: transform 0.2s var(--ease-out);
}

.rec-card:hover {
    transform: translateY(-4px);
}

.rec-img-wrap {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rec-card:hover .rec-img-wrap {
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.rec-img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.rec-format {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #e5e7eb;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rec-match {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
}

.rec-score {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 8px 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    font-size: 0.8rem;
    font-weight: 600;
    color: #facc15;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rec-score svg {
    width: 12px;
    height: 12px;
    fill: #facc15;
}

.rec-gem-badge {
    position: absolute;
    top: 28px;
    right: 6px;
    font-size: 0.85rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* If no match badge, move gem to top */
.rec-card:not(:has(.rec-match)) .rec-gem-badge {
    top: 6px;
}

.rec-card.hidden-gem .rec-img-wrap {
    border-color: rgba(var(--primary-rgb), 0.4);
}

.rec-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 8px;
}

.rec-card:hover .rec-title {
    color: var(--primary);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .detail-header {
        padding: 0 16px;
    }

    .header-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .header-poster {
        width: 180px;
    }

    .header-info {
        padding-top: 24px;
    }

    .detail-body {
        padding: 30px 16px 60px;
    }

    .body-container {
        grid-template-columns: 1fr;
    }

    .detail-sidebar {
        order: 2;
    }

    .detail-content {
        order: 1;
    }

    .characters-grid,
    .staff-grid,
    .relations-grid {
        grid-template-columns: 1fr;
    }
}

/* === TABLET - 768px === */
@media (max-width: 768px) {
    /* Banner - compact for mobile */
    .detail-banner {
        height: 200px;
    }

    .detail-banner .back-btn {
        top: 16px;
        left: 12px;
        padding: 10px 14px;
        font-size: 0.8rem;
        min-height: 44px;
        min-width: 44px;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(8px);
        border-radius: 10px;
    }

    .detail-banner .back-btn span {
        display: none;
    }

    /* Header - compact stacked layout */
    .detail-header {
        margin-top: -80px;
        padding: 0 12px;
    }

    .header-container {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 16px;
    }

    /* Poster - compact */
    .header-poster {
        width: 100px;
        flex-shrink: 0;
    }

    .header-poster img {
        border-radius: 8px;
    }

    /* Hide poster actions on mobile - move to sticky footer */
    .poster-actions {
        display: none;
    }

    /* Completion prediction - hide on mobile */
    .completion-prediction {
        display: none !important;
    }

    /* Next franchise prompt - hide on mobile */
    .next-franchise-prompt {
        display: none !important;
    }

    /* Info section */
    .header-info {
        padding-top: 0;
        width: 100%;
        flex: 1;
    }

    .title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .detail-title {
        font-size: 1.25rem;
        text-align: left;
        line-height: 1.3;
    }

    .title-toggle-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .title-toggle-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Synopsis - expandable */
    .header-synopsis {
        font-size: 0.8rem;
        line-height: 1.5;
        max-height: 72px;
        overflow: hidden;
        position: relative;
        transition: max-height 0.3s ease;
    }

    .header-synopsis.expanded {
        max-height: 2000px;
    }

    /* Synopsis expand button */
    .synopsis-toggle {
        display: inline-block;
        margin-top: 6px;
        padding: 6px 12px;
        background: var(--bg-elevated);
        border: 1px solid var(--border);
        border-radius: 6px;
        color: var(--primary);
        font-size: 0.75rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .synopsis-toggle:active {
        transform: scale(0.98);
    }

    /* Meta info */
    .header-meta {
        justify-content: flex-start;
        flex-wrap: wrap;
        font-size: 0.75rem;
        gap: 8px;
        margin-top: 8px;
    }

    .header-genres {
        justify-content: flex-start;
        gap: 4px;
        margin-top: 8px;
    }

    .genre {
        font-size: 0.65rem;
        padding: 3px 8px;
        border-radius: 4px;
    }

    /* Floating Action Bar for mobile */
    .detail-header::after {
        content: '';
        display: block;
        clear: both;
    }

    /* Detail body */
    .detail-body {
        padding: 20px 12px 140px;
    }

    .body-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-sidebar {
        order: 2;
    }

    .detail-content {
        order: 1;
        gap: 24px;
    }

    /* Sidebar sections - compact */
    .sidebar-section {
        padding: 14px;
        border-radius: 10px;
    }

    .sidebar-section h3 {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }

    .data-row {
        padding: 8px 0;
        font-size: 0.8rem;
    }

    /* Content sections */
    .content-section {
        padding: 0;
    }

    .content-section h2 {
        font-size: 1.1rem;
        margin-bottom: 14px;
    }

    /* Content tabs - horizontal scroll */
    .content-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 16px;
        border-bottom: 1px solid var(--border);
        padding-bottom: 0;
        gap: 0;
    }

    .content-tabs::-webkit-scrollbar {
        display: none;
    }

    .content-tabs .tab {
        padding: 10px 14px;
        font-size: 0.8rem;
        min-height: 44px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .content-tabs .tab svg {
        width: 16px;
        height: 16px;
    }

    /* Series section needs overflow visible for scrolling */
    #seriesSection {
        overflow: visible !important;
    }

    /* Series grid - horizontal scroll with fade indicator */
    .series-timeline {
        position: relative;
        overflow: visible;
    }

    .series-timeline::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 40px;
        height: calc(100% - 40px); /* Don't cover the Show more button */
        background: linear-gradient(to left, var(--bg-primary), transparent);
        pointer-events: none;
        z-index: 1;
    }

    .series-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 10px !important;
        padding: 4px 4px 12px 4px !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
        margin-right: -16px;
        padding-right: 40px;
    }

    .series-grid::-webkit-scrollbar {
        display: none;
    }

    .series-grid .series-card {
        flex: 0 0 85px !important;
        width: 85px !important;
        min-width: 85px !important;
        scroll-snap-align: start;
    }

    .series-grid .series-card-image {
        aspect-ratio: 2/3;
    }

    .series-grid .series-card-title {
        font-size: 0.6rem;
        -webkit-line-clamp: 2;
    }

    .series-grid .series-card-meta,
    .series-grid .series-card-status {
        font-size: 0.5rem;
    }

    .series-grid .series-relation {
        font-size: 0.5rem;
        padding: 2px 4px;
    }

    .series-show-more {
        position: relative;
        z-index: 2;
        width: 100%;
        margin-top: 8px;
    }

    /* Grids - horizontal scroll for better mobile UX */
    .characters-grid,
    .staff-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        padding-bottom: 8px;
        grid-template-columns: none;
        scrollbar-width: none;
    }

    .characters-grid::-webkit-scrollbar,
    .staff-grid::-webkit-scrollbar {
        display: none;
    }

    .character-card,
    .staff-card {
        flex: 0 0 160px;
        scroll-snap-align: start;
        max-width: 180px;
        padding: 8px;
        border-radius: 8px;
    }

    .character-card .char-img,
    .staff-card .staff-img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }

    .character-card .char-name,
    .staff-card .staff-name {
        font-size: 0.75rem;
    }

    .character-card .char-role,
    .staff-card .staff-role,
    .character-card .va-name {
        font-size: 0.65rem;
    }

    /* Relations grid - horizontal scroll */
    .relations-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        padding-bottom: 8px;
        scrollbar-width: none;
    }

    .relations-grid::-webkit-scrollbar {
        display: none;
    }

    .relation-card {
        flex: 0 0 180px;
        scroll-snap-align: start;
        padding: 8px;
        border-radius: 8px;
    }

    .relation-img {
        width: 40px;
        height: 56px;
        border-radius: 4px;
    }

    .relation-info h4 {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .relation-type {
        font-size: 0.6rem;
    }

    /* Recommendations - Fixed Grid */
    .recs-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .recs-tabs {
        width: 100%;
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding-bottom: 4px;
    }

    .recs-tabs::-webkit-scrollbar {
        display: none;
    }

    .recs-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 0.7rem;
        min-height: 36px;
        border-radius: 6px;
    }

    .recs-tab svg {
        width: 14px;
        height: 14px;
    }

    .recs-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px;
        max-width: 100%;
        overflow: hidden;
    }

    .rec-card {
        border-radius: 6px;
        overflow: hidden;
        max-width: 100%;
    }

    .rec-card img {
        width: 100%;
        aspect-ratio: 2/3;
        object-fit: cover;
    }

    .rec-title {
        font-size: 0.65rem;
        padding: 6px 4px;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .rec-match {
        font-size: 0.55rem;
    }

    /* Tags - Wrap properly */
    .tags-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        max-width: 100%;
    }

    .tag-item {
        flex: 0 0 auto;
        padding: 5px 10px;
        border-radius: 6px;
        max-width: 100%;
    }

    .tag-name {
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tag-percent {
        font-size: 0.6rem;
    }

    /* Reviews - Proper overflow handling */
    .reviews-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .btn-write-review {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        font-size: 0.85rem;
    }

    .reviews-list {
        max-width: 100%;
        overflow: hidden;
    }

    .review-card {
        padding: 12px;
        border-radius: 10px;
        max-width: 100%;
        overflow: hidden;
    }

    .review-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .review-author-avatar {
        width: 36px;
        height: 36px;
    }

    .review-author-name {
        font-size: 0.8rem;
    }

    .review-date {
        font-size: 0.65rem;
    }

    .review-title {
        font-size: 0.9rem;
    }

    .review-text {
        font-size: 0.8rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .review-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .review-actions button {
        font-size: 0.7rem;
        padding: 6px 10px;
    }

    /* Content sections - prevent overflow */
    .content-section {
        padding: 0;
        overflow: hidden;
        max-width: 100%;
    }
}

/* === MOBILE - 600px === */
@media (max-width: 600px) {
    /* Banner - even shorter */
    .detail-banner {
        height: 160px;
    }

    .detail-header {
        margin-top: -60px;
    }

    /* Poster - smaller */
    .header-poster {
        width: 85px;
    }

    /* Title */
    .detail-title {
        font-size: 1.1rem;
    }

    /* Synopsis - even more compact */
    .header-synopsis {
        font-size: 0.78rem;
        max-height: 66px;
    }

    /* Meta */
    .header-meta {
        font-size: 0.7rem;
        gap: 6px;
    }

    .genre {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    /* Content */
    .detail-body {
        padding: 16px 10px 100px;
    }

    .body-container {
        gap: 16px;
    }

    .detail-content {
        gap: 20px;
    }

    .content-section h2 {
        font-size: 1rem;
    }

    /* Character cards - smaller in scroll */
    .character-card,
    .staff-card {
        flex: 0 0 150px;
        padding: 7px;
    }

    .character-card .char-img,
    .staff-card .staff-img {
        width: 38px;
        height: 38px;
    }

    /* Relation cards */
    .relation-card {
        flex: 0 0 170px;
        padding: 7px;
    }

    /* Series grid - smaller cards at 600px */
    .series-grid .series-card {
        flex: 0 0 80px !important;
        width: 80px !important;
        min-width: 80px !important;
    }

    /* Recommendations - 3 columns still but tighter */
    .recs-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .rec-title {
        font-size: 0.65rem;
        padding: 5px 3px;
    }

    /* Sidebar */
    .sidebar-section {
        padding: 12px;
    }

    .data-row {
        font-size: 0.75rem;
        padding: 6px 0;
    }
}

/* === EXTRA SMALL - 480px === */
@media (max-width: 480px) {
    .detail-banner {
        height: 140px;
    }

    .detail-banner .back-btn {
        top: 12px;
        left: 10px;
        padding: 8px 12px;
    }

    .detail-header {
        margin-top: -50px;
        padding: 0 10px;
    }

    .header-container {
        gap: 12px;
    }

    .header-poster {
        width: 75px;
    }

    .detail-title {
        font-size: 1rem;
    }

    .title-toggle-btn {
        padding: 5px 8px;
        font-size: 0.65rem;
    }

    .header-synopsis {
        font-size: 0.75rem;
        max-height: 3em;
    }

    .header-meta {
        font-size: 0.65rem;
    }

    .genre {
        font-size: 0.55rem;
    }

    .detail-body {
        padding: 14px 8px 140px;
    }

    .content-section h2 {
        font-size: 0.95rem;
    }

    .content-tabs .tab {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .character-card,
    .staff-card {
        flex: 0 0 140px;
        padding: 6px;
    }

    .character-card .char-img,
    .staff-card .staff-img {
        width: 36px;
        height: 36px;
    }

    .character-card .char-name,
    .staff-card .staff-name {
        font-size: 0.7rem;
    }

    .character-card .char-role,
    .staff-card .staff-role,
    .character-card .va-name {
        font-size: 0.6rem;
    }

    .relation-card {
        flex: 0 0 160px;
        padding: 6px;
    }

    .relation-img {
        width: 35px;
        height: 50px;
    }

    .relation-info h4 {
        font-size: 0.65rem;
    }

    .relation-type {
        font-size: 0.55rem;
    }

    /* Series grid - even smaller at 480px */
    .series-grid .series-card {
        flex: 0 0 72px !important;
        width: 72px !important;
        min-width: 72px !important;
    }

    .series-grid .series-card-title {
        font-size: 0.55rem !important;
    }

    .series-grid .series-relation {
        font-size: 0.45rem !important;
    }

    .recs-grid {
        gap: 5px;
    }

    .rec-title {
        font-size: 0.6rem;
        padding: 4px 3px;
    }

    .recs-tab {
        padding: 6px 10px;
        font-size: 0.65rem;
    }

    /* Tags */
    .tag-item {
        padding: 4px 8px;
    }

    .tag-name {
        font-size: 0.65rem;
    }

    .tag-percent {
        font-size: 0.55rem;
    }

    /* Reviews */
    .review-card {
        padding: 10px;
    }

    .review-author-avatar {
        width: 32px;
        height: 32px;
    }

    .review-author-name {
        font-size: 0.75rem;
    }

    .review-title {
        font-size: 0.85rem;
    }

    .review-text {
        font-size: 0.75rem;
    }
}

/* ============================================
   MOBILE FLOATING ACTION BAR
   ============================================ */
.mobile-action-bar {
    display: none;
}

@media (max-width: 768px) {
    .mobile-action-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(15, 15, 20, 0.95);
        border-top: 1px solid var(--border);
        padding: 10px 16px 10px 88px; /* Left padding for floating nav */
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
        gap: 10px;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .mobile-action-bar .btn-add-list {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 16px;
        background: var(--primary);
        border: none;
        border-radius: 10px;
        color: white;
        font-family: var(--font-body);
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        min-height: 48px;
        transition: all 0.2s ease;
    }

    .mobile-action-bar .btn-add-list:active {
        transform: scale(0.98);
    }

    .mobile-action-bar .btn-add-list svg {
        width: 20px;
        height: 20px;
    }

    .mobile-action-bar .btn-add-list.in-list {
        background: var(--success, #22c55e);
    }

    .mobile-action-bar .btn-favorite {
        width: 50px;
        height: 50px;
        min-width: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-hover);
        border: 1px solid var(--border);
        border-radius: 10px;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-action-bar .btn-favorite:active {
        transform: scale(0.95);
    }

    .mobile-action-bar .btn-favorite svg {
        width: 22px;
        height: 22px;
    }

    .mobile-action-bar .btn-favorite.active {
        background: rgba(255, 107, 107, 0.15);
        border-color: #ff6b6b;
        color: #ff6b6b;
    }

    .mobile-action-bar .btn-favorite.active svg {
        fill: #ff6b6b;
    }
}

/* ============================================
   INFINITE SCROLL & BACK TO TOP
   ============================================ */
.load-more-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 0;
    color: #9ca3af;
    font-size: 0.85rem;
}

.load-more-trigger .loader-spinner {
    width: 24px;
    height: 24px;
}

.load-more-trigger .loader-spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.results-end {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0 48px;
    color: #9ca3af;
    font-size: 0.85rem;
}

.results-end::before,
.results-end::after {
    content: '';
    flex: 1;
    max-width: 100px;
    height: 1px;
    background: var(--border);
    margin: 0 16px;
}

/* ============================================
   REVIEWS SECTION
   ============================================ */
.reviews-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.reviews-header h2 {
    margin: 0;
}

.btn-write-review {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-write-review:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-write-review svg {
    width: 18px;
    height: 18px;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reviews-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.review-card {
    display: flex;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
}

/* Review voting sidebar */
.review-vote-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.review-vote-sidebar .vote-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: #9ca3af;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.review-vote-sidebar .vote-btn:hover {
    background: var(--bg-hover);
}

.review-vote-sidebar .vote-btn.upvote:hover,
.review-vote-sidebar .vote-btn.upvote.active {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.review-vote-sidebar .vote-btn.downvote:hover,
.review-vote-sidebar .vote-btn.downvote.active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.review-vote-sidebar .vote-btn svg {
    width: 16px;
    height: 16px;
}

.review-vote-sidebar .vote-score {
    font-size: 0.85rem;
    font-weight: 700;
    color: #9ca3af;
    text-align: center;
    min-width: 28px;
}

.review-vote-sidebar .vote-score.positive {
    color: #10b981;
}

.review-vote-sidebar .vote-score.negative {
    color: #ef4444;
}

.review-main {
    flex: 1;
    min-width: 0;
}

.review-card.spoiler-warning .review-title,
.review-card.spoiler-warning .review-content {
    filter: blur(8px);
    user-select: none;
}

.review-card.spoiler-warning .spoiler-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 20, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.review-card.spoiler-warning .spoiler-overlay span {
    color: var(--primary);
    font-weight: 500;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.review-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.review-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.review-avatar svg {
    width: 22px;
    height: 22px;
    color: #9ca3af;
}

.review-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.review-username-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.review-username {
    font-weight: 600;
    color: var(--text-primary);
}

.review-list-score {
    font-size: 0.8rem;
    color: #9ca3af;
}

.review-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-date {
    font-size: 0.85rem;
    color: #9ca3af;
}

.review-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.review-content {
    color: var(--text-secondary);
    line-height: 1.7;
}

.review-content p {
    margin: 0;
}

.review-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-like {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-like:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-like.liked {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-like svg {
    width: 18px;
    height: 18px;
}

.btn-report {
    padding: 8px 14px;
    background: transparent;
    color: #9ca3af;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-report:hover {
    color: var(--text-primary);
}

.btn-edit-review,
.btn-delete-review {
    padding: 8px 14px;
    background: transparent;
    color: #9ca3af;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-edit-review:hover {
    color: var(--primary);
}

.btn-delete-review:hover {
    color: #f87171;
}

/* Edited Badge */
.edited-badge {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85em;
    margin-left: 8px;
}

/* Confirmation Modal */
.confirm-modal {
    max-width: 420px;
}

.confirm-modal .modal-body {
    padding: 24px 22px;
    text-align: center;
}

.confirm-message {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    font-size: 0.95rem;
}

.confirm-modal .modal-footer {
    justify-content: center;
    gap: 12px;
}

.confirm-modal .btn-cancel,
.confirm-modal .btn-delete {
    min-width: 100px;
}

.reviews-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.reviews-pagination button {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.reviews-pagination button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.reviews-pagination button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay:not(#addListModal):not(#editListModal) {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    padding: 20px;
}

.modal-overlay.open:not(#addListModal):not(#editListModal) {
    opacity: 1;
    visibility: visible;
}

.modal:not(.add-list-modal) {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.open .modal:not(.add-list-modal) {
    transform: scale(1);
}

.modal-header:not(.shared-modal .modal-header) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header:not(.shared-modal .modal-header) h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-close:not(.shared-modal .modal-close) {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #9ca3af;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:not(.shared-modal .modal-close):hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.modal-close:not(.shared-modal .modal-close) svg {
    width: 20px;
    height: 20px;
}

.modal-body:not(.shared-modal .modal-body) {
    padding: 24px;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.checkbox-group {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.report-reasons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.radio-label:hover {
    border-color: var(--primary);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.modal-footer:not(.shared-modal .modal-footer) {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

.btn-cancel {
    padding: 12px 24px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-save {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save:hover {
    background: var(--primary-hover);
}

.btn-delete {
    padding: 12px 24px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 600px) {
    .reviews-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .btn-write-review {
        justify-content: center;
    }

    .review-header {
        flex-direction: column;
        gap: 10px;
    }

    .review-card {
        gap: 10px;
    }

    .review-vote-sidebar .vote-btn {
        width: 24px;
        height: 24px;
    }

    .review-vote-sidebar .vote-btn svg {
        width: 14px;
        height: 14px;
    }

    .review-vote-sidebar .vote-score {
        font-size: 0.8rem;
    }

    .modal:not(.add-list-modal) {
        max-height: 85vh;
    }
}

/* === 480px - Small Phone Optimizations === */
/* === SMALL MOBILE - 480px === */
@media (max-width: 480px) {
    .content-container {
        padding: 0 12px;
    }

    /* Banner - optimized for small screens */
    .detail-banner {
        height: 180px;
    }

    .detail-banner .back-btn {
        top: 60px;
        left: 12px;
        padding: 10px 14px;
        font-size: 0.75rem;
        min-height: 44px;
        min-width: 44px;
    }

    .detail-banner .back-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Header - compact layout */
    .detail-header {
        margin-top: -80px;
        padding: 0 12px;
    }

    .header-container {
        gap: 16px;
    }

    /* Poster - smaller for small screens */
    .header-poster {
        width: 100px;
    }

    /* Title and meta */
    .detail-title {
        font-size: 1.15rem;
        line-height: 1.3;
    }

    .header-meta {
        font-size: 0.7rem;
        gap: 6px;
    }

    .header-meta .dot {
        display: none;
    }

    .header-genres {
        gap: 4px;
    }

    .genre {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    /* Action buttons - full width, prominent */
    .poster-actions {
        gap: 8px;
        margin-top: 16px;
    }

    .btn-add-list {
        width: 100%;
        min-height: 48px;
        font-size: 0.85rem;
        padding: 14px 16px;
    }

    .btn-favorite {
        width: 100%;
        height: 48px;
        min-height: 48px;
        font-size: 0.85rem;
    }

    .btn-add-list svg,
    .btn-favorite svg {
        width: 18px;
        height: 18px;
    }

    /* NOTE: Detail body, content sections, tabs, sidebar, and card styles moved to consolidated mobile section above */

    .rec-title {
        font-size: 0.75rem;
        margin-top: 6px;
    }

    /* Reviews */
    .review-card {
        padding: 12px;
    }

    .review-header {
        gap: 10px;
    }

    .review-avatar {
        width: 36px;
        height: 36px;
    }

    .review-author {
        font-size: 0.85rem;
    }

    .review-date {
        font-size: 0.7rem;
    }

    .review-vote-sidebar {
        gap: 4px;
        padding: 8px;
    }

    .review-vote-sidebar .vote-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .review-vote-sidebar .vote-btn svg {
        width: 14px;
        height: 14px;
    }

    .review-vote-sidebar .vote-score {
        font-size: 0.75rem;
    }

    .btn-write-review {
        min-height: 48px;
        font-size: 0.85rem;
    }

    /* Modal adjustments - compact centered with slide animation */
    .modal-overlay:not(#addListModal):not(#editListModal) {
        padding: 20px;
        align-items: center;
        justify-content: center;
    }

    .modal:not(.add-list-modal) {
        max-width: 300px;
        max-height: 75vh;
        border-radius: 12px;
        margin: 0;
        transform: scale(0.95) translateY(20px);
        transition: transform 0.25s ease;
    }

    .modal-overlay.open .modal:not(.add-list-modal) {
        transform: scale(1) translateY(0);
    }

    .modal-header:not(.shared-modal .modal-header) {
        padding: 10px 12px;
        position: sticky;
        top: 0;
        background: var(--bg-deep);
        z-index: 10;
    }

    .modal-header:not(.shared-modal .modal-header) h3 {
        font-size: 0.85rem;
    }

    .modal-close:not(.shared-modal .modal-close) {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .modal-close:not(.shared-modal .modal-close) svg {
        width: 16px;
        height: 16px;
    }

    .modal-body:not(.shared-modal .modal-body) {
        padding: 10px 12px;
        overflow-y: auto;
    }

    .form-group {
        margin-bottom: 8px;
    }

    .form-group label {
        margin-bottom: 4px;
        font-size: 0.75rem;
    }

    /* Form inputs - compact but still 16px to prevent iOS zoom */
    .form-group input[type="text"],
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        min-height: 36px;
        padding: 6px 10px;
    }

    .form-group textarea {
        min-height: 60px;
    }

    .modal-footer:not(.shared-modal .modal-footer) {
        padding: 10px 12px;
        gap: 6px;
        position: sticky;
        bottom: 0;
        background: var(--bg-deep);
        border-top: 1px solid var(--border);
    }

    .modal-footer:not(.shared-modal .modal-footer) button {
        min-height: 36px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* Confirm modal */
    .confirm-modal .modal-footer {
        flex-direction: column;
    }

    .confirm-modal .modal-footer button {
        width: 100%;
    }

}


/* ============================================
   SERIES & FRANCHISE SECTION
   ============================================ */

.series-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.series-loading {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 1rem 0;
}

/* Sidebar series layout for small franchises */
.sidebar-series-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-series-group + .sidebar-series-group {
    margin-top: 0.625rem;
}

.sidebar-series-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    padding-left: 16px;
}

.sidebar-series-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.sidebar-series-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
}

.sidebar-series-item:hover {
    background: var(--bg-elevated);
}

.sidebar-series-item.current {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
}

.sidebar-series-item img {
    width: 36px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.sidebar-series-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
    flex: 1;
}

.sidebar-series-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.sidebar-series-meta {
    font-size: 0.65rem;
    color: var(--text-tertiary);
}

.sidebar-current-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    background: var(--primary);
    color: white;
    font-size: 0.5rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* Series Grid Layout - overlay style */
.series-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.series-card {
    width: 115px;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.series-card:hover {
    transform: translateY(-4px);
}

.series-card:hover .series-card-image {
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.series-card.current .series-card-image {
    box-shadow: 0 0 0 2px var(--primary);
}

.series-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.series-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gradient overlay for text readability */
.series-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 0%,
        transparent 35%,
        transparent 45%,
        rgba(0, 0, 0, 0.85) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.5rem;
}

/* Relation label at top */
.series-relation {
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.series-card.current .series-relation {
    color: var(--primary);
}

/* Info at bottom */
.series-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.series-card-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.series-card-meta {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.75);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.series-card-status {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Show more button */
.series-show-more {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.625rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.series-show-more:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--primary);
}

.timeline-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.timeline-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.timeline-grid {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 8px;
    max-width: calc(7 * 120px + 6 * 0.75rem);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.timeline-grid::-webkit-scrollbar {
    display: none;
}

.timeline-section {
    position: relative;
}

.timeline-section.has-scroll {
    padding: 0 44px;
}

/* Scroll arrow buttons */
.timeline-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-25%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.timeline-arrow:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.timeline-arrow svg {
    width: 18px;
    height: 18px;
}

.timeline-arrow-left {
    left: 0;
}

.timeline-arrow-right {
    right: 0;
}

.timeline-card {
    flex-shrink: 0;
    width: 120px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.timeline-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.timeline-card.current {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: var(--bg-surface);
}

.timeline-card-info {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.timeline-format {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.timeline-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.timeline-status {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.current-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .timeline-card {
        width: 120px;
    }

    .timeline-card-info {
        padding: 0.5rem;
    }

    .timeline-title {
        font-size: 0.75rem;
    }
}

/* ============================================
   SERIES BROWSE VIEW (Fanout Cards - oku-card styling)
   ============================================ */

.series-browse-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
}

@media (max-width: 1400px) { .series-browse-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1100px) { .series-browse-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }
@media (max-width: 850px) { .series-browse-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (max-width: 550px) { .series-browse-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
@media (max-width: 400px) { .series-browse-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }

/* Directional dim effect - dims neighboring cards to the left/right */
/* Only applies to physically adjacent cards (respects row boundaries) */

/* Dim right neighbor when hovering a card with 3+ entries */
.oku-series-card[data-count="3"]:not(.row-end):hover + .oku-series-card,
.oku-series-card[data-count="4"]:not(.row-end):hover + .oku-series-card,
.oku-series-card[data-count="5"]:not(.row-end):hover + .oku-series-card {
    filter: brightness(0.7);
}

/* Dim left neighbor when hovering a card with 2+ entries */
.oku-series-card:not(.row-end):has(+ .oku-series-card[data-count="2"]:not(.row-start):hover),
.oku-series-card:not(.row-end):has(+ .oku-series-card[data-count="3"]:not(.row-start):hover),
.oku-series-card:not(.row-end):has(+ .oku-series-card[data-count="4"]:not(.row-start):hover),
.oku-series-card:not(.row-end):has(+ .oku-series-card[data-count="5"]:not(.row-start):hover) {
    filter: brightness(0.7);
}

/* Series Add Button - matching oku-card-add-btn style exactly */
.series-add-btn {
    position: absolute;
    bottom: 16px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    background: rgba(var(--primary-rgb), 0.4);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
}

/* Show button on card hover */
.oku-series-card:hover .series-add-btn {
    opacity: 1;
    pointer-events: auto;
}

.series-add-btn svg {
    width: 16px;
    height: 16px;
}

.series-add-btn:hover {
    background: rgba(var(--primary-rgb), 0.6);
    border-color: rgba(var(--primary-rgb), 0.8);
    color: #fff;
    transform: scale(1.1);
}

/* Status-specific button colors - matching oku-card-add-btn exactly */
.series-add-btn.status-watching {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.45);
    color: #fff;
}
.series-add-btn.status-watching:hover {
    background: rgba(34, 197, 94, 0.65);
    border-color: rgba(34, 197, 94, 0.8);
    color: #fff;
}

.series-add-btn.status-completed {
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(59, 130, 246, 0.45);
    color: #fff;
}
.series-add-btn.status-completed:hover {
    background: rgba(59, 130, 246, 0.65);
    border-color: rgba(59, 130, 246, 0.8);
    color: #fff;
}

.series-add-btn.status-plan {
    border-color: rgba(var(--primary-rgb), 0.6);
    background: rgba(var(--primary-rgb), 0.45);
    color: #fff;
}
.series-add-btn.status-plan:hover {
    background: rgba(var(--primary-rgb), 0.65);
    border-color: rgba(var(--primary-rgb), 0.8);
    color: #fff;
}

.series-add-btn.status-paused {
    border-color: rgba(234, 179, 8, 0.6);
    background: rgba(234, 179, 8, 0.45);
    color: #fff;
}
.series-add-btn.status-paused:hover {
    background: rgba(234, 179, 8, 0.65);
    border-color: rgba(234, 179, 8, 0.8);
    color: #fff;
}

.series-add-btn.status-dropped {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.45);
    color: #fff;
}
.series-add-btn.status-dropped:hover {
    background: rgba(239, 68, 68, 0.65);
    border-color: rgba(239, 68, 68, 0.8);
    color: #fff;
}

.series-add-btn.status-rewatching {
    border-color: rgba(6, 182, 212, 0.6);
    background: rgba(6, 182, 212, 0.45);
    color: #fff;
}
.series-add-btn.status-rewatching:hover {
    background: rgba(6, 182, 212, 0.65);
    border-color: rgba(6, 182, 212, 0.8);
    color: #fff;
}

/* Loading state for series */
.series-browse-grid .loader-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 16px;
}

/* ============================================
   MOBILE: Series browse responsive
   ============================================ */
@media (max-width: 768px) {
    /* Show button always on mobile (no hover) */
    .series-browse-grid .series-add-btn {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Disable row dim effect on mobile */
    .series-browse-grid .oku-series-card {
        filter: none !important;
    }
}

/* Highlight review when scrolled to */
.highlight-review {
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0%, 50% {
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.5);
    }
    100% {
        box-shadow: none;
    }
}

/* ============================================
   WATCH ORDER SECTION
   ============================================ */
.watch-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.watch-order-header h2 {
    margin: 0;
}

.watch-order-tabs {
    display: flex;
    gap: 8px;
}

.watch-order-tab {
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.watch-order-tab:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.watch-order-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.watch-order-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.watch-order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    position: relative;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}


.watch-order-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.watch-order-item.current {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
}

.watch-order-cover,
.watch-order-img {
    width: 50px;
    height: 70px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.watch-order-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.watch-order-info {
    flex: 1;
    min-width: 0;
}

.watch-order-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watch-order-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.watch-order-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-radius: 50%;
    flex-shrink: 0;
}

.watch-order-item.current .watch-order-number {
    background: var(--primary);
    color: white;
}

.watch-order-type {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.watch-order-connector {
    position: absolute;
    left: 2px;
    bottom: -20px;
    width: 2px;
    height: 20px;
    background: var(--border);
}

.watch-order-status {
    font-size: 0.9rem;
    margin-left: auto;
}

.watch-order-status.completed {
    color: var(--success);
}

.watch-order-status.watching {
    color: var(--primary);
}

.watch-order-notes {
    margin-top: 16px;
    padding: 16px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.watch-order-notes strong {
    color: var(--primary);
}

/* Show more button */
.watch-order-show-more {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.625rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watch-order-show-more:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* ============================================
   COMPLETION PREDICTION
   ============================================ */
.completion-prediction {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.prediction-meter {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.prediction-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning), var(--success));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.prediction-text {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #9ca3af;
    text-align: center;
}

.prediction-subtitle {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 3px;
}

/* ============================================
   NEXT IN FRANCHISE PROMPT
   ============================================ */
.next-franchise-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.next-franchise-prompt:hover {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.25), rgba(59, 130, 246, 0.25));
    border-color: var(--primary);
    transform: translateX(4px);
}

.next-franchise-prompt svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.next-franchise-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.next-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.next-title {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   RECS TABS EXTENDED
   ============================================ */
.recs-tabs {
    flex-wrap: wrap;
}

.recs-tab svg {
    width: 14px;
    height: 14px;
}

/* Trope tags in recommendations */
.rec-tropes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.rec-trope,
.trope-tag {
    padding: 2px 6px;
    background: rgba(var(--primary-rgb), 0.15);
    border-radius: 4px;
    font-size: 0.65rem;
    color: var(--primary);
    text-transform: capitalize;
}

/* Visual similarity indicator */
.rec-visual-match {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.rec-visual-match svg {
    width: 12px;
    height: 12px;
}

@media (max-width: 768px) {
    .watch-order-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .watch-order-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .watch-order-tab {
        white-space: nowrap;
    }

    .next-franchise-prompt {
        padding: 10px 12px;
    }
}

/* ============================================
   REVISION HISTORY SECTION
   ============================================ */
#revisionHistorySection h2 {
    margin-bottom: 16px;
}

.revision-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.revision-history-item {
    background: var(--bg-card, rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    border-radius: 8px;
    padding: 14px 16px;
    transition: all 0.15s;
}

.revision-history-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.revision-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.revision-action-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.revision-action-badge.action-add {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.revision-action-badge.action-edit {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.revision-user-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary, #fafafa);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s;
}

.revision-user-link:hover {
    color: var(--primary, #8b5cf6);
}

.revision-user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.revision-item-date {
    font-size: 0.8rem;
    color: var(--text-muted, #71717a);
    margin-left: auto;
}

.revision-points {
    font-size: 0.8rem;
    font-weight: 600;
    color: #22c55e;
}

.revision-changes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.revision-change-item {
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary, #a1a1aa);
}

.revision-change-more {
    font-size: 0.75rem;
    color: var(--text-muted, #71717a);
}

#revisionHistorySection .btn-load-more {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-secondary, #a1a1aa);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

#revisionHistorySection .btn-load-more:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary, #8b5cf6);
    color: var(--primary, #8b5cf6);
}

.revision-empty,
.revision-loading {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted, #71717a);
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

@media (max-width: 600px) {
    .revision-item-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .revision-item-date {
        margin-left: 0;
    }
}

/* ===== Time-to-Finish Widget ===== */
.ttf-widget {
    padding: 14px 16px;
}

.ttf-widget-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
}

.ttf-widget-header svg {
    width: 14px;
    height: 14px;
}

.ttf-widget-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ttf-widget-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ttf-widget-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ttf-widget-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ttf-widget-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-deep);
    border-radius: 2px;
    overflow: hidden;
}

.ttf-widget-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.ttf-widget-pace {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    margin-top: 2px;
}


/* ============================================
   EPISODE SCORES MATRIX
   ============================================ */

.episode-matrix-container {
    overflow-x: auto;
    padding: 4px 0;
}

.episode-matrix-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.episode-matrix {
    display: table;
    border-collapse: separate;
    border-spacing: 4px;
}

.episode-matrix-row {
    display: table-row;
}

.episode-matrix-header {
    display: table-row;
}

.episode-matrix-cell {
    display: table-cell;
    padding: 0;
    text-align: center;
    border-radius: 4px;
    font-size: 0.68rem;
    vertical-align: middle;
    width: 36px;
    height: 36px;
}

.episode-matrix-cell.header-cell {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 1;
    height: 28px;
}

.episode-matrix-cell.row-label {
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    text-align: center;
    width: 28px;
    position: sticky;
    left: 0;
    z-index: 1;
}

.episode-matrix-cell.score-cell {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.episode-matrix-cell.score-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Score color backgrounds - full color with white text */
.episode-matrix-cell.score-red { background: rgba(248, 113, 113, 0.85); color: #fff; }
.episode-matrix-cell.score-orange { background: rgba(251, 146, 60, 0.85); color: #fff; }
.episode-matrix-cell.score-yellow { background: rgba(251, 191, 36, 0.85); color: #1a1a1a; }
.episode-matrix-cell.score-green { background: rgba(74, 222, 128, 0.85); color: #1a1a1a; }
.episode-matrix-cell.score-blue { background: rgba(96, 165, 250, 0.85); color: #fff; }
.episode-matrix-cell.score-purple { background: rgba(192, 132, 252, 0.85); color: #fff; }

.episode-matrix-cell.no-score {
    background: var(--bg-deep);
    color: var(--text-muted);
    font-weight: 400;
}

/* User's own score indicator */
.episode-matrix-cell.user-scored::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

/* Empty cell (episode doesn't exist for this season) */
.episode-matrix-cell.empty-cell {
    background: transparent;
    cursor: default;
}

.episode-matrix-cell.empty-cell:hover {
    transform: none;
    box-shadow: none;
}

/* Single anime view (no seasons to compare) */
.episode-scores-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, 36px);
    gap: 4px;
}

.episode-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.episode-score-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.episode-score-item .ep-num {
    font-size: 0.65rem;
    color: inherit;
    opacity: 0.8;
    margin-bottom: 2px;
}

.episode-score-item .ep-score {
    font-size: 0.8rem;
    font-weight: 600;
}

/* Score colors for list view - full color backgrounds */
.episode-score-item.score-red { background: rgba(248, 113, 113, 0.85); color: #fff; }
.episode-score-item.score-red .ep-num,
.episode-score-item.score-red .ep-score { color: #fff; }
.episode-score-item.score-orange { background: rgba(251, 146, 60, 0.85); color: #fff; }
.episode-score-item.score-orange .ep-num,
.episode-score-item.score-orange .ep-score { color: #fff; }
.episode-score-item.score-yellow { background: rgba(251, 191, 36, 0.85); color: #1a1a1a; }
.episode-score-item.score-yellow .ep-num,
.episode-score-item.score-yellow .ep-score { color: #1a1a1a; }
.episode-score-item.score-green { background: rgba(74, 222, 128, 0.85); color: #1a1a1a; }
.episode-score-item.score-green .ep-num,
.episode-score-item.score-green .ep-score { color: #1a1a1a; }
.episode-score-item.score-blue { background: rgba(96, 165, 250, 0.85); color: #fff; }
.episode-score-item.score-blue .ep-num,
.episode-score-item.score-blue .ep-score { color: #fff; }
.episode-score-item.score-purple { background: rgba(192, 132, 252, 0.85); color: #fff; }
.episode-score-item.score-purple .ep-num,
.episode-score-item.score-purple .ep-score { color: #fff; }
.episode-score-item.no-score { background: var(--bg-deep); }
.episode-score-item.no-score .ep-num { color: var(--text-muted); }
.episode-score-item.no-score .ep-score { color: var(--text-muted); }

.episode-score-item.user-scored::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
    background: var(--primary);
    border-radius: 50%;
}

/* Episode scores header */
.episode-scores-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.episode-scores-header h2 {
    margin: 0;
}

.save-episode-img-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-episode-img-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--primary);
}

.save-episode-img-btn svg {
    width: 16px;
    height: 16px;
}

.save-episode-img-btn:disabled {
    opacity: 0.8;
    cursor: wait;
    background: var(--bg-elevated);
    border-color: var(--primary);
}

.save-episode-img-btn:disabled .save-text {
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Matrix legend */
.episode-matrix-legend {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: 6px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-color.score-red { background: rgba(248, 113, 113, 0.85); }
.legend-color.score-orange { background: rgba(251, 146, 60, 0.85); }
.legend-color.score-yellow { background: rgba(251, 191, 36, 0.85); }
.legend-color.score-green { background: rgba(74, 222, 128, 0.85); }
.legend-color.score-blue { background: rgba(96, 165, 250, 0.85); }
.legend-color.score-purple { background: rgba(192, 132, 252, 0.85); }

/* Show more button */
.episode-show-more-btn {
    display: block;
    width: 100%;
    padding: 8px 16px;
    margin-top: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.episode-show-more-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .episode-matrix-container {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .episode-matrix-cell {
        padding: 0;
        font-size: 0.62rem;
        width: 30px;
        height: 30px;
    }

    .episode-scores-list {
        grid-template-columns: repeat(auto-fill, 30px);
        gap: 3px;
    }

    .episode-score-item {
        width: 30px;
        height: 30px;
        padding: 2px;
    }

    .episode-score-item .ep-num {
        font-size: 0.55rem;
    }

    .episode-score-item .ep-score {
        font-size: 0.65rem;
    }
}