:root {
    --primary: #00bfff;
    --primary-glow: rgba(0, 191, 255, 0.5);
    --bg-body: #0b0e14;
    --bg-card: #161b22;
    --bg-nav: #0d1117;
    --text: #ffffff;
    --text-dim: #9ca3af;
    --danger: #ff4c4c;
    --success: #00ff88;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px var(--primary-glow); }
    50% { box-shadow: 0 0 20px var(--primary-glow); }
    100% { box-shadow: 0 0 5px var(--primary-glow); }
}

@keyframes glowRed {
    0% { box-shadow: 0 0 5px rgba(255, 76, 76, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 76, 76, 0.6); }
    100% { box-shadow: 0 0 5px rgba(255, 76, 76, 0.3); }
}

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text);
    overflow-x: hidden;
}

header {
    text-align: center;
    padding: 20px;
    background: var(--bg-nav);
    border-bottom: 1px solid #30363d;
    cursor: pointer;
}

.nav-logo-text {
    font-size: 1.8rem;
    font-weight: 800;
}

.nav-logo-text .sloth {
    color: var(--primary);
}

#adWarning {
    background: var(--danger);
    color: #fff;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
}

#searchBox {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: var(--bg-nav);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #1f2937;
}

#searchInput {
    width: 280px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #30363d;
    outline: none;
    background: #0d1117;
    color: #fff;
    transition: 0.3s;
}

#searchInput:focus {
    border-color: var(--primary);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-secondary {
    background: #21262d;
    color: #fff;
    border: 1px solid #30363d;
}

.btn-secondary.active-toggle {
    background: var(--primary);
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 15px var(--primary-glow);
}

#sectionTitle {
    padding: 10px 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: 0 2px 6px rgba(0, 191, 255, 0.2);
    margin: 15px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 15px;
    max-width: 1400px;
    margin: 15px auto;
}

.card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: 0.3s;
    border: 1px solid transparent;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

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

.type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    width: 32px;
    height: 32px;
    font-size: 13px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 1px solid #444;
    z-index: 5;
}

.card-content {
    padding: 8px;
    text-align: center;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    height: 36px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.watchBtn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    border: 1px solid #444;
    z-index: 5;
    transition: 0.3s;
}

.watchBtn.added {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    text-align: center;
    border: 1px solid #444;
    z-index: 5;
    transition: 0.3s;
    animation: glowRed 2s infinite;
}

#playerPage {
    display: none;
    padding-bottom: 50px;
}

.player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-nav);
    border-bottom: 1px solid #30363d;
}

.server-selector {
    display: flex;
    gap: 5px;
    background: #21262d;
    padding: 5px;
    border-radius: 10px;
}

.srv-btn {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    background: transparent;
    color: #fff;
    border: none;
    font-weight: bold;
}

.srv-btn.active {
    background: var(--primary);
    color: #000;
    animation: glow 2s infinite;
}

#playerContainer {
    width: 95%;
    max-width: 1000px;
    margin: auto;
    background: #000;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#player {
    width: 100%;
    height: 100%;
    border: none;
}

.episodes-box {
    max-width: 1000px;
    margin: 20px auto;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 10px;
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 8px;
    margin-top: 10px;
    max-height: 180px;
    overflow-y: auto;
}

.ep-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d333b;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}

.ep-item.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 10px var(--primary-glow);
}

.anime-detail {
    max-width: 1000px;
    margin: 30px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding: 25px;
    background: var(--bg-card);
    border-radius: 15px;
}

.detail-poster {
    width: 180px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.tag {
    background: #21262d;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    border: 1px solid #333;
    font-weight: 600;
    color: var(--text);
}

.hidden {
    display: none !important;
}

@media (max-width: 500px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }
}
