* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

header {
    background: rgba(10,10,15,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1360px; margin: 0 auto;
    padding: 10px 24px;
    display: flex; align-items: center; gap: 16px;
}
.logo {
    font-size: 1.6rem; font-weight: 800;
    color: #1e7f58;
    cursor: pointer; white-space: nowrap; letter-spacing: -0.5px;
    flex-shrink: 0;
}
.nav-links {
    display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
    flex: 1; justify-content: center;
}
.nav-links a, .nav-links .dropdown-btn {
    padding: 7px 14px; border-radius: 5px; font-size: 0.82rem;
    font-weight: 500; background: transparent; color: #9ca3af;
    cursor: pointer; border: none; transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    line-height: normal;
}
.nav-links a:hover, .nav-links .dropdown-btn:hover { color: #fff; background: #1e7f58; }
.nav-links .dropdown-btn .caret { font-size: 1em; margin-left: 0.28em; }
.nav-links a.active { color: #fff !important; background: #1e7f58 !important; }

.dropdown { position: relative; display: flex; align-items: center; }
.dropdown::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px;
}
.dropdown-content {
    display: none; position: absolute; top: calc(100% + 10px); left: 50%;
    transform: translateX(-50%);
    background: #1a1a24; border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px; padding: 8px; padding-top: 16px;
    width: min(240px, calc(100vw - 32px)); max-height: 62vh; overflow-y: auto; overflow-x: hidden;
    z-index: 200;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    grid-template-columns: 1fr 1fr; gap: 4px;
}
.dropdown:hover .dropdown-content { display: grid; }
.dropdown-content a {
    padding: 6px 8px; font-size: 0.74rem; border-radius: 5px;
    background: rgba(255,255,255,0.04); color: #bbb; transition: all 0.15s;
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dropdown-content a:hover { background: #1e7f58; color: #fff; }

#phimDropdown {
    grid-template-columns: 1fr 1fr;
    width: auto;
    min-width: 200px;
}
#phimDropdown a:last-child { grid-column: 1 / -1; }
.genre-dropdown-content {
    display: none; position: absolute; top: calc(100% + 10px); left: 50%;
    transform: translateX(-50%);
    background: #1a1a24; border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px; padding: 8px; padding-top: 16px;
    width: min(240px, calc(100vw - 32px)); max-height: 62vh; overflow-y: auto; overflow-x: hidden;
    z-index: 200;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    grid-template-columns: 1fr 1fr; gap: 4px;
}
.dropdown:hover .genre-dropdown-content { display: grid; }
.genre-dropdown-content a {
    padding: 6px 8px; font-size: 0.74rem; border-radius: 5px;
    background: rgba(255,255,255,0.04); color: #bbb; transition: all 0.15s;
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.genre-dropdown-content a:hover { background: #1e7f58; color: #fff; }

.search-box {
    position: relative; margin-left: auto; flex-shrink: 0;
}
.search-box input {
    padding: 9px 44px 9px 18px; border-radius: 5px;
    border: 1px solid #1e7f58;
    background: rgba(255,255,255,0.06); color: #fff;
    font-size: 0.88rem; outline: none; width: 280px;
    transition: border-color 0.2s;
}
.search-box input::placeholder { color: #666; }
.search-box input:focus { border-color: #1e7f58; background: rgba(255,255,255,0.08); }
.search-submit {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    border: none;
    border-radius: 0 5px 5px 0;
    background: #1e7f58;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s;
}
.search-submit:hover { filter: brightness(1.06); }
.search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #1a1a24; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px; max-height: 400px; overflow-y: auto;
    z-index: 300; display: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
}
.search-results.show { display: block; }
.search-result-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    cursor: pointer; transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(30,127,88,0.1); }
.search-result-item img {
    width: 45px; height: 64px; object-fit: cover; border-radius: 5px; flex-shrink: 0;
}

img.lazy-blur {
    opacity: 1;
}
.search-result-item .sr-info h4 {
    font-size: 0.85rem; color: #fff; margin-bottom: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px;
}
.search-result-item .sr-info p {
    font-size: 0.72rem; color: #6b7280;
}
.search-result-item .sr-info .sr-sub {
    font-size: 0.7rem; color: #1e7f58; margin-top: 2px;
}

.menu-toggle {
    display: none; background: none; border: none; color: #fff;
    font-size: 1.2rem; cursor: pointer;
    width: 36px; height: 36px; line-height: 36px; text-align: center;
}
.search-toggle {
    display: none; background: none; border: none; color: #fff;
    font-size: 1.1rem; cursor: pointer;
    width: 36px; height: 36px; line-height: 36px; text-align: center;
}

.container { max-width: 1360px; margin: 0 auto; padding: 24px; padding-bottom: 40px; }

.section-title {
    font-size: 1.4rem; font-weight: 700; margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px; color: #fff;
}
.section-title::before {
    content: ''; width: 4px; height: 24px; border-radius: 5px;
    background: #1e7f58;
    flex-shrink: 0;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px; margin-bottom: 20px;
    align-items: start;
    min-height: 60vh;
}
.movie-card {
    background: #14141e; border-radius: 5px; overflow: hidden;
    cursor: pointer; transition: box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}
.movie-card:hover {
    transform: none;
    box-shadow: 0 8px 26px rgba(0,0,0,0.35);
}
.movie-card .thumb-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    height: auto;
    background: #14141e;
    flex-shrink: 0;
}
.movie-card .thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    background: #1a1a24;
}
.movie-card:hover .thumb { transform: none; }

.movie-card .badge {
    position: absolute; top: 10px; left: 10px;
    background: #1e7f58;
    color: #fff; font-size: 0.68rem; font-weight: 700;
    padding: 4px 9px; border-radius: 5px;
    box-shadow: 0 2px 8px rgba(30,127,88,0.3);
}
.movie-card .quality-badge {
    position: absolute; top: 10px; right: 10px;
    background: #1e7f58;
    color: #fff; font-size: 0.68rem; font-weight: 700;
    padding: 4px 9px; border-radius: 5px;
    box-shadow: 0 2px 8px rgba(30,127,88,0.3);
}
.movie-card .thumb-tags {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}
.movie-card .thumb-tags span {
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: #1e7f58;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(30,127,88,0.3);
}
.movie-card .info {
    padding: 8px 9px;
    min-height: 56px;
    background: #14141e;
    border-top: 1px solid rgba(255,255,255,0.06);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
.movie-card .info h3 {
    font-size: 0.9rem; font-weight: 600; color: #fff;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    line-clamp: 1;
    min-height: 1.25em;
    margin-bottom: 1px;
    line-height: 1.25;
}
.movie-card .info .original-name {
    font-size: 0.85rem; color: #6b7280;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    line-height: 1.2;
}
.movie-card .info .movie-submeta {
    margin-top: 2px;
    font-size: 0.82rem;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pagination {
    display: flex; justify-content: center; gap: 6px;
    margin: 20px 0; flex-wrap: wrap;
}
.pagination button {
    padding: 9px 16px; border: 1px solid rgba(30,127,88,0.4);
    background: rgba(255,255,255,0.04); color: #9ca3af;
    border-radius: 5px; cursor: pointer; font-size: 0.85rem;
    font-weight: 500; transition: all 0.2s;
}
.pagination button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.pagination button.active {
    background: #1e7f58; color: #fff; border-color: #1e7f58;
}
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

.movie-detail { display: none; }
.movie-detail.show { display: block; }

.player-container {
    background: #000; border-radius: 5px; overflow: hidden;
    margin-bottom: 24px; aspect-ratio: 16/9; position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.player-container iframe, .player-container video { width: 100%; height: 100%; border: none; }

.player-switch {
    text-align: center; padding: 10px 0 20px; display: flex;
    justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
}
.player-switch span { color: #777; font-size: 0.85rem; }
.player-switch button {
    background: rgba(30,127,88,0.1); border: 1px solid rgba(30,127,88,0.3);
    color: #1e7f58; padding: 6px 16px; border-radius: 5px; cursor: pointer;
    font-size: 0.8rem; transition: all 0.2s;
}
.player-switch button:hover { background: rgba(30,127,88,0.2); }
.player-error {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: #1e7f58; font-size: 1rem; text-align: center;
    line-height: 1.8; padding: 20px;
}

.detail-header {
    display: block; margin-bottom: 28px;
    background: rgba(20,20,30,0.7);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 5px; padding: 24px;
}
.detail-info { flex: 1; min-width: 200px; }
.detail-info h1 {
    font-size: 1.7rem; font-weight: 800; color: #fff;
    margin-bottom: 4px; line-height: 1.3;
}
.detail-info h2 {
    font-size: 1rem; color: #6b7280; margin-bottom: 16px;
    font-weight: 400;
}
.detail-info .tags {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.detail-info .tags span {
    background: rgba(255,255,255,0.06); padding: 5px 12px;
    border-radius: 5px; font-size: 0.82rem; color: #ccc;
    border: 1px solid rgba(30,127,88,0.4);
}
.detail-meta-row {
    font-size: 0.9rem; color: #9ca3af; margin-bottom: 6px;
}
.detail-meta-row strong { color: #d1d5db; font-weight: 600; }
.detail-info .desc {
    font-size: 0.9rem; color: #9ca3af; line-height: 1.7;
    margin-top: 12px;
}

.episodes-section { margin-bottom: 24px; }
.server-name {
    font-size: 1rem; font-weight: 700; margin-bottom: 12px;
    color: #fbbf24; display: flex; align-items: center; gap: 8px;
}
.episodes-grid {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
}
.episodes-grid button {
    padding: 9px 18px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(30,127,88,0.4);
    color: #bbb; border-radius: 5px; cursor: pointer;
    font-size: 0.85rem; font-weight: 500; transition: all 0.2s;
}
.episodes-grid button:hover {
    background: rgba(30,127,88,0.15); border-color: #1e7f58; color: #fff;
}
.episodes-grid button.active {
    background: #1e7f58; color: #fff; border-color: #1e7f58;
    box-shadow: 0 2px 12px rgba(30,127,88,0.3);
}

.loading {
    text-align: center; padding: 60px 20px; color: #555;
    grid-column: 1 / -1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 50vh;
}
.loading .spinner {
    width: 44px; height: 44px; border: 3px solid #1a1a24;
    border-top-color: #1e7f58; border-radius: 50%;
    animation: spin 0.7s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scroll-top-btn {
    position: fixed;
    right: 24px;
    bottom: 60px;
    width: 39px;
    height: 36px;
    border: none;
    border-radius: 5px;
    background: #1e7f58;
    color: #fff;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s, filter 0.2s;
}

.scroll-top-btn i {
    display: block;
    width: 1em;
    height: 1em;
    line-height: 1;
    font-size: 0.9rem;
    transform: translateY(0.5px);
    pointer-events: none;
}

.scroll-top-btn.in-list {
    bottom: 60px;
    width: 39px;
    height: 36px;
}

.scroll-top-btn.in-detail {
    bottom: 69px;
    width: 39px;
    height: 36px;
}

.scroll-top-btn.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-top-btn:hover {
    filter: brightness(1.08);
}

footer {
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
    text-align: center; color: #4b5563; font-size: 0.82rem;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #0a0a0f; z-index: 50;
}

.resume-prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 20px;
}

.resume-prompt-card {
    width: min(560px, 100%);
    background: #151521;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.resume-prompt-message {
    font-size: 1rem;
    color: #e5e7eb;
    line-height: 1.65;
    margin-bottom: 14px;
}

.resume-prompt-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.resume-prompt-btn {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    padding: 9px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.resume-prompt-btn-primary {
    background: #1e7f58;
    border-color: #1e7f58;
    color: #fff;
}

.resume-prompt-btn-primary:hover {
    filter: brightness(1.05);
}

.resume-prompt-btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: #d1d5db;
}

.resume-prompt-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}