:root{
    --bg1:#fff7fb;
    --bg2:#fff1e8;
    --ink:#2a1b22;
    --muted:#82606f;

    --accent:#ff7ab6;
    --accent2:#f7b267;
    --sky:#7fc8ff;

    --paper: rgba(255,255,255,.92);
    --paper2: rgba(255,255,255,.86);

    --line: rgba(255, 122, 182, .20);
    --line2: rgba(127, 200, 255, .18);

    --shadow: 0 14px 30px rgba(30, 10, 20, .08);
    --shadow2: 0 8px 18px rgba(30, 10, 20, .06);

    --r12:12px;
    --r14:14px;
    --r16:16px;
    --r18:18px;

    --w-regular: 400;
    --w-medium: 500;
    /*--w-semibold: 600;*/
    --w-bold: 700;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
    margin:0;
    color: var(--ink);
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Hiragino Kaku Gothic ProN","Noto Sans JP","PingFang SC","Microsoft YaHei",Arial,sans-serif;
    background:
            radial-gradient(760px 320px at 12% 0%, rgba(255, 122, 182, .12) 0%, rgba(255, 122, 182, 0) 60%),
            radial-gradient(760px 340px at 92% 10%, rgba(247, 178, 103, .11) 0%, rgba(247, 178, 103, 0) 62%),
            radial-gradient(620px 300px at 55% 0%, rgba(127, 200, 255, .10) 0%, rgba(127, 200, 255, 0) 62%),
            repeating-radial-gradient(circle at 12px 12px, rgba(255, 122, 182, .05) 0 1px, rgba(255,255,255,0) 1px 18px),
            linear-gradient(180deg, var(--bg1) 0%, #fffaf2 55%, var(--bg2) 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a{color:inherit; text-decoration:none}
img{display:block; max-width:100%}
ul{list-style:none; margin:0; padding:0}

.rbm-wrap{
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 12px 12px 18px;
}
.rbm-main{padding-top: 10px}

/* overflow helpers */
.rbm-ellipsis{overflow:hidden; white-space:nowrap; text-overflow:ellipsis}
.rbm-clamp-2,.rbm-clamp-3,.rbm-clamp-6{
    display:-webkit-box;
    -webkit-box-orient:vertical;
    overflow:hidden;
}
.rbm-clamp-2{-webkit-line-clamp:2}
.rbm-clamp-3{-webkit-line-clamp:3}
.rbm-clamp-6{-webkit-line-clamp:6}

/* ===== top ===== */
.rbm-top{
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,.74);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,.7);
}
.rbm-top__bar{
    padding: 10px 12px 8px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
}
.rbm-logo{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}
.rbm-logo__mark{
    width: 30px;
    height: 30px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 122, 182, 1) 0%, rgba(127, 200, 255, 1) 55%, rgba(247, 178, 103, 1) 100%);
    box-shadow: 0 10px 18px rgba(255, 122, 182, .16);
}
.rbm-logo__name{
    font-weight: var(--w-bold);
    max-width: 48vw;
}
.rbm-top__links{display:flex; gap:8px; align-items:center}
.rbm-top__link{
    display:inline-flex;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.90);
    border: 1px solid rgba(255, 122, 182, .16);
    font-weight: var(--w-semibold);
    font-size: 13px;
}

.rbm-top__search{padding: 0 12px 10px}
.rbm-search{
    display:flex;
    gap:10px;
    padding: 10px;
    border-radius: var(--r16);
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(127, 200, 255, .22);
    box-shadow: var(--shadow2);
}
.rbm-search__input{
    flex:1;
    min-width:0;
    border:0;
    outline:0;
    background: transparent;
}
.rbm-search__btn{
    border:0;
    padding: 9px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 122, 182, 1) 0%, rgba(127, 200, 255, 1) 55%, rgba(247, 178, 103, 1) 100%);
    color:#fff;
    font-weight: var(--w-bold);
}

.rbm-nav{
    overflow:auto;
    border-top: 1px solid rgba(255,255,255,.6);
}
.rbm-nav__list{
    display:flex;
    gap:8px;
    padding: 10px 12px 10px;
    white-space:nowrap;
}
.rbm-nav__item{flex:0 0 auto}
.rbm-nav__link{
    display:inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(247, 178, 103, .18);
    font-weight: var(--w-semibold);
    max-width: 46vw;
}

/* ===== boxes ===== */
.rbm-box{
    background: var(--paper);
    border: 1px solid rgba(255,255,255,.65);
    border-radius: var(--r16);
    box-shadow: var(--shadow2);
    padding: 12px;
    margin-top: 12px;
}
.rbm-box--ghost{background: var(--paper2)}
.rbm-box__hd{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.rbm-box__title{
    margin:0;
    font-size: 16px;
    font-weight: var(--w-bold);
}
.rbm-box__sub{
    font-size: 12px;
    color: var(--muted);
    font-weight: var(--w-medium);
}

/* hero */
.rbm-hero{
    display:flex;
    gap:12px;
    padding: 12px;
    border-radius: var(--r16);
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(127,200,255,.22);
    box-shadow: var(--shadow);
}
.rbm-hero__cover{
    width: 112px;
    height: 150px;
    border-radius: var(--r14);
    overflow:hidden;
    border: 1px solid rgba(255,122,182,.14);
    background:#fff;
    flex: 0 0 auto;
}
.rbm-hero__cover img{width:100%; height:100%; object-fit: cover}
.rbm-hero__body{min-width:0; flex:1}
.rbm-hero__label{
    display:inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 122, 182, .10);
    border: 1px solid rgba(255, 122, 182, .18);
    font-size: 12px;
    font-weight: var(--w-semibold);
}
.rbm-hero__title{margin-top: 8px; font-weight: var(--w-bold); font-size: 16px}
.rbm-hero__meta{margin-top: 6px; color: var(--muted); font-size: 12px}
.rbm-hero__intro{margin-top: 8px; color: rgba(50,20,35,.95); line-height: 1.7; font-size: 13px}
.rbm-hero__cta{display:flex; gap:10px; margin-top: 10px; flex-wrap:wrap}
.rbm-cta{
    display:inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.90);
    border: 1px solid rgba(247,178,103,.16);
    font-weight: var(--w-semibold);
    font-size: 12px;
}
.rbm-cta--soft{color: var(--muted)}

/* dual blocks */
.rbm-dual{display:flex; flex-direction:column; gap:12px; margin-top: 12px}
.rbm-box--half{margin-top: 0}

/* book cards */
.rbm-booklist{display:flex; flex-direction:column; gap:10px}
.rbm-cardbook{
    border-radius: var(--r14);
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(255,122,182,.12);
    overflow:hidden;
}
.rbm-cardbook__main{
    display:flex;
    gap:12px;
    padding: 12px;
    min-width:0;
}
.rbm-cardbook__cover{
    width: 86px;
    height: 114px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(127,200,255,.18);
    background:#fff;
    flex:0 0 auto;
}
.rbm-cardbook__body{min-width:0; flex:1; display:flex; flex-direction:column; gap:6px}
.rbm-cardbook__title{font-weight: var(--w-bold); font-size: 15px; line-height:1.25}
.rbm-cardbook__meta{color: var(--muted); font-size: 12px; font-weight: var(--w-semibold)}
.rbm-cardbook__intro{color: rgba(50,20,35,.95); font-size: 13px; line-height: 1.65}
.rbm-cardbook__foot{margin-top: 6px; display:flex; justify-content:space-between; gap:10px; color: var(--muted); font-size: 12px}

.rbm-subact{
    display:flex;
    gap:10px;
    padding: 10px 12px 12px;
    border-top: 1px dashed rgba(255,122,182,.18);
    background: rgba(255, 122, 182, .04);
}
.rbm-subact__link{
    display:inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.90);
    border: 1px solid rgba(247,178,103,.16);
    font-weight: var(--w-semibold);
    font-size: 12px;
}

/* lines */
.rbm-lines{display:flex; flex-direction:column; gap:10px}
.rbm-lines--pad{margin-top: 10px}
.rbm-lines__item{
    border-radius: var(--r12);
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(127,200,255,.14);
}
.rbm-line{
    display:flex;
    justify-content:space-between;
    gap:12px;
    padding: 10px 12px;
    align-items:center;
    min-width:0;
}
.rbm-line__t{max-width: 70%; font-weight: var(--w-semibold)}
.rbm-line__s{max-width: 40%; text-align:right; color: var(--muted); font-size: 12px}

/* pill grid */
.rbm-pillgrid{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:10px;
}
.rbm-pill{
    display:flex;
    align-items:center;
    justify-content:center;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(255, 122, 182, .16);
    font-weight: var(--w-semibold);
}

/* feature */
.rbm-feature{
    display:flex;
    gap:12px;
    padding: 12px;
    border-radius: var(--r14);
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(127,200,255,.18);
}
.rbm-feature__cover{
    width: 92px;
    height: 124px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid rgba(255,122,182,.14);
    background:#fff;
    flex:0 0 auto;
}
.rbm-feature__body{min-width:0; flex:1; display:flex; flex-direction:column; gap:6px}
.rbm-feature__title{font-weight: var(--w-bold)}
.rbm-feature__meta{color: var(--muted); font-size: 12px; font-weight: var(--w-medium)}
.rbm-feature__intro{color: rgba(50,20,35,.95); font-size: 13px; line-height: 1.7}

/* book head */
.rbm-bookhead{display:flex; gap:12px}
.rbm-bookhead__cover{
    width: 112px;
    height: 150px;
    border-radius: var(--r14);
    object-fit: cover;
    border: 1px solid rgba(127,200,255,.18);
    background:#fff;
    flex:0 0 auto;
}
.rbm-bookhead__info{min-width:0; flex:1}
.rbm-bookhead__title{margin:0; font-size: 18px; font-weight: var(--w-bold); line-height:1.25}
.rbm-bookhead__meta{margin-top: 6px; color: var(--muted); font-size: 12px}
.rbm-bookhead__btns{display:flex; gap:10px; flex-wrap:wrap; margin-top: 10px}

.rbm-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(247,178,103,.18);
    font-weight: var(--w-semibold);
    font-size: 13px;
}
.rbm-btn--primary{
    border:0;
    color:#fff;
    background: linear-gradient(135deg, rgba(255, 122, 182, 1) 0%, rgba(127, 200, 255, 1) 55%, rgba(247, 178, 103, 1) 100%);
}

.rbm-text{color: rgba(50,20,35,.95); line-height: 1.85; font-size: 14px; word-break: break-word; overflow-wrap:anywhere}

/* chapters */
.rbm-chapters{display:flex; flex-direction:column; gap:8px}
.rbm-chapters__item{
    border-radius: var(--r12);
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(255,122,182,.12);
    overflow:hidden;
}
.rbm-chapters__link{display:block; padding: 12px 12px; font-weight: var(--w-semibold)}
.rbm-more{margin-top: 10px}
.rbm-more__link{
    display:block;
    text-align:center;
    padding: 12px 12px;
    border-radius: 999px;
    background: rgba(255, 122, 182, .08);
    border: 1px dashed rgba(255,122,182,.22);
    color: var(--muted);
    font-weight: var(--w-semibold);
}

.rbm-dirbtns{display:flex; gap:10px; flex-wrap:wrap; margin-bottom: 10px}

/* pager */
.rbm-pager{
    margin-top: 12px;
    display:flex;
    gap:10px;
    align-items:center;
    justify-content:space-between;
}
.rbm-pager__btn{
    flex:1;
    text-align:center;
    padding: 12px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(127,200,255,.18);
    font-weight: var(--w-semibold);
}
.rbm-pager__mid{flex:1; text-align:center; color: var(--muted); font-size: 12px; font-weight: var(--w-medium)}

/* rank box */
.rbm-rankbox{
    margin-top: 12px;
    border-radius: var(--r16);
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(247,178,103,.16);
    padding: 12px;
}
.rbm-rankbox__hd{display:flex; justify-content:space-between; gap:10px; align-items:flex-end; margin-bottom: 10px}
.rbm-rankbox__title{font-weight: var(--w-bold)}
.rbm-rankbox__more{color: var(--muted); font-weight: var(--w-semibold)}

/* footer */
.rbm-foot{padding: 12px 12px calc(16px + env(safe-area-inset-bottom))}
.rbm-foot__card{
    border-radius: var(--r16);
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(255,255,255,.7);
    box-shadow: var(--shadow2);
    padding: 12px;
}
.rbm-foot__links{display:flex; gap:10px; flex-wrap:wrap}
.rbm-foot__links a{
    display:inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.90);
    border: 1px solid rgba(255,122,182,.16);
    font-weight: var(--w-semibold);
}
.rbm-foot__meta{margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.6}

/* empty */
.rbm-empty{padding: 22px 0; text-align:center; color: var(--muted); font-weight: var(--w-medium)}

/* ========== 沉浸式阅读页专属样式 ========== */

/* 1. 传统国风主题色盘 */
:root {
    --rd-bg: #fcf7f9;            /* 胭脂白 (默认) */
    --rd-text: #4a353c;          /* 黛紫 (正文) */
    --rd-text-sub: #b59ea8;      /* 藕荷色 (副文本) */
    --rd-menu-bg: rgba(255, 248, 250, 0.95); /* 琉璃白 */
    --rd-menu-border: rgba(235, 195, 210, 0.4); /* 极细金粉线 */
    --rd-btn-bg: transparent;
    --rd-btn-border: rgba(235, 195, 210, 0.7);
    --rd-accent: #d97893;        /* 胭脂红强调色 */
}
body.theme-white {
    --rd-bg: #ffffff; /* 宣纸白 */
    --rd-text: #333333;
    --rd-menu-bg: rgba(255, 255, 255, 0.95);
    --rd-menu-border: rgba(0, 0, 0, 0.05);
    --rd-btn-border: rgba(0, 0, 0, 0.1);
}
body.theme-green {
    --rd-bg: #edf5ee; /* 天水碧 */
    --rd-text: #324f3b;
    --rd-menu-bg: rgba(240, 248, 242, 0.95);
    --rd-menu-border: rgba(172, 214, 185, 0.4);
    --rd-btn-border: rgba(172, 214, 185, 0.7);
}
body.theme-sepia {
    --rd-bg: #fdf5eb; /* 秋水黄 */
    --rd-text: #594532;
    --rd-menu-bg: rgba(253, 246, 239, 0.95);
    --rd-menu-border: rgba(235, 209, 178, 0.4);
    --rd-btn-border: rgba(235, 209, 178, 0.7);
}
body.theme-dark {
    --rd-bg: #221c1f; /* 墨夜黛紫 */
    --rd-text: #8c7b84;
    --rd-text-sub: #5c4d55;
    --rd-menu-bg: rgba(28, 23, 25, 0.96);
    --rd-menu-border: rgba(255, 255, 255, 0.04);
    --rd-btn-border: rgba(255, 255, 255, 0.1);
}

/* 2. 覆盖默认背景 */
html.is-reader body {
    background: var(--rd-bg) !important;
    transition: background-color 0.4s ease;
    margin: 0; min-height: 100vh;
}
.read-container { background: transparent !important; min-height: 100vh; }

/* 3. 古典排版 (标题采用仿宋/楷体意象，增加符号点缀) */
.chapter-title {
    /* 优先调用系统自带的古典衬线体 */
    font-family: 'STKaiti', 'KaiTi', 'Baskerville', 'Times New Roman', serif;
    font-size: 26px; font-weight: normal; margin: 40px 0 20px;
    line-height: 1.4; color: var(--rd-text) !important;
    letter-spacing: 2px; text-align: center;
}
.title-deco { color: var(--rd-accent); opacity: 0.5; font-size: 16px; margin: 0 8px; vertical-align: middle;}
.chapter-meta {
    font-size: 12px; color: var(--rd-text-sub) !important;
    margin-bottom: 45px; letter-spacing: 2px;
    display: flex; gap: 8px; align-items: center; justify-content: center;
}
.read-content {
    font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'Microsoft YaHei', sans-serif;
    font-size: 20px; line-height: 1.85;
    letter-spacing: 1.2px; color: var(--rd-text) !important;
    text-align: justify; text-justify: inter-ideograph;
    min-height: 60vh; white-space: pre-line;
}
.read-content p, .read-content div { text-indent: 2em; margin-top: 0; margin-bottom: 1.2em; }

/* 4. 琉璃/卷轴 菜单样式 */
.reader-top-bar, .reader-bottom-bar {
    position: fixed !important; z-index: 1000;
    background: var(--rd-menu-bg) !important;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--rd-menu-border);
    transition: transform 0.35s ease-in-out;
}
/* 顶部极简边框 */
.reader-top-bar {
    top: 0; left: 0; right: 0; height: 50px;
    display: flex; justify-content: space-between; align-items: center; padding: 0 15px;
    transform: translateY(-100%); border-top: none; border-left: none; border-right: none;
}
.reader-top-bar a {
    display: flex; align-items: center; gap: 4px;
    font-size: 14px; color: var(--rd-text); font-weight: 500; letter-spacing: 1px;
}
.reader-top-bar a svg { width: 16px; height: 16px; opacity: 0.8; }

/* 底部卷轴式大圆角 */
.reader-bottom-bar {
    bottom: 0; left: 0; right: 0; padding: 25px 20px calc(25px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; /* 古典圆边 */
    transform: translateY(100%); border-bottom: none; border-left: none; border-right: none;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.02);
}
body.menu-active .reader-top-bar, body.menu-active .reader-bottom-bar { transform: translateY(0); }

/* 5. 底部翻页按钮 */
.m-page-nav { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
html.is-reader .m-page-nav__a {
    flex: 1; text-align: center; padding: 12px 0;
    border-radius: 999px; /* 保留圆润的胶囊形状 */
    font-size: 14px; letter-spacing: 1px;
    background: transparent !important;
    border: 1px solid var(--rd-menu-border) !important;
    color: var(--rd-text) !important;
}
/* 核心修改：使用当前主题的正文颜色作为背景，背景色作为文字，实现完美自适应 */
html.is-reader .m-page-nav__a.c-btn--primary {
    background: var(--rd-text) !important;
    color: var(--rd-bg) !important;
    border: none !important;
    opacity: 0.9; /* 稍微降低一点点透明度，让质感更温润 */
}

/* 6. 设置选项排版 (古典方形按钮) */
.setting-row { display: flex; align-items: center; margin-bottom: 25px; gap: 15px; }
.setting-row:last-child { margin-bottom: 0; }
.setting-row .label { font-weight: 500; color: var(--rd-text-sub); font-size: 13px; width: 35px; letter-spacing: 2px;}
.setting-row button {
    padding: 6px 16px; background: var(--rd-btn-bg); border: 1px solid var(--rd-btn-border);
    border-radius: 4px; font-size: 13px; color: var(--rd-text); outline: none; transition: 0.2s; letter-spacing: 1px;
}
.setting-row .val { min-width: 50px; text-align: center; font-weight: normal; font-size: 16px; color: var(--rd-text); font-family: Georgia, serif;}
.setting-row .btn-reset { border: none; background: transparent; color: var(--rd-text-sub); }

/* 7. 主题纸笺颜色球 */
.theme-colors { display: flex; gap: 15px; flex: 1; justify-content: space-between; align-items: center;}
.theme-btn {
    width: 30px; height: 30px; border-radius: 4px; /* 古典方形纸笺 */
    cursor: pointer; border: 1px solid rgba(0,0,0,0.05); transform: rotate(45deg); /* 菱形摆放更具古风 */
}
.theme-btn.active { border-color: var(--rd-accent); transform: rotate(45deg) scale(0.9); box-shadow: 0 0 0 1px var(--rd-accent); }
.theme-default { background: #fcf7f9; }
.theme-white { background: #ffffff; }
.theme-green { background: #edf5ee; }
.theme-sepia { background: #fdf5eb; }
.theme-dark { background: #221c1f; border-color: #444; }

/* 8. 唯美遮罩层 */
.reader-guide-mask {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important; backdrop-filter: blur(2px);
    z-index: 99999 !important; display: none; justify-content: center; align-items: center;
}
.guide-box {
    background: transparent; padding: 40px 20px; border-radius: 8px;
    text-align: center; width: 70%; max-width: 280px;
    border: 1px solid rgba(255, 255, 255, 0.3); outline: 1px solid rgba(255, 255, 255, 0.1); outline-offset: 4px;
}
.guide-box p {
    margin-bottom: 30px; padding-bottom: 30px; font-size: 16px; color: #ffffff;
    line-height: 2; letter-spacing: 3px; border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.guide-box button {
    background: transparent; color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 8px 0; width: 80%; border-radius: 4px; font-size: 14px; letter-spacing: 2px;
}
/* moxue.net */