/* ==========================================================================
   MIRUREAD — COMPONENTS
   Refined dark blue interface with restrained purple / blue accents
   ========================================================================== */

/* ==========================================================================
   AMBIENT BACKGROUND
   ========================================================================== */

.noise {
    position: fixed;
    z-index: var(--z-base, 1);
    inset: 0;

    opacity: 0.022;
    pointer-events: none;

    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='.46'/%3E%3C/svg%3E");
}

.spotlight {
    position: fixed;
    z-index: 0;
    top: 50%;
    left: 50%;

    width: 620px;
    height: 620px;

    border-radius: 50%;
    pointer-events: none;

    background: radial-gradient(
        circle,
        rgba(112, 106, 225, 0.095) 0%,
        rgba(91, 116, 193, 0.045) 40%,
        transparent 72%
    );

    transform: translate(-50%, -50%);
    transition:
        left 180ms linear,
        top 180ms linear;
}

.ambient-orb {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(110px);
}

.ambient-orb.one {
    top: -180px;
    left: 14%;

    width: 450px;
    height: 450px;

    background: rgba(112, 101, 215, 0.12);
    animation: ambientOne 18s ease-in-out infinite alternate;
}

.ambient-orb.two {
    top: 27%;
    right: -240px;

    width: 500px;
    height: 500px;

    background: rgba(72, 109, 179, 0.105);
    animation: ambientTwo 22s ease-in-out infinite alternate;
}

.ambient-orb.three {
    bottom: -190px;
    left: 34%;

    width: 390px;
    height: 390px;

    background: rgba(94, 86, 170, 0.07);
    animation: ambientOne 24s ease-in-out infinite alternate-reverse;
}

.page-particles {
    position: fixed;
    z-index: 0;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.page-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;

    background: rgba(185, 193, 225, 0.26);
    animation: particleDrift 12s ease-in-out infinite;
}

/* ==========================================================================
   HERO
   ========================================================================== */

.hero {
    position: relative;
    isolation: isolate;

    display: grid;
    width: 100%;
    min-height: clamp(440px, 47vw, 590px);
    grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
    align-items: center;

    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);

    background:
        linear-gradient(
            100deg,
            rgba(19, 23, 37, 0.98) 0%,
            rgba(20, 24, 40, 0.92) 44%,
            rgba(24, 29, 48, 0.66) 100%
        );

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.27),
        inset 0 1px rgba(255, 255, 255, 0.045);
}

.hero::before {
    content: "";
    position: absolute;
    z-index: -2;
    inset: 0;

    background:
        linear-gradient(
            90deg,
            rgba(14, 17, 28, 0.99) 0%,
            rgba(14, 17, 28, 0.89) 39%,
            rgba(14, 17, 28, 0.36) 72%,
            rgba(14, 17, 28, 0.22) 100%
        ),
        url("https://images.unsplash.com/photo-1519638399535-1b036603ac77?auto=format&fit=crop&w=1900&q=82")
        center 34% / cover;

    filter: saturate(0.6) contrast(0.98);
}

.hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;

    background:
        radial-gradient(
            circle at 79% 45%,
            rgba(116, 108, 222, 0.17),
            transparent 31%
        ),
        linear-gradient(
            to top,
            rgba(11, 13, 22, 0.8),
            transparent 52%
        );
}

.hero-content {
    position: relative;
    z-index: var(--z-card-top, 3);
    width: 100%;
    max-width: 790px;
    padding: clamp(38px, 5vw, 76px);
}

.hero-kicker {
    display: inline-flex;
    width: max-content;
    align-items: center;
    gap: 8px;

    margin-bottom: 19px;
    padding: 7px 11px;

    border: 1px solid var(--accent-border);
    border-radius: var(--radius-pill);

    background: rgba(var(--accent-rgb), 0.1);
    color: #c0bdff;

    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.hero-kicker::before {
    content: "";
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent-light);
    animation: pulseDot 2.2s ease-in-out infinite;
}

.hero h1 {
    max-width: 820px;

    color: var(--text);
    font-size: clamp(3rem, 5.6vw, 6.15rem);
    font-weight: 880;
    line-height: 0.92;
    letter-spacing: -0.075em;
}

.hero h1 span {
    display: block;
    padding-right: 0.08em;
    padding-bottom: 0.09em;

    background: var(--accent-gradient-wide);
    background-clip: text;
    color: transparent;

    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    max-width: 610px;
    margin-top: 22px;

    color: #bec4d5;
    font-size: clamp(0.92rem, 1.2vw, 1.04rem);
    line-height: 1.72;
}

.hero-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 22px;
}

.hero-meta span {
    padding: 7px 10px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: rgba(255, 255, 255, 0.042);
    color: var(--text-soft);

    font-size: 0.7rem;
    font-weight: 650;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    margin-top: 29px;
}

.hero-visual {
    position: relative;
    z-index: var(--z-card-overlay, 2);

    display: flex;
    min-height: 440px;
    align-items: center;
    justify-content: center;

    padding: 48px 60px 48px 20px;
    perspective: 1300px;
}

/* ==========================================================================
   3D BOOK
   ========================================================================== */

.book-scene {
    position: relative;
    width: clamp(220px, 18vw, 288px);
    aspect-ratio: 2 / 3;
    perspective: 1300px;
    cursor: pointer;
    animation: bookSceneFloat 5.2s ease-in-out infinite;
    will-change: transform;
}

.book-scene::after {
    content: "";
    position: absolute;
    z-index: -1;
    bottom: -42px;
    left: 50%;

    width: 82%;
    height: 24px;

    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    filter: blur(13px);

    transform: translateX(-50%);
    animation: bookShadowFloat 5.2s ease-in-out infinite;
}

.book-3d {
    position: absolute;
    inset: 0;

    transform-style: preserve-3d;
    transform:
        rotateX(3deg)
        rotateY(-17deg)
        rotateZ(2deg);

    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.book-scene:not(:has(.book-3d)) {
    transform-style: preserve-3d;
    transform:
        rotateX(3deg)
        rotateY(-17deg)
        rotateZ(2deg);

    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.book-cover {
    position: absolute;
    z-index: var(--z-card-top, 3);
    inset: 0;

    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 11px 20px 20px 11px;

    background:
        linear-gradient(
            to top,
            rgba(10, 12, 19, 0.96),
            rgba(10, 12, 19, 0.26) 48%,
            transparent 72%
        ),
        url("https://images.unsplash.com/photo-1542204165-65bf26472b9b?auto=format&fit=crop&w=900&q=84")
        center / cover;

    box-shadow:
        -24px 30px 54px rgba(0, 0, 0, 0.43),
        11px 5px 32px rgba(39, 42, 88, 0.21),
        inset 3px 0 7px rgba(255, 255, 255, 0.075);

    transform: translateZ(28px);
}

.book-cover::before {
    content: "";
    position: absolute;
    inset: 0;

    background: linear-gradient(
        112deg,
        rgba(255, 255, 255, 0.18),
        transparent 20%,
        transparent 72%,
        rgba(129, 123, 225, 0.07)
    );

    pointer-events: none;
}

.book-cover::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 13px;

    width: 1px;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 3px 0 5px rgba(0, 0, 0, 0.35);
}

.book-spine {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: -18px;

    width: 32px;

    border-radius: 6px 0 0 6px;
    background: linear-gradient(
        90deg,
        #22283d 0%,
        #505791 66%,
        #7775c9 100%
    );

    transform: rotateY(-90deg) translateZ(16px);
    transform-origin: right;
}

.book-pages {
    position: absolute;
    inset: 7px -12px 7px 8px;

    border-radius: 5px 16px 16px 5px;

    background: repeating-linear-gradient(
        0deg,
        #aaaeb8 0,
        #aaaeb8 1px,
        #e2e1e5 1px,
        #e2e1e5 3px
    );

    box-shadow: 13px 18px 36px rgba(0, 0, 0, 0.3);
    transform: translateZ(3px);
}

.book-back {
    position: absolute;
    inset: 2px;
    border-radius: 11px 18px 18px 11px;
    background: #252a3d;
    transform: translateZ(-4px);
}

.book-info {
    position: absolute;
    z-index: var(--z-card-overlay, 2);
    right: 18px;
    bottom: 24px;
    left: 24px;
}

.book-info small {
    color: #c0bdff;
    font-size: 0.59rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 1px 2px rgba(0, 0, 0, 0.9);
}

.book-info h2 {
    margin-top: 5px;

    color: #ffffff;
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    line-height: 1.02;
    letter-spacing: -0.055em;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.85);
}

.book-cover-img {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.floating-ring {
    position: absolute;
    width: min(390px, 86%);
    aspect-ratio: 1;

    border: 1px solid rgba(158, 154, 237, 0.12);
    border-radius: 50%;

    pointer-events: none;
    transform: rotateX(68deg);
    animation: ringDrift 22s linear infinite;
}

.floating-ring::before,
.floating-ring::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(126, 145, 212, 0.075);
    border-radius: 50%;
}

.floating-ring::before {
    inset: 30px;
}

.floating-ring::after {
    inset: 72px;
}

.floating-chip {
    display: none !important;
    pointer-events: none;
    pointer-events: none !important;
}

/* Keep hero progress bubble away from the outer edge. */

.hero-visual .progress-bubble,
.hero-visual .hero-progress-chip,
.hero-visual [class*="progress-chip"] {
    right: clamp(26px, 3vw, 52px);
    max-width: calc(100% - 52px);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.primary-button,
.secondary-button,
.action-btn {
    display: inline-flex;
    min-height: 47px;
    align-items: center;
    justify-content: center;
    gap: 9px;

    padding: 0 21px;

    border-radius: 14px;
    cursor: pointer;

    font-size: 0.84rem;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;

    transition:
        transform var(--duration-medium) var(--ease-out),
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease,
        color var(--duration-medium) ease;
}

.primary-button,
.action-btn.primary {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--accent-gradient);
    box-shadow: 0 12px 26px rgba(48, 47, 112, 0.24);
    color: #ffffff;
}

.primary-button:hover,
.action-btn.primary:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 16px 32px rgba(48, 47, 112, 0.3);
    transform: translateY(-2px);
}

.primary-button:active,
.action-btn.primary:active {
    transform: scale(0.975);
}

.secondary-button,
.action-btn {
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.052);
    color: var(--text);
}

.secondary-button:hover,
.action-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.078);
    transform: translateY(-2px);
}

.secondary-button.selected,
#hero-fav-btn.selected {
    border-color: var(--accent-border);
    background: var(--accent-subtle);
    color: #c7c4ff;
}

.primary-button svg,
.secondary-button svg,
.action-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.action-btns {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 11px;
    margin-top: 28px;
}

.icon-btn {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;

    padding: 8px 13px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface-solid);
    color: var(--text-soft);
    cursor: pointer;

    font-size: 0.8rem;
    font-weight: 650;
    white-space: nowrap;

    transition:
        background var(--duration-medium) ease,
        border-color var(--duration-medium) ease,
        color var(--duration-medium) ease,
        transform var(--duration-medium) var(--ease-out);
}

.icon-btn:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: scale(0.96);
}

.icon-btn.active {
    border-color: rgba(216, 124, 145, 0.34);
    background: rgba(216, 124, 145, 0.12);
    color: var(--heart);
}

.icon-btn.active svg,
.icon-btn.active svg path {
    fill: currentColor;
    stroke: currentColor;
}

/* ==========================================================================
   SECTION HEADERS
   ========================================================================== */

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.section-heading small {
    display: block;
    margin-bottom: 5px;

    color: #aaa7ef;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.section-heading h2 {
    color: var(--text);
    font-size: clamp(1.38rem, 2vw, 1.88rem);
    font-weight: 780;
    letter-spacing: -0.045em;
}

.section-link {
    display: inline-flex;
    align-items: center;

    border: 0;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;

    font-size: 0.75rem;
    font-weight: 700;

    transition:
        color var(--duration-fast) ease,
        transform var(--duration-fast) ease;
}

.section-link:hover {
    color: var(--accent-light);
    transform: translateX(3px);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;

    margin: 32px 0 16px;

    color: var(--text);
    font-size: 1.12rem;
    font-weight: 780;
    letter-spacing: -0.025em;
}

.section-title::before {
    content: "";
    width: 3px;
    height: 19px;
    flex: 0 0 auto;
    border-radius: 3px;
    background: var(--accent-gradient);
}

/* ==========================================================================
   CONTINUE READING
   ========================================================================== */

.continue-card {
    position: relative;

    display: grid;
    min-width: 0;
    min-height: 166px;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 18px;

    padding: 18px;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: linear-gradient(
        135deg,
        rgba(27, 32, 49, 0.96),
        rgba(18, 22, 35, 0.96)
    );

    box-shadow: var(--shadow-sm);
    cursor: pointer;

    transition:
        transform var(--duration-slow) var(--ease-out),
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease,
        box-shadow var(--duration-slow) ease;
}

.continue-card::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -45px;

    width: 150px;
    height: 150px;

    border-radius: 50%;
    background: var(--card-color, var(--accent));
    opacity: 0.07;
    filter: blur(62px);
    pointer-events: none;
}

.continue-card:hover {
    border-color: rgba(var(--accent-rgb), 0.25);
    background: linear-gradient(
        135deg,
        rgba(31, 36, 55, 0.98),
        rgba(20, 24, 38, 0.98)
    );
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.continue-cover {
    width: 96px;
    height: 132px;

    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);

    object-fit: cover;
}

.continue-info {
    min-width: 0;
}

.continue-info small {
    display: block;

    overflow: hidden;

    color: var(--text-muted);
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.065em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.continue-info h3 {
    margin-top: 6px;
    overflow: hidden;

    color: var(--text);
    font-size: 0.98rem;
    font-weight: 720;
    letter-spacing: -0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.continue-info p {
    margin-top: 7px;
    color: var(--text-soft);
    font-size: 0.73rem;
}

.progress-track {
    width: 100%;
    height: 5px;
    margin-top: 15px;
    overflow: hidden;

    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.075);
}

.progress-fill {
    position: relative;
    height: 100%;

    border-radius: inherit;
    background: var(--accent-gradient);
    transform-origin: left;
}

.progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.55),
        transparent
    );
    transform: translateX(-100%);
    animation: progress-shine 2.7s ease-in-out infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#dashboard-view .progress-fill::after,
#dashboard-view .card-progress-fill::after,
#dashboard-view .progress-track::after,
#dashboard-view .card-progress-track::after {
    display: none !important;
    content: none !important;
    animation: none !important;
}

/* ==========================================================================
   MANGA CARDS
   ========================================================================== */

.manga-card,
.card {
    position: relative;
    min-width: 0;
    overflow: visible;

    cursor: pointer;
    perspective: 900px;
    user-select: none;

    -webkit-user-select: none;
}

.manga-card-inner,
.card-inner {
    position: relative;

    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 19px;

    background: var(--surface-solid);
    box-shadow: 0 13px 30px rgba(0, 0, 0, 0.24);

    transform: translateZ(0);
    transform-style: preserve-3d;

    transition:
        transform 180ms ease-out,
        border-color var(--duration-medium) ease,
        box-shadow var(--duration-slow) ease;
}

/*
   The card itself is not clipped. This prevents the top of a scaled card
   from appearing cut by a dark line while hovering.
*/

.manga-card:hover,
.card:hover {
    z-index: var(--z-card-top, 3);
}

.manga-card:hover .manga-card-inner,
.card:hover .card-inner {
    border-color: rgba(165, 160, 246, 0.27);
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.34);
    transform: translateY(-5px) scale(1.022);
}

.manga-cover,
.card-cover {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    transition:
        transform 520ms var(--ease-out),
        filter 360ms ease;
}

.manga-card:hover .manga-cover,
.card:hover .card-cover,
.card:hover img {
    filter: saturate(1.035) contrast(1.015);
    transform: scale(1.045);
}

.manga-shine {
    position: absolute;
    z-index: var(--z-card-top, 3);
    inset: 0;

    opacity: 0;
    pointer-events: none;

    background: radial-gradient(
        circle at var(--shine-x, 50%) var(--shine-y, 50%),
        rgba(255, 255, 255, 0.19),
        transparent 35%
    );

    mix-blend-mode: soft-light;
    transition: opacity var(--duration-medium) ease;
}

.manga-card:hover .manga-shine {
    opacity: 0.7;
}

.manga-overlay,
.card-overlay {
    position: absolute;
    z-index: var(--z-card-overlay, 2);
    inset: 0;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    padding: 62px 15px 15px;

    background: linear-gradient(
        to top,
        rgba(8, 10, 16, 0.98) 0%,
        rgba(8, 10, 16, 0.76) 32%,
        rgba(8, 10, 16, 0.13) 65%,
        transparent 78%
    );

    pointer-events: none;
    transform: translateZ(18px);
}

.manga-overlay h3,
.card-overlay h3 {
    display: -webkit-box;
    overflow: hidden;

    color: var(--text);
    font-size: 0.86rem;
    font-weight: 720;
    line-height: 1.3;
    letter-spacing: -0.024em;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.card-overlay-top {
    position: absolute;
    z-index: var(--z-card-overlay, 2);
    inset: 0 0 auto;

    padding: 12px 13px 35px;

    background: linear-gradient(
        to bottom,
        rgba(8, 10, 16, 0.86),
        transparent
    );

    pointer-events: none;
}

.card-overlay-top h3 {
    overflow: hidden;

    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manga-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;

    margin-top: 8px;

    color: var(--text-soft);
    font-size: 0.61rem;
    font-weight: 650;
}

.manga-status,
.card-overlay .status {
    color: #9fb5e8;
    font-size: 0.62rem;
    font-weight: 750;
}

.manga-badge {
    position: absolute;
    z-index: var(--z-card-top, 3);
    top: 10px;
    left: 10px;

    max-width: calc(100% - 20px);
    padding: 5px 8px;
    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;

    background: rgba(13, 16, 25, 0.88);
    color: #e8eafe;

    font-size: 0.54rem;
    font-weight: 800;
    letter-spacing: 0.075em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;

    transform: translateZ(24px);
}

.favorite-button {
    position: absolute;
    z-index: var(--z-card-top, 3);
    top: 10px;
    right: 10px;

    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;

    background: rgba(13, 16, 25, 0.88);
    color: var(--text);
    cursor: pointer;

    opacity: 0;
    transform: translateY(-5px) translateZ(28px);

    transition:
        opacity var(--duration-medium) ease,
        transform var(--duration-medium) var(--ease-out),
        color var(--duration-medium) ease,
        background var(--duration-medium) ease;
}

.manga-card:hover .favorite-button,
.card:hover .favorite-button,
.favorite-button.active {
    opacity: 1;
    transform: translateY(0) translateZ(28px);
}

.favorite-button:hover {
    background: rgba(31, 36, 53, 0.96);
}

.favorite-button.active {
    color: var(--heart);
}

.favorite-button svg {
    width: 16px;
    height: 16px;
}

.favorite-button.active svg {
    fill: currentColor;
}

.card-progress-track {
    position: absolute;
    z-index: var(--z-card-overlay, 2);
    right: 0;
    bottom: 0;
    left: 0;

    height: 4px;
    margin: 0;

    border-radius: 0;
    background: rgba(255, 255, 255, 0.105);
}

.card-progress-fill {
    height: 100%;
    border-radius: 0;
    background: var(--accent-gradient);
    transition: width 280ms var(--ease-standard);
}

.card-unread-badge {
    position: absolute;
    z-index: var(--z-card-top, 3);
    top: 9px;
    right: 9px;
    left: auto;

    padding: 4px 7px;

    border: 1px solid rgba(150, 145, 243, 0.28);
    border-radius: 9px;

    background: rgba(61, 58, 126, 0.9);
    color: #ffffff;

    font-size: 0.61rem;
    font-weight: 750;
    letter-spacing: 0.015em;
    text-transform: none;
}

.card-sync-badge {
    position: absolute;
    z-index: var(--z-card-top, 3);
    top: 9px;
    left: 9px;

    display: inline-flex;
    max-width: calc(100% - 18px);
    align-items: center;
    gap: 4px;

    padding: 4px 8px;
    overflow: hidden;

    border-radius: 9px;

    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;

    pointer-events: none;
}

.card-sync-badge.downloading {
    border: 1px solid var(--info-border);
    background: rgba(36, 66, 103, 0.92);
    color: #c2daf4;
}

.card-sync-badge.autosync {
    border: 1px solid var(--success-border);
    background: rgba(39, 79, 67, 0.9);
    color: #bee4d5;
}

/* Latest cards never display reading progress. */

#latest-grid .card-progress-track,
#latest-grid .card-progress-fill,
#latest-grid .progress-track,
#latest-grid .progress-fill {
    display: none !important;
}

/* ==========================================================================
   ACTIVITY AND STATS
   ========================================================================== */

.stats-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.55fr);
    gap: 18px;
    align-items: stretch;
}

.activity-panel,
.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: linear-gradient(
        140deg,
        rgba(27, 32, 49, 0.94),
        rgba(17, 21, 34, 0.96)
    );

    box-shadow:
        var(--shadow-sm),
        inset 0 1px rgba(255, 255, 255, 0.035);
}

.activity-panel {
    display: flex;
    min-width: 0;
    min-height: auto;
    flex-direction: column;

    padding: 24px;
    overflow: visible;
}

.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.activity-title-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.activity-header h3 {
    color: var(--text);
    font-size: 1.02rem;
    font-weight: 750;
    letter-spacing: -0.015em;
    margin: 0;
}

.activity-header span#stats-weekly-label {
    color: var(--text-muted, #7f8a9d);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.activity-chart-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-layout-switch {
    display: inline-flex;
    align-items: center;
    background: rgba(8, 11, 20, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
}

.chart-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    font-size: 0.72rem;
    font-weight: 650;
    color: var(--text-muted, #7f8a9d);
    background: transparent;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    line-height: 1;
}

.chart-view-btn:hover {
    color: var(--text, #f5f7ff);
    background: rgba(255, 255, 255, 0.05);
}

.chart-view-btn.active {
    background: rgba(102, 119, 217, 0.22);
    color: #b4beff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.chart.activity-chart-wrapper {
    display: block;
    width: 100%;
    height: auto;
    min-height: 200px;
    max-height: none;
    margin-top: 18px;
}

/* Split 2-chart Grid */
.stats-chart-split-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

.activity-subcard {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(13, 17, 28, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 14px;
    padding: 16px 18px 12px;
    position: relative;
    overflow: visible;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.activity-subcard:hover {
    border-color: rgba(130, 119, 223, 0.32);
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.activity-subcard.subcard-comparison {
    border-color: rgba(45, 212, 191, 0.12);
}

.activity-subcard.subcard-comparison:hover {
    border-color: rgba(45, 212, 191, 0.35);
    box-shadow: 0 8px 24px -6px rgba(45, 212, 191, 0.15);
}

.activity-subcard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.subcard-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subcard-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #b7b0fa;
}

.subcard-badge .badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8277df;
    box-shadow: 0 0 8px #8277df;
}

.subcard-period {
    font-size: 0.7rem;
    color: var(--text-muted, #7f8a9d);
    font-weight: 500;
}

.subcard-value-display {
    text-align: right;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
}

.subcard-hero-num {
    font-size: 1.45rem;
    font-weight: 850;
    color: var(--text, #f5f7ff);
    letter-spacing: -0.04em;
    line-height: 1;
}

.subcard-hero-num.num-emerald {
    color: #2dd4bf;
    text-shadow: 0 0 14px rgba(45, 212, 191, 0.35);
}

.subcard-hero-unit {
    font-size: 0.72rem;
    font-weight: 650;
    color: var(--text-muted, #7f8a9d);
    text-transform: lowercase;
}

.subcard-hero-unit.unit-emerald {
    color: #5eead4;
}

/* Mode pill switch in card 2 */
.subcard-mode-pills {
    display: inline-flex;
    background: rgba(7, 9, 16, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 2px;
    gap: 2px;
}

.mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    font-size: 0.68rem;
    font-weight: 650;
    color: var(--text-muted, #7f8a9d);
    background: transparent;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.mode-pill:hover {
    color: var(--text, #f5f7ff);
}

.mode-pill.active {
    background: rgba(45, 212, 191, 0.2);
    color: #2dd4bf;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.mode-pill .dot-emerald {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2dd4bf;
    box-shadow: 0 0 6px #2dd4bf;
}

.mode-pill .dot-cyan {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
}

/* SVG Container */
.activity-svg-container {
    width: 100%;
    height: 160px;
    position: relative;
    margin: 4px 0 6px;
}

.activity-svg-container svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Grid & Labels */
.stats-chart-grid line {
    stroke: rgba(255, 255, 255, 0.045);
    stroke-dasharray: 4 4;
    stroke-width: 1;
}

.stats-chart-labels text {
    fill: #7f8a9d;
    font-size: 10.5px;
    font-weight: 650;
    text-anchor: middle;
    user-select: none;
}

/* Curve 1: Obsidian Indigo Style */
.stats-chart-line {
    fill: none;
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 4000;
    stroke-dashoffset: 0;
    animation: chartPathReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stats-chart-area {
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chart-point-item {
    cursor: pointer;
    outline: none;
}

.stats-chart-points circle.chart-dot {
    fill: #0c0f1d;
    stroke: #8277df;
    stroke-width: 3px;
    transition:
        r 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        stroke-width 0.2s ease,
        fill 0.2s ease,
        filter 0.2s ease;
    cursor: pointer;
}

.stats-chart-points circle.chart-dot:hover,
.stats-chart-points circle.chart-dot.is-active,
.chart-point-item:focus circle.chart-dot {
    r: 9px;
    stroke-width: 4px;
    fill: #b4acf7;
    filter: drop-shadow(0 0 14px rgba(130, 119, 223, 0.95));
}

/* Curve 2: Cyberpunk Emerald/Cyan Style (DIFFERENT STYLE!) */
.stats-chart-line-emerald {
    fill: none;
    stroke-width: 4.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 4000;
    stroke-dashoffset: 0;
    animation: chartPathReveal 1.05s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stats-chart-area-emerald {
    pointer-events: none;
}

.stats-chart-points-emerald circle.chart-dot {
    fill: #080d14;
    stroke: #2dd4bf;
    stroke-width: 3px;
    transition:
        r 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        stroke-width 0.2s ease,
        fill 0.2s ease,
        filter 0.2s ease;
    cursor: pointer;
}

.stats-chart-points-emerald circle.chart-dot:hover,
.stats-chart-points-emerald circle.chart-dot.is-active,
.chart-point-item:focus circle.chart-dot {
    r: 9px;
    stroke-width: 4px;
    fill: #5eead4;
    filter: drop-shadow(0 0 14px rgba(45, 212, 191, 0.95));
}

/* Touch hit-targets */
.chart-touch-target {
    cursor: pointer;
}

/* High-Fidelity Floating Chart Tooltip */
.chart-tooltip {
    position: absolute;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -100%) translateY(-10px) scale(0.92);
    transition:
        opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.15s cubic-bezier(0.16, 1, 0.3, 1),
        left 0.1s cubic-bezier(0.16, 1, 0.3, 1),
        top 0.1s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.15s ease;
    background: rgba(14, 18, 30, 0.96);
    border: 1px solid rgba(130, 119, 223, 0.5);
    border-radius: 9px;
    padding: 5px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    box-shadow:
        0 8px 24px -4px rgba(0, 0, 0, 0.75),
        0 0 16px rgba(130, 119, 223, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chart-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -100%) translateY(-10px) scale(1);
}

/* Tooltip caret pointing down to dot */
.chart-tooltip::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: calc(50% + var(--caret-offset, 0px));
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(130, 119, 223, 0.85);
    transition: left 0.1s ease;
}

/* Position below when dot is near top */
.chart-tooltip.pos-bottom {
    transform: translate(-50%, 0) translateY(12px) scale(0.92);
}

.chart-tooltip.pos-bottom.visible {
    transform: translate(-50%, 0) translateY(12px) scale(1);
}

.chart-tooltip.pos-bottom::after {
    bottom: auto;
    top: -6px;
    border-top: none;
    border-bottom: 6px solid rgba(130, 119, 223, 0.85);
}

/* Emerald Theme */
.chart-tooltip.theme-emerald {
    border-color: rgba(45, 212, 191, 0.55);
    box-shadow:
        0 8px 24px -4px rgba(0, 0, 0, 0.75),
        0 0 16px rgba(45, 212, 191, 0.3);
}

.chart-tooltip.theme-emerald::after {
    border-top-color: rgba(45, 212, 191, 0.9);
}

.chart-tooltip.theme-emerald.pos-bottom::after {
    border-bottom-color: rgba(45, 212, 191, 0.9);
}

.chart-tooltip-day {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted, #7f8a9d);
    text-transform: capitalize;
    letter-spacing: 0.02em;
    line-height: 1;
}

.chart-tooltip-val {
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1.1;
    margin-top: 1px;
}

.chart-tooltip-val .val-number {
    font-size: 0.96rem;
    font-weight: 850;
    color: #f5f7ff;
    letter-spacing: -0.02em;
}

.chart-tooltip.theme-emerald .chart-tooltip-val .val-number {
    color: #2dd4bf;
    text-shadow: 0 0 10px rgba(45, 212, 191, 0.45);
}

.chart-tooltip.theme-indigo .chart-tooltip-val .val-number {
    color: #b7b0fa;
    text-shadow: 0 0 10px rgba(130, 119, 223, 0.45);
}

.chart-tooltip-val .val-unit {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-soft, #b7c0cf);
}

/* Subcard Footer */
.subcard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.7rem;
    color: var(--text-muted, #7f8a9d);
}

.subcard-footer strong {
    color: var(--text-soft, #b7c0cf);
    font-weight: 700;
}

/* Unified Wide Chart View */
.stats-chart-unified-container {
    display: flex;
    flex-direction: column;
    background: rgba(13, 17, 28, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 14px;
    padding: 16px 20px 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.unified-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.unified-chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
}

.legend-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 650;
    color: var(--text-muted, #7f8a9d);
}

.legend-badge .badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-badge.legend-primary .badge-dot {
    background: #8277df;
    box-shadow: 0 0 8px #8277df;
}

.legend-badge.legend-secondary .badge-dot {
    background: #2dd4bf;
    box-shadow: 0 0 8px #2dd4bf;
}

@keyframes chartPathReveal {
    from {
        stroke-dashoffset: 4000;
        opacity: 0.3;
    }
    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.stats-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    display: flex;
    min-width: 0;
    min-height: 140px;
    flex-direction: column;
    justify-content: space-between;

    padding: 19px;

    transition:
        transform var(--duration-medium) var(--ease-out),
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease;
}

.stat-card:hover {
    border-color: rgba(var(--accent-rgb), 0.23);
    background: linear-gradient(
        140deg,
        rgba(31, 36, 55, 0.98),
        rgba(20, 24, 38, 0.98)
    );
    transform: translateY(-3px);
}

.stat-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;

    border: 1px solid rgba(var(--accent-rgb), 0.14);
    border-radius: 11px;

    background: rgba(var(--accent-rgb), 0.11);
    color: #aaa7f3;
}

.stat-value {
    display: block;
    overflow: hidden;

    color: var(--text);
    font-size: 1.42rem;
    font-weight: 820;
    letter-spacing: -0.055em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 650;
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.preview-modal,
.custom-modal-overlay {
    position: fixed;
    z-index: var(--z-modal, 10000);
    inset: 0;

    display: grid;
    place-items: center;

    padding:
        max(20px, env(safe-area-inset-top, 0px))
        20px
        max(20px, env(safe-area-inset-bottom, 0px));

    background: rgba(5, 7, 12, 0.79);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);

    transition:
        opacity var(--duration-medium) ease,
        visibility var(--duration-medium) ease;
}

.preview-modal.active,
.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-panel,
.custom-modal-box {
    position: relative;

    width: min(100%, 520px);
    max-height: min(86vh, 760px);
    max-height: min(86dvh, 760px);

    padding: 30px;
    overflow-x: hidden;
    overflow-y: auto;

    border: 1px solid var(--border-strong);
    border-radius: 24px;

    background:
        radial-gradient(
            circle at 88% 0%,
            rgba(var(--accent-rgb), 0.1),
            transparent 35%
        ),
        #171b2a;

    box-shadow: var(--shadow-xl);

    transform: translateY(14px) scale(0.98);

    transition: transform var(--duration-slow) var(--ease-out);
}

.preview-modal.active .modal-panel,
.custom-modal-overlay.active .custom-modal-box {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;

    display: grid;
    width: 37px;
    height: 37px;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    cursor: pointer;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.075);
    color: var(--text);
}

.modal-kicker {
    color: #aaa7ef;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.modal-panel h2,
.custom-modal-box h3 {
    margin-top: 8px;

    color: var(--text);
    font-size: 1.7rem;
    font-weight: 780;
    letter-spacing: -0.04em;
}

.modal-panel p,
.custom-modal-box p {
    margin-top: 13px;

    color: var(--text-soft);
    font-size: 0.87rem;
    line-height: 1.7;
}

.modal-actions,
.custom-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;

    margin-top: 24px;
}

.custom-modal-box input {
    width: 100%;
    margin-top: 16px;
    padding: 12px 14px;

    border: 1px solid var(--border-strong);
    border-radius: 11px;
    outline: none;

    background: var(--surface-solid);
    color: var(--text);
}

.custom-modal-box input:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-focus);
}

/* ==========================================================================
   TOASTS
   ========================================================================== */

.toast {
    position: fixed;
    z-index: var(--z-toast, 20000);
    top: 20px;
    right: 20px;

    display: flex;
    max-width: min(380px, calc(100vw - 30px));
    align-items: center;
    gap: 11px;

    padding: 13px 17px;

    border: 1px solid var(--border-strong);
    border-radius: 14px;

    background: rgba(25, 29, 44, 0.97);
    box-shadow: var(--shadow-lg);
    color: var(--text);

    font-size: 0.8rem;
    font-weight: 650;

    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);

    transition:
        opacity var(--duration-medium) ease,
        transform var(--duration-medium) var(--ease-out);
}

.toast.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.toast-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--success);
}

.toast-container {
    position: fixed;
    z-index: var(--z-toast, 20000);
    top: 20px;
    right: 20px;

    display: flex;
    max-width: min(420px, calc(100vw - 30px));
    flex-direction: column;
    gap: 9px;

    pointer-events: none;
}

.toast-container .toast,
.toast-item {
    position: relative;
    top: auto;
    right: auto;

    display: flex;
    max-width: 100%;
    align-items: center;
    gap: 10px;

    padding: 12px 16px;

    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: 12px;

    background: rgba(25, 29, 44, 0.98);
    box-shadow: var(--shadow-md);
    color: var(--text);

    font-size: 0.81rem;
    font-weight: 620;
    line-height: 1.4;

    opacity: 1;
    pointer-events: auto;
    transform: none;

    animation: toastIn 260ms var(--ease-out) both;
}

.toast-container .toast.success,
.toast-item.success {
    border-left-color: var(--success);
}

.toast-container .toast.error,
.toast-item.error {
    border-left-color: var(--danger);
}

.toast-container .toast.info,
.toast-item.info {
    border-left-color: var(--info);
}

/* ==========================================================================
   SERIES DETAIL
   ========================================================================== */

.series-detail-header {
    position: relative;

    width: 100%;
    margin-bottom: 28px;
    padding: 28px;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: var(--radius-xl);

    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
}

.series-hero-backdrop {
    position: absolute;
    z-index: 0;
    inset: -30px;

    background-position: center;
    background-size: cover;

    filter: blur(32px) brightness(0.35) saturate(0.68);
    opacity: 0.5;
    pointer-events: none;

    -webkit-mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 1) 32%,
        rgba(0, 0, 0, 0) 100%
    );

    mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 1) 32%,
        rgba(0, 0, 0, 0) 100%
    );
}

.series-detail-card {
    position: relative;
    z-index: var(--z-base, 1);

    display: flex;
    align-items: flex-start;
    gap: 29px;
}

.series-poster-wrapper {
    width: 178px;
    aspect-ratio: 2 / 3;
    flex: 0 0 auto;
    overflow: hidden;

    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

.series-cover-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.series-info-content {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 14px;
}

.series-detail-title {
    margin: 0;

    color: var(--text);
    font-size: clamp(1.5rem, 2.7vw, 2.35rem);
    font-weight: 820;
    line-height: 1.12;
    letter-spacing: -0.042em;
}

.series-meta-badges,
.series-genres-list,
.series-action-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-badge {
    padding: 5px 10px;

    border: 1px solid var(--border);
    border-radius: 10px;

    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.meta-badge.status-ongoing {
    border-color: var(--success-border);
    background: var(--success-soft);
    color: #9bd5bf;
}

.meta-badge.status-ended {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.055);
    color: var(--text-soft);
}

.meta-badge.publisher-badge {
    border-color: var(--accent-border);
    background: var(--accent-subtle);
    color: #b9b5fa;
}

.meta-badge.age-badge {
    border-color: var(--warning-border);
    background: var(--warning-soft);
    color: #e3bd7d;
}

.genre-tag {
    padding: 4px 10px;

    border: 1px solid var(--border);
    border-radius: var(--radius-pill);

    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);

    font-size: 0.72rem;
    font-weight: 600;
}

.series-synopsis-block {
    margin-top: 3px;
}

.series-synopsis-block p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;

    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.68;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.series-synopsis-block.expanded p {
    display: block;
    overflow: visible;
}

.synopsis-toggle-btn {
    padding: 6px 0 0;

    border: 0;
    background: none;
    color: var(--accent-light);
    cursor: pointer;

    font-size: 0.79rem;
    font-weight: 700;
}

.synopsis-toggle-btn:hover {
    text-decoration: underline;
}

.series-action-bar {
    margin-top: 9px;
}

.series-action-bar .play-btn {
    background: var(--accent-gradient);
    box-shadow: 0 9px 22px rgba(48, 47, 112, 0.22);
    color: #ffffff;
    font-weight: 750;
}

.action-select.mode-select-detail {
    padding: 10px 15px;

    border: 1px solid var(--border-strong);
    border-radius: 12px;
    outline: none;

    background: var(--surface-solid);
    color: var(--text);
    cursor: pointer;

    font-size: 0.82rem;
}

/* ==========================================================================
   CHAPTER LIST
   ========================================================================== */

.chapters-list {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 9px;

    margin-top: 14px;
    padding-bottom: 40px;
}

.chapter-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 15px 18px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface-solid);
    cursor: pointer;
    user-select: none;

    transition:
        background var(--duration-medium) ease,
        border-color var(--duration-medium) ease,
        transform var(--duration-medium) var(--ease-out);
}

.chapter-list-item:hover {
    border-color: var(--accent-border);
    background: var(--surface-hover);
    transform: translateX(3px);
}

.chapter-left {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 13px;
}

.chapter-play-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;

    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent-light);

    font-size: 0.82rem;

    transition:
        background var(--duration-fast) ease,
        color var(--duration-fast) ease;
}

.chapter-list-item:hover .chapter-play-icon {
    background: var(--accent);
    color: #ffffff;
}

.chapter-title {
    margin: 0;
    overflow: hidden;

    color: var(--text);
    font-size: 0.91rem;
    font-weight: 620;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-right {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.chapter-pages {
    padding: 4px 9px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: rgba(255, 255, 255, 0.035);
    color: var(--text-muted);

    font-size: 0.76rem;
}

.chapter-list-item.read {
    background: rgba(21, 25, 39, 0.55);
    opacity: 0.68;
}

.chapter-list-item.read:hover {
    opacity: 1;
}

.chapter-read-badge,
.chapter-inprogress-badge {
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
}

.chapter-read-badge {
    border: 1px solid var(--success-border);
    background: var(--success-soft);
    color: #9bd5bf;
}

.chapter-inprogress-badge {
    border: 1px solid var(--warning-border);
    background: var(--warning-soft);
    color: #e2b978;
}

.chapter-mark-btn {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 50%;

    background: transparent;
    color: var(--text-muted);
    cursor: pointer;

    transition:
        border-color var(--duration-fast) ease,
        background var(--duration-fast) ease,
        color var(--duration-fast) ease;
}

.chapter-mark-btn:hover,
.chapter-list-item.read .chapter-mark-btn {
    border-color: var(--success-border);
    background: var(--success-soft);
    color: var(--success);
}

.chapter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;

    margin-bottom: 8px;
    padding: 10px 4px;
}

.chapter-toolbar-btn {
    padding: 8px 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface-solid);
    color: var(--text-soft);
    cursor: pointer;

    font-size: 0.78rem;
    font-weight: 620;
}

.chapter-toolbar-btn:hover {
    border-color: var(--accent-border);
    background: var(--surface-hover);
    color: var(--text);
}

/* ==========================================================================
   CATALOG
   ========================================================================== */

.catalog-results-grid {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.catalog-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 17px;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: var(--surface-solid);

    transition:
        transform var(--duration-medium) var(--ease-out),
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease;
}

.catalog-card:hover {
    border-color: var(--accent-border);
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.catalog-card-cover,
.catalog-card-cover-placeholder {
    width: 68px;
    height: 96px;
    flex: 0 0 auto;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--bg-soft);
}

.catalog-card-cover {
    object-fit: cover;
}

.catalog-card-cover-placeholder {
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 1.25rem;
}

.catalog-card-info {
    min-width: 0;
    flex: 1;
}

.catalog-card-info h3 {
    margin-bottom: 5px;

    color: var(--text);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.3;
}

.catalog-card-summary {
    display: -webkit-box;
    margin-top: 6px;
    overflow: hidden;

    color: var(--text-soft);
    font-size: 0.78rem;
    line-height: 1.5;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.catalog-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 7px;
}

.source-badge {
    display: inline-block;
    padding: 3px 9px;

    border-radius: var(--radius-pill);

    font-size: 0.64rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.source-badge.mangapill {
    border: 1px solid var(--accent-border);
    background: var(--accent-subtle);
    color: #b9b5fa;
}

.source-badge.manganato {
    border: 1px solid var(--info-border);
    background: var(--info-soft);
    color: #a9c8e9;
}

.source-badge.default {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.055);
    color: var(--text-soft);
}

.autodl-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;

    margin-right: 10px;
    margin-left: auto;
    padding: 5px 10px;

    border: 1px solid var(--border);
    border-radius: 10px;

    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 650;

    transition:
        border-color var(--duration-fast) ease,
        background var(--duration-fast) ease,
        color var(--duration-fast) ease;
}

.autodl-badge.active {
    border-color: var(--success-border);
    background: var(--success-soft);
    color: #a7dbc7;
}

.autodl-badge.inactive {
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-muted);
}

.catalog-download-btn {
    flex: 0 0 auto;
    padding: 10px 18px;

    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;

    background: var(--accent-gradient);
    box-shadow: 0 9px 20px rgba(48, 47, 112, 0.2);
    color: #ffffff;
    cursor: pointer;

    font-size: 0.81rem;
    font-weight: 740;
    white-space: nowrap;

    transition:
        transform var(--duration-medium) var(--ease-out),
        background var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease;
}

.catalog-download-btn:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 12px 26px rgba(48, 47, 112, 0.27);
    transform: translateY(-2px);
}

.catalog-loading,
.loading-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 13px;

    padding: 54px 20px;

    color: var(--text-soft);
    text-align: center;
    font-size: 0.91rem;
}

.catalog-loading::before,
.loading-text::before {
    content: "";

    width: 29px;
    height: 29px;

    border: 2px solid var(--border-strong);
    border-top-color: var(--accent-light);
    border-radius: 50%;

    animation: spin 720ms linear infinite;
}

.catalog-empty,
.queue-empty,
.storage-empty {
    padding: 58px 20px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.91rem;
}

.catalog-empty svg,
.queue-empty svg {
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    opacity: 0.38;
}

.download-modal-fields {
    display: flex;
    flex-direction: column;
    gap: 13px;

    margin-bottom: 22px;
    text-align: left;
}

.download-modal-fields label {
    color: var(--text-soft);
    font-size: 0.81rem;
    font-weight: 620;
}

.download-modal-fields input,
.download-modal-fields select {
    width: 100%;
    padding: 12px 14px;

    border: 1px solid var(--border-strong);
    border-radius: 12px;
    outline: none;

    background-color: var(--surface-solid);
    color: var(--text);

    font-size: 0.87rem;

    transition:
        border-color var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease;
}

.download-modal-fields select {
    padding-right: 42px;
    appearance: none;
    cursor: pointer;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aaa7ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-position: right 14px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
}

.download-modal-fields input:focus,
.download-modal-fields select:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-focus);
}

.download-modal-fields select option,
select option {
    background: #171b2a !important;
    color: var(--text) !important;
}

/* ==========================================================================
   DOWNLOAD QUEUE
   ========================================================================== */

.queue-header {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.queue-clear-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 9px 16px;

    border: 1px solid var(--danger-border);
    border-radius: 11px;

    background: rgba(255, 93, 168, 0.14);
    background: var(--danger-soft, rgba(255, 93, 168, 0.14));
    color: #e4a0a8;
    cursor: pointer;

    font-size: 0.8rem;
    font-weight: 650;

    transition:
        transform var(--duration-fast) ease,
        border-color var(--duration-fast) ease,
        background var(--duration-fast) ease;
}

.queue-clear-all-btn:hover {
    border-color: rgba(216, 117, 128, 0.44);
    background: rgba(216, 117, 128, 0.2);
    transform: translateY(-1px);
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.queue-item {
    padding: 17px;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: var(--surface-solid);
    box-shadow: var(--shadow-xs);

    transition:
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease;
}

.queue-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.queue-item-header h3 {
    min-width: 0;
    flex: 1;

    color: var(--text);
    font-size: 0.96rem;
    font-weight: 650;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.queue-header-right {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
}

.queue-status {
    padding: 4px 10px;
    border-radius: var(--radius-pill);

    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.queue-status.queued {
    border: 1px solid var(--warning-border);
    background: var(--warning-soft);
    color: #e2b978;
}

.queue-status.downloading {
    border: 1px solid var(--info-border);
    background: var(--info-soft);
    color: #a9c8e9;
}

.queue-status.done {
    border: 1px solid var(--success-border);
    background: var(--success-soft);
    color: #a7dbc7;
}

.queue-status.error {
    border: 1px solid var(--danger-border);
    background: var(--danger-soft);
    color: #e4a0a8;
}

.queue-status.interrupted {
    border: 1px solid var(--warning-border);
    background: var(--warning-soft);
    color: #e2b978;
}

.queue-cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    padding: 5px 10px;

    border: 1px solid var(--danger-border);
    border-radius: var(--radius-pill);

    background: var(--danger-soft);
    color: #e4a0a8;
    cursor: pointer;

    font-size: 0.69rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.queue-cancel-btn.dismiss {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-soft);
}

.queue-retry-btn {
    margin-right: 6px;
    padding: 5px 11px;

    border: 0;
    border-radius: 9px;

    background: var(--accent);
    color: #ffffff;
    cursor: pointer;

    font-size: 0.76rem;
    font-weight: 700;
}

.dl-progress-container {
    width: 100%;
    height: 7px;
    margin: 10px 0 8px;
    overflow: hidden;

    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.065);
}

.dl-progress-bar {
    width: 0;
    height: 100%;

    border-radius: var(--radius-pill);
    background: var(--accent-gradient);
    transition: width 280ms var(--ease-standard);
}

.queue-log {
    max-height: 88px;
    margin-top: 10px;
    padding: 10px 13px;
    overflow-y: auto;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: rgba(5, 7, 12, 0.45);
    color: var(--text-soft);

    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.71rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* ==========================================================================
   STORAGE
   ========================================================================== */

.storage-disk-card {
    margin-bottom: 24px;
    padding: 23px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface-solid);
    box-shadow: var(--shadow-sm);
}

.storage-disk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.storage-disk-header h3 {
    color: var(--text);
    font-size: 1.02rem;
    font-weight: 700;
}

.storage-disk-header span {
    color: var(--text-soft);
    font-size: 0.81rem;
    font-variant-numeric: tabular-nums;
}

.storage-bar-track {
    position: relative;

    width: 100%;
    height: 12px;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: var(--radius-pill);

    background: rgba(4, 6, 10, 0.55);
}

.storage-bar-fill {
    position: relative;
    height: 100%;
    border-radius: inherit;
    background: var(--accent-gradient);
    transition: width 600ms var(--ease-out);
}

.storage-bar-fill::after {
    display: none;
    content: none;
}

.storage-percent {
    margin-top: 9px;

    color: var(--text-muted);
    text-align: right;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

.storage-series-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.storage-series-item {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 14px 17px;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface-solid);

    transition:
        transform var(--duration-medium) var(--ease-out),
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease;
}

.storage-series-item:hover {
    border-color: var(--accent-border);
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.storage-card-main {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 15px;
}

.storage-poster-thumb {
    display: grid;
    width: 50px;
    height: 70px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: rgba(255, 255, 255, 0.035);
}

.storage-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.storage-cover-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;

    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.storage-series-info {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 6px;
}

.storage-title-row,
.storage-series-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.storage-title-row h4 {
    max-width: 100%;
    margin: 0;
    overflow: hidden;

    color: var(--text);
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storage-source-badge {
    padding: 2px 7px;

    border: 1px solid var(--info-border);
    border-radius: 8px;

    background: var(--info-soft);
    color: #aac5e5;

    font-size: 0.61rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.storage-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    padding: 3px 9px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.035);
    color: var(--text-soft);

    font-size: 0.69rem;
    font-weight: 600;
}

.storage-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
}

.storage-repair-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 8px 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface-solid);
    color: var(--text-soft);
    cursor: pointer;

    font-size: 0.78rem;
    font-weight: 650;
}

.storage-repair-btn:hover {
    border-color: var(--accent-border);
    background: var(--surface-hover);
    color: var(--accent-light);
}

.storage-update-btn {
    display: inline-flex;
    height: 36px;
    align-items: center;
    gap: 6px;

    padding: 0 13px;

    border: 1px solid var(--accent-border);
    border-radius: var(--radius-pill);

    background: var(--accent-subtle);
    color: #b9b5fa;
    cursor: pointer;

    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;

    transition:
        transform var(--duration-fast) ease,
        background var(--duration-fast) ease,
        border-color var(--duration-fast) ease;
}

.storage-update-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.45);
    background: rgba(var(--accent-rgb), 0.2);
    transform: translateY(-1px);
}

.storage-delete-btn {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;

    border: 1px solid var(--danger-border);
    border-radius: 10px;

    background: var(--danger-soft);
    color: #e19ba4;
    cursor: pointer;

    transition:
        background var(--duration-fast) ease,
        border-color var(--duration-fast) ease,
        transform var(--duration-fast) ease;
}

.storage-delete-btn:hover {
    border-color: rgba(216, 117, 128, 0.44);
    background: rgba(216, 117, 128, 0.2);
    transform: scale(1.03);
}

.storage-update-btn.spinning svg,
.icon-btn.spinning svg {
    animation: storage-spin 0.8s linear infinite !important;
}

@keyframes storage-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.storage-update-btn:disabled,
.icon-btn:disabled {
    opacity: 0.62;
    cursor: wait;
    pointer-events: none;
}

/* ==========================================================================
   PROFILES
   ========================================================================== */

.main-logo {
    width: 128px;
    margin-bottom: 17px;
    object-fit: contain;
}

.profiles-wrapper h1 {
    margin-bottom: 38px;

    background: var(--accent-gradient-wide);
    background-clip: text;
    color: transparent;

    font-size: 2.15rem;
    font-weight: 830;
    letter-spacing: -0.045em;

    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-card {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    gap: 11px;

    cursor: pointer;

    transition: transform var(--duration-slow) var(--ease-out);
}

.profile-card:hover {
    transform: translateY(-6px);
}

.profile-avatar {
    position: relative;

    display: grid;
    width: 98px;
    height: 98px;
    place-items: center;

    border: 2px solid var(--border-strong);
    border-radius: 24px;

    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
    color: #ffffff;

    font-size: 2rem;
    font-weight: 800;

    transition:
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease;
}

.profile-card:hover .profile-avatar {
    border-color: var(--accent-border);
    background: var(--surface-hover);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.profile-name {
    color: var(--text-soft);
    font-size: 0.87rem;
    font-weight: 650;

    transition: color var(--duration-fast) ease;
}

.profile-card:hover .profile-name {
    color: var(--text);
}

.profile-delete-btn {
    position: absolute;
    z-index: var(--z-profile-delete, 5);
    top: -7px;
    right: -7px;

    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;

    border: 2px solid var(--bg);
    border-radius: 50%;

    background: var(--danger);
    box-shadow: var(--shadow-sm);
    color: #ffffff;
    cursor: pointer;

    font-size: 0.86rem;
    font-weight: 800;

    opacity: 0;
    pointer-events: none;
    transform: scale(0.62);

    transition:
        opacity var(--duration-medium) ease,
        transform var(--duration-medium) var(--ease-out);
}

.profiles-wrapper.managing .profile-delete-btn {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* ==========================================================================
   READER CONTROLS AND BOOKMARKS
   ========================================================================== */

.reader-top-bar,
.nav-bar.reader-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reader-nav-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.reader-action-btn {
    padding: 8px !important;

    border: 1px solid var(--border-strong) !important;
    border-radius: 11px !important;

    background: rgba(16, 19, 29, 0.82) !important;
    color: var(--text) !important;
}

.reader-action-btn:hover {
    background: rgba(34, 39, 55, 0.95) !important;
}

.reader-controls-row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 11px;
}

.nav-btn {
    padding: 10px 17px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface-solid);
    color: var(--text);
    cursor: pointer;

    font-size: 0.81rem;
    font-weight: 650;

    transition:
        background var(--duration-fast) ease,
        border-color var(--duration-fast) ease,
        transform var(--duration-fast) ease;
}

.nav-btn:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.nav-btn.primary {
    border-color: rgba(255, 255, 255, 0.06);
    background: var(--accent-gradient);
    color: #ffffff;
}

.mode-select {
    padding: 10px 13px;

    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;

    background: var(--surface-solid);
    color: var(--text);
    cursor: pointer;

    font-size: 0.81rem;
    font-weight: 600;
}

.page-counter {
    color: var(--text-soft);
    font-size: 0.86rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.bookmarks-modal-box {
    max-width: 470px !important;
    text-align: left !important;
}

.bookmarks-modal-box .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 16px;
    padding-bottom: 12px;

    border-bottom: 1px solid var(--border);
}

.bookmarks-modal-box .modal-header h3 {
    margin: 0;
    font-size: 1.16rem;
}

.bookmarks-modal-box .close-btn {
    min-height: 32px;
    padding: 4px 8px;

    border: 0;
    border-radius: 50%;

    background: transparent;
    color: var(--text-muted);
}

.bookmarks-list {
    display: flex;
    max-height: 300px;
    flex-direction: column;
    gap: 8px;

    margin-bottom: 20px;
    overflow-y: auto;
}

.bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 11px 14px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface-solid);
}

.bookmark-item:hover {
    border-color: var(--accent-border);
    background: var(--surface-hover);
}

.bookmark-info {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;

    cursor: pointer;
}

.bookmark-page {
    color: var(--accent-light);
    font-size: 0.82rem;
    font-weight: 740;
}

.bookmark-label {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 0.77rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-delete-btn {
    padding: 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.bookmark-delete-btn:hover {
    color: var(--danger);
}

.chapter-end-sentinel {
    width: 100%;
    max-width: 800px;
    padding: 28px 20px;

    color: var(--text-muted);
    text-align: center;
}

.sentinel-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-size: 0.84rem;
}

.sentinel-loader .spinner {
    width: 21px;
    height: 21px;

    border: 2px solid var(--border-strong);
    border-top-color: var(--accent-light);
    border-radius: 50%;

    animation: spin 720ms linear infinite;
}

.end-of-series-banner {
    padding: 20px 0;
    color: var(--text-soft);
    font-size: 0.92rem;
    font-weight: 700;
}

.chapter-divider {
    width: 100%;
    max-width: 800px;

    margin: 16px 0;
    padding: 23px 0;

    border-top: 1px dashed var(--border-strong);
    border-bottom: 1px dashed var(--border-strong);

    color: var(--accent-light);
    text-align: center;
    font-size: 0.86rem;
    font-weight: 740;
    letter-spacing: 0.045em;
}

/* ==========================================================================
   SEARCH AND TOOLBARS
   ========================================================================== */

.search-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.search-wrapper::before {
    content: "";
    position: absolute;
    z-index: var(--z-base, 1);
    top: 50%;
    left: 17px;

    width: 15px;
    height: 15px;

    border: 2px solid var(--text-muted);
    border-radius: 50%;

    pointer-events: none;
    transform: translateY(-58%);
}

.search-wrapper::after {
    content: "";
    position: absolute;
    z-index: var(--z-base, 1);
    top: calc(50% + 5px);
    left: 29px;

    width: 6px;
    height: 2px;

    border-radius: 2px;
    background: var(--text-muted);

    pointer-events: none;
    transform: rotate(45deg);
    transform-origin: left center;
}

.search-bar {
    width: 100%;
    padding: 12px 17px 12px 46px;

    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;

    background: rgba(21, 25, 39, 0.9);
    color: var(--text);

    transition:
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease;
}

.search-bar:focus {
    border-color: var(--accent-border);
    background: var(--surface-soft);
    box-shadow: 0 0 0 3px var(--accent-focus);
}

.library-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 21px;
}

.sort-select-wrapper {
    flex: 0 0 auto;
}

.sort-select {
    min-height: 46px;
    padding: 11px 38px 11px 15px;

    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    appearance: none;

    background-color: rgba(21, 25, 39, 0.9);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23aaa7ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-position: right 13px center;
    background-repeat: no-repeat;
    background-size: 15px;
    color: var(--text);
    cursor: pointer;

    font-size: 0.82rem;
}

.sort-select:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-focus);
}

/* ==========================================================================
   BOTTOM NAV ITEMS
   ========================================================================== */

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;

    padding: 4px 11px;

    border: 0;
    background: none;
    color: var(--text-muted);
    cursor: pointer;

    font-size: 0.65rem;
    font-weight: 700;

    transition:
        color var(--duration-fast) ease,
        transform var(--duration-fast) ease;
}

.bottom-nav-item svg {
    width: 20px;
    height: 20px;
}

.bottom-nav-item:hover {
    color: var(--text);
}

.bottom-nav-item.active {
    color: var(--accent-light);
}

/* ==========================================================================
   LOGIN
   ========================================================================== */

.login-wrapper {
    position: relative;

    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;

    padding: 24px;
    overflow: hidden;
}

.login-wrapper::before {
    content: "";
    position: absolute;
    top: 15%;
    left: 50%;

    width: 520px;
    height: 520px;

    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(var(--accent-rgb), 0.14),
        transparent 66%
    );

    pointer-events: none;
    transform: translateX(-50%);
}

.login-card {
    position: relative;
    z-index: var(--z-base, 1);

    width: 100%;
    max-width: 440px;
    padding: 35px 31px;

    border: 1px solid var(--border-strong);
    border-radius: 23px;

    background: rgba(23, 27, 42, 0.96);
    box-shadow: var(--shadow-xl);
}

.login-header {
    margin-bottom: 27px;
    text-align: center;
}

.login-logo {
    width: 72px;
    height: 72px;

    margin: 0 auto 14px;

    border-radius: 16px;
    object-fit: contain;
}

.login-header h1 {
    color: var(--text);
    font-size: 1.78rem;
    font-weight: 820;
    letter-spacing: -0.04em;
}

.login-header p {
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 0.82rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.input-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    color: var(--text-soft);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.input-group input {
    width: 100%;
    padding: 13px 15px;

    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;

    background: var(--surface-solid);
    color: var(--text);

    font-size: 0.89rem;

    transition:
        border-color var(--duration-medium) ease,
        background var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease;
}

.input-group input:focus {
    border-color: var(--accent-border);
    background: var(--surface-soft);
    box-shadow: 0 0 0 3px var(--accent-focus);
}

.toggle-password {
    position: absolute;
    right: 13px;
    bottom: 11px;

    display: grid;
    place-items: center;
    padding: 4px;

    border: 0;
    border-radius: 5px;

    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.toggle-password:hover {
    color: var(--text);
}

.login-btn {
    position: relative;

    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;

    margin-top: 7px;

    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 13px;

    background: var(--accent-gradient);
    box-shadow: 0 12px 28px rgba(48, 47, 112, 0.25);
    color: #ffffff;
    cursor: pointer;

    font-size: 0.9rem;
    font-weight: 750;

    transition:
        transform var(--duration-medium) var(--ease-out),
        background var(--duration-medium) ease,
        box-shadow var(--duration-medium) ease;
}

.login-btn:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 16px 34px rgba(48, 47, 112, 0.31);
    transform: translateY(-2px);
}

.login-btn .btn-spinner {
    display: none;
    width: 20px;
    height: 20px;

    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;

    animation: spin 620ms linear infinite;
}

.login-btn.loading .btn-text {
    display: none;
}

.login-btn.loading .btn-spinner {
    display: block;
}

.error-message {
    display: none;
    align-items: center;
    gap: 8px;

    padding: 11px 13px;

    border: 1px solid var(--danger-border);
    border-radius: 12px;

    background: var(--danger-soft);
    color: #e5a0a8;

    font-size: 0.8rem;
    font-weight: 600;
}

.error-message.visible {
    display: flex;
}

.error-message.shake {
    animation: shake 380ms ease;
}

.attempts-warning {
    display: none;
    margin-top: 4px;
    color: var(--warning);
    text-align: center;
    font-size: 0.74rem;
}

.attempts-warning.visible {
    display: block;
}

/* ==========================================================================
   RESPONSIVE COMPONENTS
   ========================================================================== */

@media (max-width: 980px) {
    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(270px, 0.62fr);
    }

    .hero-content {
        padding: 42px;
    }

    .hero-visual {
        padding-right: 34px;
    }

    .book-scene {
        width: 210px;
    }
}

@media (max-width: 760px) {
    .noise {
        display: none;
    }

    .spotlight,
    .ambient-orb {
        display: none;
    }

    .hero {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        min-height: 250px;
        max-height: none;

        border-radius: 20px;
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
        overflow: hidden;
    }

    .hero::before {
        background:
            linear-gradient(
                to top,
                rgba(14, 17, 28, 0.99) 0%,
                rgba(14, 17, 28, 0.88) 55%,
                rgba(14, 17, 28, 0.35) 100%
            ),
            url("https://images.unsplash.com/photo-1519638399535-1b036603ac77?auto=format&fit=crop&w=1100&q=78")
            center / cover;

        filter: saturate(0.58);
    }

    .hero::after {
        background: radial-gradient(
            circle at 80% 30%,
            rgba(116, 108, 222, 0.14),
            transparent 45%
        );
    }

    .hero-content {
        width: 100%;
        max-width: none;
        padding: 20px 18px 18px;
    }

    .hero-kicker {
        margin-bottom: 8px;
        padding: 4px 8px;
        font-size: 0.58rem;
    }

    .hero h1 {
        max-width: 100%;
        font-size: clamp(1.6rem, 7.5vw, 2.3rem);
        line-height: 1.05;
        letter-spacing: -0.025em;
    }

    .hero-description {
        max-width: 100%;
        margin-top: 8px;
        font-size: 0.8rem;
        line-height: 1.45;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .hero-meta {
        margin-top: 10px;
    }

    .hero-meta span {
        padding: 4px 8px;
        font-size: 0.6rem;
    }

    .hero-actions {
        margin-top: 14px;
        gap: 8px;
    }

    .hero-visual {
        position: absolute;
        z-index: 0;
        top: 22px;
        right: 15px;

        display: flex;
        width: 44%;
        min-height: 235px;
        align-items: center;
        justify-content: center;

        padding: 12px;
        pointer-events: none;
    }

    .book-scene {
        width: min(145px, 32vw);
        pointer-events: auto;
    }

    .book-3d {
        animation: mobileBookFloat 5s ease-in-out infinite;
    }

    .book-scene:not(:has(.book-3d)) {
        animation: mobileBookFloat 5s ease-in-out infinite;
    }

    .book-scene::after {
        bottom: -23px;
        height: 15px;
        filter: blur(9px);
    }

    .book-cover {
        border-radius: 8px 13px 13px 8px;
        transform: translateZ(18px);
    }

    .book-spine {
        left: -12px;
        width: 22px;
        transform: rotateY(-90deg) translateZ(11px);
    }

    .book-pages {
        inset: 5px -8px 5px 6px;
    }

    .book-info {
        right: 11px;
        bottom: 13px;
        left: 15px;
    }

    .book-info small {
        font-size: 0.43rem;
    }

    .book-info h2 {
        font-size: 0.92rem;
    }

    .floating-ring,
    .floating-chip {
        display: none !important;
    }

    .primary-button,
    .secondary-button,
    .action-btn {
        min-height: 44px;
        padding: 0 16px;
        border-radius: 12px;
        font-size: 0.78rem;
    }

    .section-header {
        align-items: center;
        gap: 12px;
        margin-bottom: 16px;
    }

    .section-heading h2 {
        font-size: 1.36rem;
    }

    .section-link {
        font-size: 0.69rem;
    }

    .continue-card {
        min-height: 142px;
        grid-template-columns: 82px minmax(0, 1fr);
        gap: 14px;
        padding: 13px;
        border-radius: 17px;
        box-shadow: none;
    }

    .continue-card::before {
        display: none;
    }

    .continue-cover {
        width: 82px;
        height: 116px;
        border-radius: 10px;
        box-shadow: 0 7px 16px rgba(0, 0, 0, 0.25);
    }

    .manga-card-inner,
    .card-inner {
        border-radius: 15px;
        box-shadow: none;
    }

    .manga-overlay,
    .card-overlay {
        padding: 48px 10px 11px;
    }

    .manga-overlay h3,
    .card-overlay h3 {
        font-size: 0.73rem;
    }

    .manga-meta {
        margin-top: 6px;
        font-size: 0.54rem;
    }

    .manga-status,
    .card-overlay .status {
        font-size: 0.54rem;
    }

    .manga-badge {
        top: 7px;
        left: 7px;
        padding: 4px 6px;
        border-radius: 7px;
        font-size: 0.47rem;
    }

    .card-unread-badge {
        top: 7px;
        right: 7px;
        left: auto;
        font-size: 0.53rem;
    }

    .favorite-button {
        top: 7px;
        right: 7px;

        width: 30px;
        height: 30px;

        border-radius: 9px;
        opacity: 1;
    }

    .favorite-button svg {
        width: 14px;
        height: 14px;
    }

    .activity-panel,
    .stat-card {
        box-shadow: none;
    }

    .activity-panel {
        min-height: auto;
        padding: 18px 14px;
    }

    .chart.activity-chart-wrapper {
        display: block;
        height: auto;
        min-height: auto;
        max-height: none;
        margin-top: 16px;
    }

    .stats-chart-split-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .activity-subcard {
        padding: 14px 14px 10px;
    }

    .activity-svg-container {
        height: 140px;
    }

    .chart-view-btn {
        padding: 4px 9px;
        font-size: 0.68rem;
    }

    .stat-card {
        min-height: 122px;
        padding: 15px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .modal-panel,
    .custom-modal-box {
        padding: 23px 19px;
        border-radius: 20px;
    }

    .custom-modal-overlay {
        background: rgba(5, 7, 12, 0.9);
    }

    .toast,
    .toast-container {
        top: max(12px, env(safe-area-inset-top, 0px));
        right: 12px;
    }

    .toast-container {
        max-width: calc(100vw - 24px);
    }

    .series-detail-header {
        padding: 17px;
        border-radius: 19px;
        box-shadow: none;
    }

    .series-detail-card {
        align-items: center;
        flex-direction: column;
        gap: 18px;
        text-align: center;
    }

    .series-poster-wrapper {
        width: 146px;
        margin: 0 auto;
    }

    .series-info-content {
        width: 100%;
        align-items: center;
    }

    .series-meta-badges,
    .series-genres-list,
    .series-action-bar {
        width: 100%;
        justify-content: center;
    }

    .series-synopsis-block {
        width: 100%;
    }

    .series-synopsis-block p {
        text-align: center;
    }

    .catalog-card {
        padding: 13px;
        box-shadow: none;
    }

    .catalog-card-cover,
    .catalog-card-cover-placeholder {
        width: 58px;
        height: 83px;
    }

    .catalog-card-summary {
        -webkit-line-clamp: 1;
    }

    .storage-disk-card,
    .queue-item {
        box-shadow: none;
    }

    .search-bar,
    .sort-select {
        background-color: var(--surface-solid);
    }

    .login-card {
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 520px) {
    .hero {
        min-height: 235px;
    }

    .hero-visual {
        top: 20px;
        right: 9px;
        width: 46%;
    }

    .book-scene {
        width: min(132px, 34vw);
    }

    .hero-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .primary-button,
    .secondary-button {
        padding-right: 13px;
        padding-left: 13px;
    }

    .section-heading small {
        font-size: 0.57rem;
    }

    .section-heading h2 {
        font-size: 1.25rem;
    }

    .section-link {
        max-width: 42%;
        text-align: right;
    }

    .catalog-card {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .catalog-card-info {
        width: calc(100% - 76px);
        flex: 1 1 calc(100% - 76px);
    }

    .autodl-badge {
        margin-left: 76px;
    }

    .catalog-download-btn {
        margin-left: auto;
    }

    .chapter-list-item {
        padding: 13px 12px;
    }

    .chapter-left {
        gap: 9px;
    }

    .chapter-pages {
        display: none;
    }

    .chapter-title {
        font-size: 0.83rem;
    }

    .storage-disk-card {
        padding: 18px;
    }

    .profile-avatar {
        width: 88px;
        height: 88px;
        border-radius: 21px;
    }

    .profiles-grid {
        gap: 23px;
        padding-right: 8px;
        padding-left: 8px;
    }
}

@media (max-width: 380px) {
    .hero {
        min-height: 220px;
    }

    .hero-content {
        padding-right: 15px;
        padding-left: 15px;
    }

    .hero h1 {
        font-size: 1.55rem;
    }

    .hero-description {
        max-width: 100%;
    }

    .manga-overlay,
    .card-overlay {
        padding-right: 8px;
        padding-left: 8px;
    }

    .manga-overlay h3,
    .card-overlay h3 {
        font-size: 0.68rem;
    }

    .stats-column {
        gap: 9px;
    }

    .stat-card {
        min-height: 115px;
        padding: 13px;
    }

    .modal-actions,
    .custom-modal-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .modal-actions .action-btn,
    .custom-modal-actions .action-btn {
        width: 100%;
    }
}

/* Series Detail Mobile Breakpoint */
@media (max-width: 600px) {
    .series-detail-header {
        padding: 16px;
    }
    .series-detail-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
    }
    .series-poster-wrapper {
        width: 140px;
        max-width: 200px;
        margin: 0 auto 1rem auto;
    }
    .series-info-content {
        width: 100%;
        align-items: center;
    }
    .series-meta-badges,
    .series-genres-list,
    .series-action-bar {
        justify-content: center;
        width: 100%;
    }
}

