*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: #0a0a10;
    color: #fff;
    min-height: 100vh;
}

header {
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    background: rgba(10, 10, 16, 0.92);
    backdrop-filter: blur(16px);
    z-index: 50;
}

.brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(120deg, #a78bfa, #e879f9, #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right { display:flex; align-items:center; gap:10px }
.batch-count {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 14px;
    border-radius: 100px;
}
#about-btn {
  background:none; border:none; color:rgba(255,255,255,0.4); cursor:pointer;
  font-family:'Outfit',sans-serif; font-size:13px; font-weight:600;
  padding:6px 12px; border-radius:8px; transition:all .2s;
}
#about-btn:hover { color:#a78bfa; background:rgba(167,139,250,0.08) }
.nav-back-btn {
  background:none; border:none; color:rgba(255,255,255,0.6); cursor:pointer;
  font-family:'Outfit',sans-serif; font-size:16px; font-weight:600;
  padding:6px 10px; border-radius:8px; transition:all .2s; display:flex; align-items:center;
  margin-right:4px;
}
.nav-back-btn:hover { color:#a78bfa; background:rgba(167,139,250,0.12) }
#admin-btn {
  background:none; border:none; color:rgba(255,255,255,0.4); cursor:pointer;
  font-family:'Outfit',sans-serif; font-size:13px; font-weight:600;
  padding:6px 12px; border-radius:8px; transition:all .2s;
}
#admin-btn:hover { color:#a78bfa; background:rgba(167,139,250,0.08) }
#fav-nav-btn {
  background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08);
  color:rgba(255,255,255,0.5); border-radius:100px;
  padding:6px 14px; cursor:pointer; display:flex; align-items:center; gap:6px;
  font-family:'Outfit',sans-serif; font-size:13px; font-weight:500;
  transition:all .2s;
}
#fav-nav-btn:hover { border-color:rgba(251,113,133,0.3); color:#fb7185; background:rgba(251,113,133,0.08) }
#fav-count { font-size:12px; font-weight:600; background:rgba(251,113,133,0.15); color:#fb7185; border-radius:100px; padding:1px 7px; min-width:20px; text-align:center }

.page-title {
    padding: 36px 28px 20px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.page-title span {
    background: linear-gradient(90deg, #a78bfa, #e879f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-label {
    padding: 0 28px 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    gap: 7px;
}

.section-label svg {
    flex-shrink: 0;
}

#fav-label.has-favs {
    display: flex;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
    padding: 0 28px 80px;
}



.card {
    background: #111119;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(.34, 1.4, .64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
    animation: up 0.45s ease both;
    position: relative;
}

@keyframes up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(167, 139, 250, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(167, 139, 250, 0.08);
}

.card.fav-card {
    border-color: rgba(251, 113, 133, 0.35);
    box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.12) inset;
}

.heart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 16, 0.65);
    backdrop-filter: blur(8px);
    transition: transform 0.2s cubic-bezier(.34, 1.6, .64, 1), background 0.2s ease;
}

.heart-btn:hover {
    transform: scale(1.18);
    background: rgba(10, 10, 16, 0.9);
}

.heart-btn svg {
    pointer-events: none;
}

.heart-btn .heart-outline {
    display: block;
}

.heart-btn .heart-filled {
    display: none;
}

.heart-btn.active .heart-outline {
    display: none;
}

.heart-btn.active .heart-filled {
    display: block;
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.5);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.heart-btn.pop {
    animation: heartPop 0.38s cubic-bezier(.34, 1.4, .64, 1) both;
}

.card-img {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #0d0d18;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.card:hover .card-img img {
    transform: scale(1.05);
}

.no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #130f2a, #0f1525);
    font-size: 52px;
}

.card-body {
    padding: 16px 18px 18px;
}

.card-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 44px;
}

.study-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 11px 0;
    background: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899);
    background-size: 200% 200%;
    color: #fff;
    border: none;
    border-radius: 11px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.2px;
    transition: background-position 0.4s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.study-btn:hover {
    background-position: right center;
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(168, 85, 247, 0.55);
}

.study-btn svg {
    transition: transform 0.2s ease;
}

.study-btn:hover svg {
    transform: translateX(3px);
}

.empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 120px 20px;
}

.empty div:first-child {
    font-size: 56px;
    opacity: .2;
    margin-bottom: 16px;
}

.empty div:last-child {
    font-size: 15px;
    color: rgba(255, 255, 255, .2);
    line-height: 1.7;
}

.loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 80px 20px;
    font-size: 15px;
    color: rgba(255, 255, 255, .3);
}

.back-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    margin-right: 12px;
}

.back-btn:hover {
    color: #a78bfa;
}

.token-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.token-dialog {
    background: #111119;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 36px;
    max-width: 480px;
    width: 90%;
}

.token-dialog h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.token-dialog p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin-bottom: 16px;
}

.token-hint {
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 10px;
    padding: 12px;
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

.token-dialog input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0a0a10;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
}

.token-dialog input:focus {
    border-color: #a78bfa;
}

.token-actions {
    display: flex;
    gap: 10px;
}

.token-actions button {
    flex: 1;
    padding: 11px;
    border-radius: 11px;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

#token-save-btn {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
}

#token-skip-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
}

#token-status {
    margin-top: 12px;
    font-size: 13px;
    color: #a78bfa;
}

.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 12px;
}

.tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  padding: 8px 16px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.tab.active {
  background: rgba(167, 139, 250, 0.15);
  border-color: rgba(167, 139, 250, 0.3);
  color: #a78bfa;
}

#cat-filter { padding:0 28px 10px; display:flex; gap:10px; flex-wrap:wrap }
.load-more-btn {
  grid-column:1/-1; justify-self:center;
  background:rgba(167,139,250,0.1); border:1px solid rgba(167,139,250,0.2);
  color:#a78bfa; padding:12px 28px; border-radius:12px;
  font-family:'Outfit',sans-serif; font-size:14px; font-weight:600;
  cursor:pointer; transition:all .25s; margin-top:8px;
}
.load-more-btn:hover { background:rgba(167,139,250,0.2); border-color:rgba(167,139,250,0.35) }
#cat-select {
  background:#111119; color:#fff; border:1px solid rgba(255,255,255,0.1);
  border-radius:12px; padding:10px 36px 10px 14px; font-family:'Outfit',sans-serif;
  font-size:13px; font-weight:600; outline:none; cursor:pointer;
  min-width:220px; transition:border-color .2s;
  -webkit-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1.5 2L6 6.5 10.5 2' stroke='rgba(255,255,255,0.3)' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center;
}
#cat-select:hover, #cat-select:focus { border-color:rgba(167,139,250,0.4) }
#cat-select option { background:#111119; color:#fff }
#search-input {
  background:#111119; color:#fff; border:1px solid rgba(255,255,255,0.1);
  border-radius:12px; padding:10px 14px; font-family:'Outfit',sans-serif;
  font-size:13px; font-weight:500; outline:none; flex:1; min-width:180px;
  transition:border-color .2s;
}
#search-input::placeholder { color:rgba(255,255,255,0.25) }
#search-input:focus { border-color:rgba(167,139,250,0.4) }

/* ---- Maintenance Overlay ---- */
.maint-overlay {
  position:fixed; inset:0; background:rgba(7,7,12,0.95); backdrop-filter:blur(12px);
  z-index:999; display:flex; align-items:center; justify-content:center;
}
.maint-box { text-align:center; max-width:400px; padding:20px }
.maint-icon { font-size:56px; margin-bottom:16px }
.maint-title { font-size:24px; font-weight:800; margin-bottom:10px }
.maint-msg { font-size:14px; color:rgba(255,255,255,0.5); line-height:1.7 }

/* ---- Loading Overlay ---- */
.loading-overlay {
  position:fixed; inset:0; z-index:150; display:flex;
  align-items:center; justify-content:center;
  backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px);
}
.spinner {
  width:40px; height:40px; border:3px solid rgba(167,139,250,0.2);
  border-top-color:#a78bfa; border-radius:50%;
  animation:spin .7s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg) } }

/* ---- Notification Popup ---- */
.notif-popup {
  position:fixed; inset:0; background:rgba(0,0,0,0.7); backdrop-filter:blur(8px);
  z-index:200; align-items:center; justify-content:center;
}
.notif-popup-inner {
  background:#111119; border:1px solid rgba(255,255,255,0.1); border-radius:18px;
  padding:32px; max-width:420px; width:90%; position:relative;
  animation:up .35s ease both;
}
.notif-popup-title {
  font-size:18px; font-weight:700; margin-bottom:10px; color:#a78bfa;
}
.notif-popup-msg {
  font-size:14px; color:rgba(255,255,255,0.6); line-height:1.7; margin-bottom:18px;
}
.notif-popup-close {
  position:absolute; top:12px; right:16px; font-size:22px; line-height:1;
  color:rgba(255,255,255,0.4); cursor:pointer; transition:color .2s;
}
.notif-popup-close:hover { color:#fff }

@media (max-width: 820px) {
    .grid { gap: 14px; padding: 0 18px 60px }
    header { padding: 16px 18px }
    .page-title { padding: 28px 18px 16px; font-size: 23px }
    .section-label { padding: 0 18px 10px }
    #cat-filter { padding:0 18px 10px; gap:8px }
    #search-input { min-width:140px }
    #cat-select { min-width:180px }
}
@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; gap: 12px; padding: 0 14px 50px }
    .card { border-radius: 14px }
    .card-body { padding: 12px 14px 14px }
    .card-name { font-size: 12px; min-height: 34px; margin-bottom: 12px }
    .card-img { aspect-ratio: 16/10 }
    .study-btn { padding: 10px 0; font-size: 13px; border-radius: 10px }
    .study-btn svg { width:14px; height:14px }
    .page-title { padding: 20px 12px 12px; font-size: 19px }
    header { padding: 12px 14px; flex-wrap:wrap; gap:8px }
    .brand { font-size: 19px }
    .header-right { gap:6px }
    .batch-count { font-size:11px; padding:4px 10px }
    #about-btn { font-size:12px; padding:5px 10px }
    #fav-nav-btn { font-size:12px; padding:5px 10px }
    #fav-nav-btn svg { width:14px; height:14px }
    .section-label { padding: 0 12px 8px; font-size: 11px }
    #cat-filter { padding:0 12px 10px; flex-direction:row; flex-wrap:wrap; gap:8px }
    #cat-select { min-width:0; flex:1 1 auto; width:auto; font-size:13px; padding:11px 14px; border-radius:12px; -webkit-appearance:none; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(255,255,255,0.3)' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:32px }
    #search-input { min-width:0; flex:1 1 100%; order:2; font-size:13px; padding:11px 14px; border-radius:12px }
    .load-more-btn { padding:10px 20px; font-size:13px; width:100%; max-width:280px }
    .heart-btn { width:30px; height:30px; top:8px; right:8px }
    .heart-btn svg { width:14px; height:14px }
    .tab-bar { gap:6px; flex-wrap:wrap }
    .tab { padding:6px 12px; font-size:12px }
    .notif-popup-inner { padding:24px; max-width:92% }
    .notif-popup-title { font-size:16px }
    .notif-popup-msg { font-size:13px }
}
@media (max-width: 400px) {
    .grid { grid-template-columns: 1fr; gap: 12px; padding: 0 14px 40px }
    .card-name { font-size: 13px; min-height: auto }
    .page-title { font-size: 17px; padding: 16px 14px 10px }
    header { padding: 10px 14px }
    .brand { font-size: 17px }
    .batch-count { display:none }
}
/* ---- Watch/Download Modal ---- */
.wd-modal {
  position:fixed; inset:0; background:rgba(0,0,0,0.7); backdrop-filter:blur(8px);
  z-index:200; display:flex; align-items:center; justify-content:center;
  animation:fadeIn .2s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.wd-dialog {
  background:#111119; border:1px solid rgba(255,255,255,0.1); border-radius:20px;
  padding:36px 32px 28px; max-width:400px; width:90%; position:relative;
  text-align:center; animation:up .3s ease both;
}
.wd-close {
  position:absolute; top:12px; right:16px; font-size:22px; line-height:1;
  color:rgba(255,255,255,0.4); cursor:pointer; transition:color .2s;
}
.wd-close:hover { color:#fff }
.wd-icon { font-size:48px; margin-bottom:10px }
.wd-title { font-size:16px; font-weight:600; color:rgba(255,255,255,0.85); margin-bottom:20px; line-height:1.4 }
.wd-actions { display:flex; gap:12px }
.wd-btn {
  flex:1; padding:14px 10px; border-radius:12px; border:none;
  font-family:'Outfit',sans-serif; font-size:15px; font-weight:700; cursor:pointer;
  transition:all .2s;
}
.wd-watch {
  background:linear-gradient(135deg,#7c3aed,#a855f7); color:#fff;
  box-shadow:0 4px 20px rgba(124,58,237,0.4);
}
.wd-watch:hover { box-shadow:0 6px 28px rgba(124,58,237,0.55); transform:translateY(-1px) }
.wd-dl {
  background:rgba(255,255,255,0.08); color:rgba(255,255,255,0.7);
}
.wd-dl:hover { background:rgba(255,255,255,0.14); color:#fff }
.wd-quality-list {
  display:flex; flex-direction:column; gap:8px; max-height:280px; overflow-y:auto;
}
.wd-quality-item {
  background:rgba(255,255,255,0.06); border:none; border-radius:10px;
  padding:12px 16px; cursor:pointer; transition:all .2s;
  font-family:'Outfit',sans-serif; font-size:14px; color:rgba(255,255,255,0.8);
  display:flex; align-items:center; justify-content:space-between;
}
.wd-quality-item:hover { background:rgba(124,58,237,0.25); color:#fff }
.wd-quality-item .qlabel { font-weight:600 }
.wd-quality-item .qdetail { font-size:12px; color:rgba(255,255,255,0.4) }
@media (max-width:640px) {
  .wd-dialog { padding:28px 20px 24px }
  .wd-icon { font-size:40px }
  .wd-title { font-size:14px }
  .wd-btn { font-size:14px; padding:12px 8px }
}

@media (max-width: 360px) {
    .grid { padding: 0 10px 30px }
    header { padding: 8px 10px }
    .page-title { padding: 14px 10px 10px; font-size: 15px }
    .card-body { padding: 10px 12px 12px }
    .card-name { font-size: 12px }
}