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

@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;
}

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

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

header:hover {
    background: #161b22;
}

.nav-logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.nav-logo-text .sloth {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

#search-bar {
    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;
}

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

#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;
}

.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;
}

#search-btn {
    background: var(--primary);
    color: white;
}

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

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

#results {
    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;
}

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

.card h3 {
    font-size: 13px;
    font-weight: 400;
    height: 26px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}



.save-card-btn {
    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;
}

.save-card-btn.active {
    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;
}

#reader-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    flex-direction: column;
    z-index: 999;
}

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

#reader-wrapper {
    flex: 1;
    overflow-y: auto;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.manga-page {
    width: 100%;
    max-width: 800px;
    display: block;
}

#chapter-overlay {
    position: fixed;
    top: 60px;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: calc(100% - 60px);
    background: var(--bg-nav);
    border-left: 2px solid var(--primary);
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

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

.chap-row.active {
    border: 1px solid var(--primary-glow);
    background: rgba(0, 191, 255, 0.1);
    background: var(--primary);
    color: #000;
}

.chap-row.read {
    opacity: 0.5;
}

.chap-num {
    color: var(--primary);
    font-weight: bold;
    margin-right: 10px;
}

.top-btn {
    background: #1f2937;
    color: #fff;
    border: 1px solid #30363d;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-btn.save-active {
    background: #1f2937;
    color: #fff;
    border: 1px solid #30363d;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
}

.loader {
    border: 4px solid #333;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

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