:root {
    --primary: #1e3a5f;
    --secondary: #2c4a6d;
    --accent: #ff6b6b;
    --text: #ffffff;
    --bg: #0f0c14;
    --card-bg: #1a2535;
    --border: #33475b;
    --hover: #2a3b50;
    --card-hover: #253448;
    --modal-bg: rgba(26, 37, 53, 0.95);
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 12px 20px rgba(0, 0, 0, 0.4);
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
    --transition-slow: all 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    background: radial-gradient(circle at top right, #1a2a40, var(--bg));
    padding-bottom: 2rem;
}

header {
    background-color: #1e3a5f;
    border-bottom: 1px solid #1a1a2e;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #e94560;
    font-weight: 700;
    font-size: 1.5rem;
    user-select: none;
}

.logoweb {
    height: 42px;
    width: auto;
    filter: drop-shadow(0 0 4px #e94560aa);
    transition: transform 0.3s ease;
}

.logo:hover .logoweb {
    transform: scale(1.05);
}

@keyframes logoShimmer {
    from { filter: brightness(1); }
    to { filter: brightness(1.2); }
}

.logo i {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.4rem;
    letter-spacing: 0.5px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-normal);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: var(--transition-normal);
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent);
    background-color: rgba(255, 107, 107, 0.1);
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 400px;
}

#search-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background-color: var(--secondary);
    color: var(--text);
    width: 100%;
    transition: var(--transition-normal);
}

#search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.3);
    background-color: rgba(44, 74, 109, 0.8);
}

#search-btn {
    padding: 0.5rem 1rem;
    background-color: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-btn:hover {
    background-color: #ff5252;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

#main-content {
    padding: 2rem;
    min-height: calc(100vh - 100px);
    overflow-y: auto;
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
    color: var(--text);
    animation: pulseText 1.5s infinite;
}

@keyframes pulseText {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top: 4px solid var(--accent);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInFromLeft 0.4s ease-out;
}

@keyframes slideInFromLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.section-title i {
    font-size: 1.2rem;
}

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    counter-reset: anime-counter;
}

.anime-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition-normal);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    animation: cardStagger 0.3s forwards;
    counter-increment: anime-counter;
}

.anime-card:nth-child(1) { animation-delay: 0.1s; }
.anime-card:nth-child(2) { animation-delay: 0.2s; }
.anime-card:nth-child(3) { animation-delay: 0.3s; }
.anime-card:nth-child(4) { animation-delay: 0.4s; }
.anime-card:nth-child(5) { animation-delay: 0.5s; }
.anime-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes cardStagger {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anime-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-hover);
    background-color: var(--card-hover);
}

.anime-poster {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background-color: #333;
    transition: var(--transition-normal);
}

.anime-card:hover .anime-poster {
    transform: scale(1.03);
}

.anime-info {
    padding: 1rem;
}

.anime-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.5rem;
    position: relative;
}

.anime-title::before {
    content: counter(anime-counter) ". ";
    color: var(--accent);
    font-weight: bold;
}

.anime-meta {
    font-size: 0.75rem;
    color: #aaa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.episode-count {
    background-color: var(--accent);
    color: var(--bg);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 30px rgba(0,0,0,0.5);
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: var(--text);
    cursor: pointer;
    z-index: 101;
    transition: var(--transition-fast);
}

.close:hover {
    color: var(--accent);
}

.modal-content h2 {
    padding: 1.5rem 2rem;
    margin: 0;
    border-bottom: 2px solid var(--accent);
    color: var(--accent);
}

.video-container {
    padding: 1rem 2rem;
    background-color: #000;
    text-align: center;
}

#stream-frame {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    background-color: #000;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.page-btn {
    padding: 0.5rem 1rem;
    background-color: var(--secondary);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 0.9rem;
}

.page-btn:hover:not(:disabled, .active) {
    background-color: var(--hover);
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.1);
}

.page-btn.active {
    background-color: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: bold;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .logo {
        justify-content: center;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
        background-color: rgba(255, 255, 255, 0.05);
        border-radius: 6px;
    }

    .search-bar {
        max-width: 100%;
        margin-top: 0.5rem;
    }

    .video-container {
        padding: 0.5rem 1rem;
    }

    #stream-frame {
        height: 250px;
    }

    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

.episode-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.episode-item {
    position: relative;
    background: var(--secondary);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    overflow: hidden;
}

.episode-item:hover {
    background: var(--accent);
}

.episode-item .episode-number {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--bg);
}

.episode-item .play-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.episode-item .play-btn:hover {
    transform: scale(1.1);
    background: var(--primary);
}

.episode-item .play-btn i {
    font-size: 0.9rem;
}

button, .nav-link, .anime-card, .episode-item {
    position: relative;
    overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.server-options {
    margin-top: 1rem;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    width: 100%;
}

.server-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.server-btn {
    padding: 0.4rem 0.8rem;
    background-color: var(--secondary);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.8rem;
}

.server-btn:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

#supportModal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: none;
    place-items: center;
    z-index: 9999;
  }
  #supportModal.show {
    display: grid;
  }
  .modal-box {
    background: #1a2a40;
    max-width: 420px;
    padding: 28px 32px 32px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    animation: fadeIn .3s ease;
  }
  @keyframes fadeIn {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
  }
  .modal-box h2 {
    margin-top: 0;
    font-size: 1.4rem;
    color: white;
  }
  .modal-box p {
    margin: 12px 0 24px;
    color: whitesmoke;
  }
  .btn-discord {
    display: inline-block;
    background: #5865F2;
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
  }
  .btn-discord:hover {
    background: #4752C4;
  }
  .close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #666;
    cursor: pointer;
  }

  .checkbox-row {
      margin-top: 16px;
      font-size: .9rem;
      color: #555;
  }

  .btn-donate {
    display: inline-block;
    background: #53ff53;
    color: white;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    justify-content: center;
    text-align: center;
    gap: 5px;
  }

  .btn-donate:hover {
    background: green;
  }
  
    #bug-report-modal {
        display: none;
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        justify-content: center;
        align-items: center;
        padding: 20px;
    }

    .close {
        position: absolute;
        top: 15px;
        right: 20px;
        color: white;
        font-size: 2rem;
        font-weight: bold;
        cursor: pointer;
        z-index: 101;
    }

    .close:hover {
        color: var(--accent);
    }

    #bug-report-form label {
        display: block;
        margin-top: 1rem;
        font-weight: bold;
        color: var(--accent);
    }

    #bug-report-form textarea,
    #bug-report-form input[type="text"] {
        width: 100%;
        padding: 0.5rem;
        margin-top: 0.5rem;
        border-radius: 5px;
        border: 1px solid var(--border);
        background-color: var(--secondary);
        color: var(--text);
        box-sizing: border-box;
    }

    #bug-report-form textarea {
        resize: vertical;
    }

    #bug-report-form input[type="text"]:read-only {
        background-color: var(--card-bg);
        cursor: not-allowed;
    }

    #bug-report-form button {
        margin-top: 1.5rem;
        padding: 0.7rem 1.5rem;
        background-color: var(--accent);
        color: var(--bg);
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 1rem;
        width: 100%;
    }

    #bug-report-form button:hover {
        background-color: var(--accent-hover);
    }

    .apkd {
    text-align: center;
    margin: 0 auto;
    display: inline-block;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: white;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background-color: var(--secondary);
    }

    .con-apk {
    text-align: center;
    }

    /* Layout */
.detail-header {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.poster {
    width: 200px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,.3);
    object-fit: cover;
}

.info {
    flex: 1;
    min-width: 250px;
}

.title {
    font-size: 1.8rem;
    margin: 0 0 .5rem;
    font-weight: 700;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .8rem;
    font-size: .85rem;
    color: #ccc;
}

.meta-item {
    background: #222;
    padding: .3rem .6rem;
    border-radius: 6px;
}

.tags {
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    background: #333;
    color: #eee;
    padding: .25rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    margin: .2rem .2rem 0 0;
}

.actions {
    display: flex;
    gap: .8rem;
    flex-wrap: wrap;
}

.btn {
    border: none;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
    transition: background .2s;
}

.btn.primary {
    background: #ff3b3b;
    color: #fff;
}

.btn.primary:hover {
    background: #ff1e1e;
}

.btn.secondary {
    background: #2c2c2c;
    color: #ddd;
}

.btn.secondary:hover {
    background: #444;
}

.synopsis {
    margin-top: 2rem;
    max-width: 800px;
}

.synopsis h2 {
    margin-bottom: .5rem;
    font-size: 1.2rem;
}

.synopsis p {
    line-height: 1.6;
    color: #ddd;
}

.section-title {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .8rem;
}

.episode-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: .8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #eee;
    transition: background .2s;
}

.episode-card:hover {
    background: #252525;
}

.ep-num {
    font-weight: 600;
}

.ep-title {
    flex: 1;
    margin: 0 .8rem;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ep-icon {
    color: #ff3b3b;
}

.no-episode {
    grid-column: 1/-1;
    text-align: center;
    color: #888;
}