/* NovelPD Omni — R18 霧化遮罩與年齡確認
 *
 * 掛在小說館的每一頁（browse / read / rank / author）。
 * 開關掛在 <html> 的 .r18-on 上，任何被標記 data-r18="1" 的容器裡的圖就會霧化。
 * 用屬性選取器而不是包一層 wrapper，是因為封面出口散在四個檔案、
 * 各自的容器 class 都不一樣（.cov / .slide / .ad-unit / .ra-scover…），
 * 加一個屬性比統一 DOM 結構侵入性小得多。
 */

/* ── 霧化遮罩 ── */
/* scale 是必要的：blur 會把邊緣的顏色往外暈開，不放大就會看到一圈透明邊。 */
html.r18-on [data-r18="1"] img,
html.r18-on img[data-r18="1"] {
    filter: blur(18px) saturate(.72) brightness(.92);
    transform: scale(1.15);
    /* 蓋住的是成人內容，不該有淡入淡出的「先看到再糊掉」空窗 */
    transition: none !important;
}
/* 這裡刻意不寫 position —— 標記是掛在各頁自己的容器上（.cov / .slide / .ad-unit /
 * .wcov / .cv / .ra-scover），一條 `[data-r18="1"]{position:relative}` 的特異度會蓋掉
 * .slide 的 position:absolute，整個輪播就散了。改成由各頁保證容器自己是定位的。 */

/* 角標放正中央的膠囊，不貼邊 —— 邊角早就被章節數（左上）、R18（右上）、
 * 定價（右下）、Slider 的標題與圓點（下方）佔滿了，貼哪一邊都會撞上。 */
html.r18-on [data-r18="1"]::after {
    content: "🔞 敏感內容";
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    padding: 4px 11px; border-radius: 999px; white-space: nowrap;
    background: rgba(0, 0, 0, .6); color: #fff;
    font-size: 10px; font-weight: 800; letter-spacing: .04em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
    pointer-events: none; z-index: 3;
}
/* Slider 是大圖，角標跟著放大；小廣告與書架縮圖則相反，太大會蓋掉整格 */
html.r18-on .slide[data-r18="1"]::after { font-size: 15px; padding: 7px 18px; }
html.r18-on .ad-unit[data-r18="1"]::after,
html.r18-on .ra-scover[data-r18="1"]::after,
html.r18-on .cv[data-r18="1"]::after { content: "🔞"; font-size: 11px; padding: 3px 7px; }

/* ── 「我的帳號」總覽的偏好開關 ── */
.ra-pref {
    display: flex; align-items: center; gap: 12px;
    margin-top: 14px; padding: 13px 15px; border-radius: 13px;
    background: var(--ra-soft, rgba(127, 127, 127, .08));
    border: 1px solid var(--ra-line, rgba(127, 127, 127, .18));
}
.ra-pref-tx { flex: 1; min-width: 0; }
.ra-pref-tx b { display: block; font-size: 13.5px; font-weight: 800; line-height: 1.5; }
.ra-pref-tx span { display: block; font-size: 11.5px; opacity: .72; line-height: 1.65; margin-top: 2px; }

/* 原生 checkbox 藏起來當狀態來源：鍵盤 Tab、空白鍵切換、螢幕報讀都照舊能用 */
.ra-sw { position: relative; flex-shrink: 0; width: 46px; height: 26px; }
.ra-sw input {
    position: absolute; inset: 0; width: 100%; height: 100%;
    margin: 0; opacity: 0; cursor: pointer; z-index: 2;
}
.ra-sw i {
    position: absolute; inset: 0; border-radius: 13px; pointer-events: none;
    background: rgba(127, 127, 127, .38); transition: background .18s;
}
.ra-sw i::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    transition: transform .18s;
}
.ra-sw input:checked + i { background: linear-gradient(135deg, #6366f1, #a855f7); }
.ra-sw input:checked + i::after { transform: translateX(20px); }
.ra-sw input:focus-visible + i { outline: 2px solid #8b7cff; outline-offset: 2px; }
.ra-sw input:disabled { cursor: not-allowed; }
.ra-sw input:disabled + i { opacity: .45; }

/* ── 敏感內容警告 ── */
#r18-gate {
    position: fixed; inset: 0; z-index: 99999; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(6, 6, 8, .92); backdrop-filter: blur(10px);
    color-scheme: dark;
}
#r18-gate.show { display: flex; }
.r18-gate-box {
    width: 100%; max-width: 460px; padding: 34px 30px 28px;
    border-radius: 20px; text-align: center;
    background: #232326; border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 26px 80px rgba(0, 0, 0, .6);
}
.r18-gate-ic { font-size: 54px; line-height: 1; margin-bottom: 14px; }
.r18-gate-box h2 { font-size: 25px; font-weight: 900; color: #fff; margin: 0 0 18px; letter-spacing: .02em; }
.r18-gate-box p { font-size: 14px; line-height: 1.95; color: #d6d9df; margin: 0 0 12px; }
.r18-gate-box p.sub { font-size: 12.5px; color: #a2a8b4; margin-bottom: 22px; }
.r18-gate-box .r18-work { color: #fff; font-weight: 800; }
.r18-btn {
    display: block; width: 100%; padding: 15px 20px; margin-top: 10px;
    border: 0; border-radius: 13px; cursor: pointer;
    font-family: inherit; font-size: 15.5px; font-weight: 800;
}
.r18-btn.go { background: linear-gradient(100deg, #e0245e, #a855f7, #7c5cff); color: #fff; }
.r18-btn.go:hover { filter: brightness(1.08); }
.r18-btn.no { background: rgba(255, 255, 255, .09); color: #c2c7d0; }
.r18-btn.no:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.r18-gate-fine { font-size: 11px; color: #8b919c; line-height: 1.8; margin: 16px 0 0; }

@media (max-width: 480px) {
    .r18-gate-box { padding: 28px 20px 22px; }
    .r18-gate-box h2 { font-size: 21px; }
    .r18-gate-ic { font-size: 44px; }
}
