* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #111;
    color: #eee;
    line-height: 1.6;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a1a;
    padding: 15px 30px;
    position: relative;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: #ffcc00;
    cursor: pointer;
    z-index: 1001;
}

.logo span {
    color: #00ff88;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-input-wrapper {
    display: flex;
    position: relative;
}

.search {
    padding: 8px 40px 8px 12px;
    border-radius: 6px;
    border: none;
    outline: none;
    flex: 1;
    background: #333;
    color: #fff;
    font-size: 14px;
    transition: background 0.3s ease;
}

.search:focus {
    background: #444;
}

.search-button {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 35px;
    background: #ffcc00;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-weight: bold;
    transition: background 0.3s ease;
}

.search-button:hover {
    background: #ffd633;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2a2a2a;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s ease;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: #3a3a3a;
}

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

.suggestion-image {
    width: 40px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.suggestion-details {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-weight: 500;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-meta {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loading-suggestion {
    padding: 12px;
    text-align: center;
    color: #999;
    font-style: italic;
}

.no-suggestions {
    padding: 12px;
    text-align: center;
    color: #666;
}

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

.nav-links a {
    text-decoration: none;
    color: #ccc;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: color 0.3s, background 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    background: rgba(255, 204, 0, 0.1);
}

.profile {
    color: #999;
    font-size: 1.2em;
    cursor: pointer;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    transition: 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

.home-page {
    display: block;
}

.container {
    display: flex;
    padding: 30px;
    margin-bottom: 30px;
}

.poster img {
    width: 280px;
    height: 350px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.content {
    margin-left: 30px;
    flex: 1;
}

.content h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

.episodes {
    color: #bbb;
    margin-bottom: 15px;
}

.tags {
    margin-bottom: 15px;
}

.tags span {
    background: #333;
    color: #0f0;
    margin-right: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    display: inline-block;
    margin-bottom: 5px;
}

.description {
    margin: 20px 0;
    color: #aaa;
    line-height: 1.5;
}

section {
    margin: 40px 30px;
}

section h3 {
    margin-bottom: 20px;
    font-size: 1.4em;
    color: #fff;
}

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.anime-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex;
    flex-direction: column;
}

.anime-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.anime-card p {
    padding: 10px;
    font-size: 0.95em;
    color: #eee;
    margin-top: auto;
}

.anime-card:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.detail-page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.detail-header {
    position: relative;
    height: 400px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    overflow: hidden;
}

.detail-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    filter: blur(5px);
}

.detail-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 30px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.4));
}

.detail-poster {
    width: 220px;
    height: 300px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    object-fit: cover;
}

.detail-info {
    margin-left: 30px;
    flex: 1;
}

.detail-title {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    color: #bbb;
    font-size: 1.1em;
}

.detail-tags {
    margin-bottom: 20px;
}

.detail-tags span {
    background: #333;
    color: #0f0;
    margin-right: 10px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    display: inline-block;
    margin-bottom: 8px;
}

.detail-description {
    color: #ccc;
    line-height: 1.6;
    font-size: 1.1em;
    max-width: 800px;
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s ease;
    z-index: 10;
}

.back-button:hover {
    background: rgba(0, 0, 0, 0.9);
}

.episodes-section {
    padding: 30px;
}

.episodes-section h3 {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: #fff;
}

.episodes-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.episode-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.episode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.episode-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.episode-info {
    padding: 15px;
}

.episode-number {
    font-size: 0.9em;
    color: #ffcc00;
    font-weight: bold;
    margin-bottom: 8px;
}

.episode-title {
    font-size: 1em;
    color: #eee;
    line-height: 1.4;
    margin-bottom: 8px;
}

.episode-duration {
    font-size: 0.85em;
    color: #999;
}

.loading-box {
    text-align: center;
    margin: 40px 0;
}

.spinner {
    border: 4px solid #333;
    border-top: 4px solid #ffcc00;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

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

.message {
    padding: 20px;
    background: #1b1b1b;
    border-radius: 8px;
    color: #f0f0f0;
    margin: 20px 0;
    text-align: center;
}

.hidden {
    display: none !important;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

.error-page {
    display: none;
    text-align: center;
    padding: 50px 20px;
}

.error-page h2 {
    color: #ffcc00;
    margin-bottom: 20px;
    font-size: 2em;
}

.error-page p {
    color: #ccc;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.error-page button {
    background: #ffcc00;
    color: #111;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background 0.3s ease;
}

.error-page button:hover {
    background: #ffd633;
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: nowrap;
        padding: 15px 20px;
    }

    .hamburger {
        display: flex;
    }

    .search-container {
        position: absolute;
        top: 70px;
        left: 20px;
        right: 20px;
        max-width: none;
        margin: 0;
        z-index: 1000;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: #1a1a1a;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 30px;
        transition: left 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .nav-links.active {
        left: 0;
    }

    .nav-links a {
        font-size: 1.2em;
        padding: 15px 20px;
        width: 80%;
        text-align: center;
    }

    .profile {
        margin-left: auto;
        margin-right: 15px;
    }

    .container {
        flex-direction: column;
        padding: 20px;
        margin-top: 60px;
    }

    .content {
        margin-left: 0;
        margin-top: 20px;
    }

    .poster img {
        width: 100%;
        max-width: 280px;
    }

    section {
        margin: 30px 20px;
    }

    .detail-content {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .detail-info {
        margin-left: 0;
        margin-top: 20px;
    }

    .detail-title {
        font-size: 2em;
    }

    .detail-meta {
        justify-content: center;
        flex-wrap: wrap;
    }

    .episodes-wrapper {
        grid-template-columns: 1fr;
    }
}