/* Left reader rail — compact icon tab + slide-out menu */
:root {
    --reader-rail-z: 1055;
    --reader-rail-tab-w: 38px;
    --reader-rail-panel-w: 248px;
    --reader-rail-accent: #e11d48;
}

.reader-rail {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: var(--reader-rail-z);
    font-family: inherit;
}

.reader-rail__tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--reader-rail-tab-w);
    height: 52px;
    padding: 0;
    border: none;
    border-radius: 0 12px 12px 0;
    background: linear-gradient(135deg, #1a1d24 0%, #111318 100%);
    color: #f8fafc;
    box-shadow: 2px 0 18px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    transition: width 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.reader-rail__tab:hover,
.reader-rail.is-open .reader-rail__tab {
    width: calc(var(--reader-rail-tab-w) + 4px);
    background: linear-gradient(135deg, #252a33 0%, #161a22 100%);
    color: #fff;
}

.reader-rail__tab i {
    font-size: 1.15rem;
    line-height: 1;
}

.reader-rail__panel {
    position: absolute;
    left: 0;
    top: 50%;
    width: var(--reader-rail-panel-w);
    max-height: min(72vh, 520px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(17, 19, 24, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: none;
    border-radius: 0 14px 14px 0;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transform: translate(-12px, -50%);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    pointer-events: none;
}

.reader-rail.is-open .reader-rail__panel {
    opacity: 1;
    visibility: visible;
    transform: translate(calc(var(--reader-rail-tab-w) - 2px), -50%);
    pointer-events: auto;
}

.reader-rail__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.reader-rail__title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.reader-rail__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    cursor: pointer;
}

.reader-rail__close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.reader-rail__nav {
    list-style: none;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
}

.reader-rail__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.3;
    transition: background 0.15s ease, color 0.15s ease;
}

.reader-rail__link i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.reader-rail__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.reader-rail__link.is-active {
    background: rgba(225, 29, 72, 0.14);
    color: #fff;
}

.reader-rail__link.is-active i {
    color: var(--reader-rail-accent);
}

.reader-rail__note {
    margin: 0;
    padding: 10px 14px 14px;
    font-size: 0.78rem;
    color: #64748b;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.reader-rail__backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--reader-rail-z) - 1);
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s;
}

.reader-rail__backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 767px) {
    .reader-rail {
        top: auto;
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
        transform: none;
    }

    .reader-rail__panel {
        top: auto;
        bottom: 0;
        max-height: 60vh;
        transform: translateY(8px);
        border-radius: 0 14px 14px 0;
    }

    .reader-rail.is-open .reader-rail__panel {
        transform: translate(calc(var(--reader-rail-tab-w) - 2px), 0);
    }

    body.has-floating-fabs .reader-rail {
        bottom: calc(148px + env(safe-area-inset-bottom, 0px));
    }
}

@media print {
    .reader-rail,
    .reader-rail__backdrop {
        display: none !important;
    }
}
