/* Stealth Browse - Reading Mode Power Up */

.reading-mode-toggle-container:not([hidden]):not(.appearance-hidden) {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
}

#reading-mode-toggle-container[hidden],
#reading-mode-toggle-container.appearance-hidden,
.top-bar #reading-mode-toggle-container[hidden],
.top-bar #reading-mode-toggle-container.appearance-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#reading-mode-toggle-btn img,
.top-bar #reading-mode-toggle-btn img {
    width: 11px !important;
    height: 11px !important;
    max-width: 11px !important;
    max-height: 11px !important;
    display: block !important;
    object-fit: contain !important;
    filter: brightness(0) saturate(100%) invert(62%) sepia(52%) saturate(550%) hue-rotate(90deg) brightness(1.05) !important;
}

#reading-mode-toggle-btn.is-open,
#reading-mode-toggle-btn.is-active {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.65);
    background: rgba(20, 83, 45, 0.32);
}

.reading-mode-window {
    --panel-fill-alpha: 0.28;
    --frost-tint-alpha: 0.18;
    position: fixed;
    top: 96px;
    right: 88px;
    width: 380px;
    height: auto;
    min-width: 320px;
    max-height: 720px;
    z-index: 2147483647 !important;
    border-radius: 16px;
    overflow: hidden !important;
    background: rgba(22, 22, 30, var(--panel-fill-alpha, 0.28)) !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    display: none;
    flex-direction: column;
    color: #f2f2f6;
    font-family: inherit;
    pointer-events: auto;
    clip-path: inset(0 round 16px);
    -webkit-clip-path: inset(0 round 16px);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#reading-mode-window.show,
#reading-mode-window.page-frost-host {
    border-radius: 16px !important;
    overflow: hidden !important;
    clip-path: inset(0 round 16px) !important;
    -webkit-clip-path: inset(0 round 16px) !important;
}

#reading-mode-window .page-frost-layer,
#reading-mode-window .page-frost-image,
#reading-mode-window .page-frost-layer::after {
    border-radius: 16px !important;
}

.reading-mode-window.show { display: flex; }

.reading-mode-glass-sheen {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 42%),
        radial-gradient(ellipse at 20% 0%, rgba(90, 13, 214, 0.18), transparent 55%);
}

.reading-mode-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    min-height: 28px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.reading-mode-header:active { cursor: grabbing; }

.reading-mode-header-icon {
    width: 16px;
    height: 16px;
    opacity: 0.9;
    filter: invert(1);
}

.reading-mode-header-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
}

.reading-mode-icon-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    background: rgba(255, 255, 255, 0.06);
    color: #e8e8ee;
    cursor: pointer;
    font-size: 14px;
}

.reading-mode-icon-btn:hover { background: rgba(255, 255, 255, 0.12); }

.reading-mode-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    overflow: auto;
}

.reading-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.reading-mode-label {
    font-size: 12px;
    color: rgba(242, 242, 246, 0.78);
}

.reading-mode-switch {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    border: none;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    padding: 0;
}

.reading-mode-switch.is-on {
    background: linear-gradient(135deg, #5a0dd6, #4900c2);
}

.reading-mode-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    background: #fff;
    transition: transform 0.15s ease;
}

.reading-mode-switch.is-on::after { transform: translateX(18px); }

.reading-mode-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.reading-mode-chip {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #f2f2f6;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
}

.reading-mode-chip:hover { background: rgba(255, 255, 255, 0.1); }

.reading-mode-chip.is-active {
    border-color: rgba(90, 13, 214, 0.7);
    background: rgba(90, 13, 214, 0.22);
    color: #c4b5fd;
}

.reading-mode-slider-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reading-mode-slider-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: rgba(242, 242, 246, 0.78);
}

.reading-mode-slider-top strong {
    color: #f2f2f6;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.reading-mode-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.reading-mode-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    background: linear-gradient(135deg, #5a0dd6, #4900c2);
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.25);
}

.reading-mode-action-btn {
    border: 1px solid rgba(90, 13, 214, 0.45);
    background: linear-gradient(135deg, #5a0dd6, #4900c2);
    color: #f5f3ff;
    border-radius: var(--stealth-cut, 12px 2px 2px 2px);
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.reading-mode-action-btn:hover { filter: brightness(1.08); }

.reading-mode-action-secondary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: #f2f2f6;
    flex: 1;
}

.reading-mode-colors {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reading-mode-color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.reading-mode-color-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: rgba(242, 242, 246, 0.78);
}

.reading-mode-color-field input[type="color"] {
    width: 28px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.reading-mode-color-actions {
    display: flex;
    gap: 8px;
}

.reading-mode-status {
    min-height: 16px;
    font-size: 11px;
    color: rgba(242, 242, 246, 0.65);
}

[data-theme="light"] .reading-mode-window { color: #1f2937; }
[data-theme="light"] .reading-mode-header-icon { filter: none; }
[data-theme="light"] .reading-mode-label,
[data-theme="light"] .reading-mode-slider-top,
[data-theme="light"] .reading-mode-status {
    color: rgba(31, 41, 55, 0.72);
}
[data-theme="light"] .reading-mode-chip {
    color: #1f2937;
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .reading-mode-color-field {
    color: rgba(31, 41, 55, 0.72);
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .reading-mode-action-secondary {
    color: #1f2937;
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}
