:root {
    --bg-cream: #FFF8EE;
    --bg-paper: #FFFCF6;
    --bg-shelf: #F9EEDB;
    --ink-brown: #3A2B24;
    --ink-soft: #6C564B;
    --purple-moon: #5C4B99;
    --purple-soft: #EFEAFF;
    --pink-berry: #FF6F9D;
    --pink-soft: #FFEAF2;
    --gold-butter: #F5B841;
    --gold-soft: #FFF4D4;
    --mint-fresh: #2DB5A8;
    --mint-soft: #E3FBF7;
    --border-warm: #E7D5BC;
    --shadow-soft: 0 10px 28px rgba(74, 53, 40, 0.10);
    --shadow-card: 0 6px 18px rgba(74, 53, 40, 0.08);
    --font-story: "Chalkboard SE", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: radial-gradient(circle at top left, #FFFDF8 0%, #FFF3E0 55%, #F8E9D6 100%);
    color: var(--ink-brown);
    font-family: var(--font-story);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

[hidden] {
    display: none !important;
}

.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 1380px;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom, 8px);
}

/* ==================== 顶部导航栏（针对 iPad 分屏紧凑防溢出优化） ==================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    padding: 10px 14px;
    background: rgba(255, 250, 241, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--border-warm);
}

.topbar-brand-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.brand-emoji {
    font-size: 1.45rem;
    line-height: 1;
    flex-shrink: 0;
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
    border: 1.5px solid #E7D5BC;
    box-shadow: 0 2px 6px rgba(74, 53, 40, 0.12);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-name {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--ink-brown);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-book-name {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--purple-moon);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--mint-soft);
    border: 1.5px solid #9AE6DC;
    font-size: 0.72rem;
    font-weight: 700;
    color: #167A70;
    white-space: nowrap;
    flex-shrink: 0;
}

.live-badge.is-offline {
    background: #FFF0EE;
    border-color: #F7B8AF;
    color: #B24436;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #20C997;
    box-shadow: 0 0 0 0 rgba(32, 201, 151, 0.55);
    animation: livePulse 2.2s infinite;
}

.live-badge.is-offline .live-dot {
    background: #E8594A;
    animation: none;
}

@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(32, 201, 151, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(32, 201, 151, 0); }
    100% { box-shadow: 0 0 0 0 rgba(32, 201, 151, 0); }
}

.topbar-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

button {
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    border: none;
    background: none;
    touch-action: manipulation;
}

.nav-pill,
.ctrl-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 40px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    background: #FFFFFF;
    border: 2px solid var(--border-warm);
    box-shadow: 0 2px 0 var(--border-warm);
    transition: transform 0.14s ease, background 0.18s ease, border-color 0.18s ease;
    white-space: nowrap;
}

.nav-pill:active,
.ctrl-pill:active {
    transform: translateY(1px) scale(0.98);
}

.btn-back {
    background: var(--gold-soft);
    border-color: #EBC369;
    box-shadow: 0 2px 0 #EBC369;
}

.mode-capsule {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    background: #F4E7D4;
    border: 2px solid var(--border-warm);
}

.mode-btn {
    min-height: 34px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--ink-soft);
    white-space: nowrap;
    transition: all 0.18s ease;
}

.mode-btn.is-active {
    background: var(--purple-moon);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(92, 75, 153, 0.28);
}

.ctrl-pill.is-on {
    background: var(--purple-soft);
    border-color: #B4A2F0;
    color: var(--purple-moon);
    box-shadow: 0 2px 0 #C5B6F5;
}

.pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--purple-moon);
    color: #FFF;
    font-size: 0.74rem;
    font-weight: 800;
}

.ctrl-pill:not(.is-on) .pill-icon {
    background: #B8A79A;
}

.btn-autoplay.is-playing {
    background: var(--pink-soft);
    border-color: var(--pink-berry);
    color: #B62A5A;
    box-shadow: 0 2px 0 #F5A3BF;
}

.btn-mute {
    min-width: 42px;
    padding: 6px 10px;
}

/* ==================== 热更新温柔提示横幅 ==================== */
.hot-reload-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 14px 0;
    padding: 10px 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, #FFF3CC 0%, #FFE4EE 100%);
    border: 2px solid #F6B94E;
    box-shadow: var(--shadow-card);
    animation: bannerDrop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bannerDrop {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 240px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #4D2C1D;
}

.banner-sparkle {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.banner-btn {
    min-height: 36px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
}

.banner-btn-soft {
    background: #FFFFFF;
    border: 1.5px solid #E5B974;
}

.banner-btn-primary {
    background: var(--pink-berry);
    color: #FFFFFF;
    box-shadow: 0 3px 0 #D84E7D;
}

.banner-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    font-weight: 800;
}

/* ==================== 主舞台 ==================== */
.main-stage {
    flex: 1 1 auto;
    padding: 12px 14px 16px;
    outline: none;
}

.loading-box {
    text-align: center;
    padding: 64px 20px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink-soft);
}

/* ==================== 个人专属书架 ==================== */
.shelf-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    padding: 14px 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, #FFFDF8 0%, #FFEFE2 100%);
    border: 2px solid var(--border-warm);
    box-shadow: var(--shadow-card);
}

.shelf-hero h1 {
    margin: 0 0 4px;
    font-size: clamp(1.22rem, 2.5vw, 1.65rem);
    color: var(--ink-brown);
}

.shelf-hero p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.shelf-count-badge {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--gold-soft);
    border: 2px solid #F0C46B;
    font-size: 0.86rem;
    font-weight: 800;
    color: #7D5211;
    white-space: nowrap;
}

.bookshelf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.book-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    background: var(--bg-paper);
    border: 2.5px solid var(--border-warm);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.book-card:hover,
.book-card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--pink-berry);
    box-shadow: 0 14px 30px rgba(255, 111, 157, 0.18);
    outline: none;
}

.book-card.is-fresh {
    border-color: #F5B841;
    box-shadow: 0 0 0 3px rgba(245, 184, 65, 0.28), var(--shadow-soft);
}

.fresh-ribbon {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    padding: 5px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #FF7FA5, #FFB347);
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
}

.book-cover-wrap {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #EFE7F7;
    overflow: hidden;
}

.book-cover-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.book-spine-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(58, 43, 36, 0.16) 0%, rgba(255, 255, 255, 0.18) 6%, transparent 14%);
    pointer-events: none;
}

.book-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
}

.book-card-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--ink-brown);
}

.book-card-sub {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.48;
    color: var(--ink-soft);
}

.book-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
    padding-top: 4px;
}

.page-pill,
.mode-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
}

.page-pill {
    background: var(--purple-soft);
    color: var(--purple-moon);
}

.mode-pill {
    background: var(--mint-soft);
    color: #167A70;
}

.book-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.shelf-tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: #F6EDE0;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.book-magic-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 18px;
    border-radius: 22px;
    background: rgba(255, 252, 246, 0.72);
    border: 2.5px dashed #DFC4A0;
    min-height: 260px;
}

.magic-card-icon {
    font-size: 2.3rem;
    margin-bottom: 10px;
}

.book-magic-card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--purple-moon);
}

.book-magic-card p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--ink-soft);
}

/* ==================== 拼音注音排版（二年级清晰护眼） ==================== */
ruby.py-char {
    ruby-position: over;
    display: inline-ruby;
    margin: 0 0.06em;
}

rt.py-rt {
    font-size: 0.54em;
    font-weight: 700;
    color: #6B5094;
    letter-spacing: 0.01em;
    line-height: 1.1;
    user-select: none;
}

.py-punct {
    display: inline;
}

[data-pinyin="off"] rt.py-rt {
    display: none;
}

[data-pinyin="on"] .story-para-text,
[data-pinyin="on"] .bubble-text,
[data-pinyin="on"] .caption-text,
[data-pinyin="on"] .storybook-title,
[data-pinyin="on"] .comic-page-title {
    line-height: 2.38;
}

[data-pinyin="off"] .story-para-text,
[data-pinyin="off"] .bubble-text,
[data-pinyin="off"] .caption-text {
    line-height: 1.72;
}

[data-pinyin="off"] .storybook-title,
[data-pinyin="off"] .comic-page-title {
    line-height: 1.4;
}

/* ==================== 模式 ①：精装有声绘本模式（左图右文） ==================== */
.storybook-spread {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    border-radius: 26px;
    background: linear-gradient(180deg, #FFFDF9 0%, #FFF7EA 100%);
    border: 3px solid #DFC49C;
    box-shadow: var(--shadow-soft), inset 0 0 0 3px rgba(255, 255, 255, 0.8);
    animation: pageTurnFade 0.28s ease;
}

@media (min-width: 500px) {
    .storybook-spread {
        display: grid;
        grid-template-columns: minmax(0, 1.06fr) 12px minmax(0, 1fr);
        align-items: stretch;
        gap: 0;
        padding: 16px;
    }
}

.storybook-left-page,
.storybook-right-page {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.storybook-left-page {
    position: relative;
    justify-content: center;
    padding-right: 4px;
}

.storybook-spine {
    display: none;
}

@media (min-width: 500px) {
    .storybook-spine {
        display: block;
        margin: 8px 2px;
        border-radius: 999px;
        background: linear-gradient(90deg, rgba(160, 128, 96, 0.04) 0%, rgba(160, 128, 96, 0.22) 50%, rgba(160, 128, 96, 0.04) 100%);
    }
    .storybook-right-page {
        padding-left: 14px;
        justify-content: space-between;
    }
}

.storybook-page-ribbon {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 248, 232, 0.92);
    border: 1.5px solid #E8C78E;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--ink-brown);
    pointer-events: none;
}

.storybook-art-btn {
    position: relative;
    width: 100%;
    padding: 0;
    border-radius: 18px;
    overflow: hidden;
    border: 2.5px solid #E5CEAB;
    background: #F4E9F9;
    box-shadow: 0 8px 20px rgba(74, 53, 40, 0.12);
    display: block;
}

.storybook-illustration {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

@media (min-width: 500px) and (max-width: 820px) {
    .storybook-illustration {
        aspect-ratio: 4 / 4.2;
    }
}

.art-tap-hint {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(255, 252, 246, 0.92);
    border: 1.5px solid #E5C89E;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--ink-brown);
}

.storybook-chapter-head {
    margin-bottom: 10px;
}

.chapter-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--pink-soft);
    color: #B43764;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.storybook-title,
.comic-page-title {
    margin: 0;
    font-size: clamp(1.12rem, 2.2vw, 1.48rem);
    font-weight: 800;
    color: var(--ink-brown);
}

.storybook-paragraphs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
}

.story-para-btn {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 2px solid transparent;
    transition: all 0.18s ease;
}

.story-para-btn:hover {
    background: #FFFFFF;
    border-color: #E7D2B3;
}

.story-para-text {
    font-size: clamp(1rem, 1.9vw, 1.24rem);
    font-weight: 600;
    color: var(--ink-brown);
    flex: 1 1 auto;
}

.para-speak-badge {
    flex-shrink: 0;
    margin-top: 6px;
    font-size: 0.92rem;
    opacity: 0.6;
}

.storybook-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1.5px dashed var(--border-warm);
}

.btn-read-page {
    min-height: 42px;
    padding: 8px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #FF7CA6, #FF9966);
    color: #FFFFFF;
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: 0 4px 0 #DA5879;
}

.btn-read-page:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #DA5879;
}

.storybook-tip {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-soft);
}

/* ==================== 模式 ②：彩色多格漫画模式 ==================== */
.comic-sheet {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 24px;
    background: var(--bg-paper);
    border: 3px solid #DFC49C;
    box-shadow: var(--shadow-soft);
    animation: pageTurnFade 0.28s ease;
}

.comic-sheet-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comic-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.comic-cast-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cast-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cast-pill {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--cast-bg, #FFE8EE);
    border: 1.5px solid rgba(58, 43, 36, 0.16);
    font-size: 0.78rem;
    font-weight: 800;
}

.comic-tap-tip {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--purple-moon);
}

.comic-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 500px) {
    .comic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }
    .comic-grid[data-layout="hero-top"] .panel-idx-0 {
        grid-column: 1 / -1;
    }
    .comic-grid[data-layout="hero-bottom"] .panel-idx-2 {
        grid-column: 1 / -1;
    }
    .comic-grid[data-layout="strip-3"] .panel-idx-2 {
        grid-column: 1 / -1;
    }
}

@media (min-width: 960px) {
    .comic-grid[data-layout="strip-3"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .comic-grid[data-layout="strip-3"] .panel-idx-2 {
        grid-column: auto;
    }
}

.comic-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 6px;
    border-radius: 20px;
    background: #FFF7E9;
    border: 2.5px solid #4A3528;
    box-shadow: 0 5px 0 rgba(74, 53, 40, 0.14);
}

.comic-art-box {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid #4A3528;
    background: #EDE5F7;
}

.comic-panel-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.comic-grid[data-layout="hero-top"] .panel-idx-0 .comic-panel-img,
.comic-grid[data-layout="hero-bottom"] .panel-idx-2 .comic-panel-img {
    aspect-ratio: 16 / 9;
}

.panel-number-tag {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(58, 43, 36, 0.78);
    color: #FFFFFF;
    font-size: 0.74rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.comic-caption-btn {
    position: relative;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: linear-gradient(135deg, #FFFBE2 0%, #FFF4C8 100%);
    border: 2px solid #4A3528;
    box-shadow: 0 2px 0 rgba(74, 53, 40, 0.16);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.caption-badge {
    flex-shrink: 0;
    margin-top: 4px;
    padding: 1px 6px;
    border-radius: 6px;
    background: #F5B841;
    color: #3A2B24;
    font-size: 0.68rem;
    font-weight: 900;
}

.caption-text {
    font-size: clamp(0.8rem, 1.45vw, 0.94rem);
    font-weight: 700;
    color: var(--ink-brown);
}

/* 拟声词贴纸 */
.comic-sticker {
    position: absolute;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: clamp(0.78rem, 1.5vw, 0.96rem);
    font-weight: 900;
    border: 2.5px solid #4A3528;
    box-shadow: 0 3px 0 #4A3528;
    transform: rotate(var(--sticker-rot, -6deg));
    pointer-events: none;
    white-space: nowrap;
}

.comic-sticker.pos-top-right { top: 10px; right: 10px; }
.comic-sticker.pos-top-left { top: 10px; left: 10px; }
.comic-sticker.pos-bottom-left { bottom: 10px; left: 10px; }
.comic-sticker.pos-bottom-right { bottom: 10px; right: 38px; }

.comic-sticker.pop-pink { background: #FF87B2; color: #FFFFFF; text-shadow: 1px 1px 0 #7C2345; }
.comic-sticker.pop-gold { background: #FFD452; color: #4A3528; }
.comic-sticker.pop-mint { background: #5FE3D0; color: #194A43; }
.comic-sticker.pop-purple { background: #B89BFF; color: #FFFFFF; text-shadow: 1px 1px 0 #3E287A; }

/* 防遮挡漫画对话气泡区 */
.comic-bubbles-tray {
    position: relative;
    z-index: 3;
    margin: -10px 6px 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comic-bubble {
    position: relative;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border-radius: 18px;
    background: var(--bubble-bg, #FFFDF7);
    border: 2.5px solid var(--bubble-border, #5C4B99);
    box-shadow: 0 4px 0 rgba(74, 53, 40, 0.14);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.14s ease, box-shadow 0.18s ease;
}

.comic-bubble:active {
    transform: scale(0.985);
}

.comic-bubble-tail {
    position: absolute;
    top: -9px;
    width: 14px;
    height: 14px;
    background: var(--bubble-bg, #FFFDF7);
    border-top: 2.5px solid var(--bubble-border, #5C4B99);
    border-left: 2.5px solid var(--bubble-border, #5C4B99);
    transform: rotate(45deg);
}

.comic-bubble.side-left .comic-bubble-tail { left: 22px; }
.comic-bubble.side-right .comic-bubble-tail { right: 22px; }

.bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bubble-char-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--badge-bg, #FFE8EE);
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--ink-brown);
}

.bubble-voice-icon {
    font-size: 0.88rem;
}

.bubble-text {
    font-size: clamp(0.92rem, 1.75vw, 1.08rem);
    font-weight: 700;
    color: var(--ink-brown);
}

/* ==================== 正在朗读高亮与热刷新魔力闪光 ==================== */
.is-speaking {
    box-shadow: 0 0 0 4px rgba(245, 184, 65, 0.55), 0 8px 20px rgba(255, 111, 157, 0.25) !important;
    border-color: #F59F00 !important;
    animation: speakPulse 1.1s ease-in-out infinite alternate;
}

@keyframes speakPulse {
    from { transform: scale(1); }
    to { transform: scale(1.012); }
}

@keyframes pageTurnFade {
    from { opacity: 0.55; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-magic-flash {
    animation: magicFlash 1.2s ease;
}

@keyframes magicFlash {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.8); }
    50% { box-shadow: 0 0 0 12px rgba(255, 111, 157, 0.28); }
    100% { box-shadow: var(--shadow-soft); }
}

/* ==================== 底部大触控翻页栏 ==================== */
.reader-footer {
    position: sticky;
    bottom: 0;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 250, 241, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 2px solid var(--border-warm);
}

.page-nav-btn {
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #FFFFFF;
    border: 2px solid var(--border-warm);
    box-shadow: 0 3px 0 var(--border-warm);
    font-size: 0.92rem;
    font-weight: 800;
    white-space: nowrap;
}

.page-nav-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.page-indicator-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.page-dots {
    display: flex;
    align-items: center;
    gap: 7px;
}

.page-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: #DEC8AA;
    transition: all 0.2s ease;
}

.page-dot.is-active {
    width: 26px;
    background: var(--pink-berry);
}

.page-counter-text {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--ink-soft);
}

/* ==================== iPad 590px 分屏细节调优 ==================== */
@media (max-width: 680px) {
    .topbar {
        padding: 8px 10px;
        gap: 6px;
    }
    .brand-name {
        font-size: 0.9rem;
    }
    .live-text {
        display: none;
    }
    .live-badge {
        padding: 5px 7px;
    }
    .nav-pill,
    .ctrl-pill {
        min-height: 38px;
        padding: 5px 9px;
        font-size: 0.82rem;
    }
    .mode-btn {
        padding: 4px 9px;
        font-size: 0.8rem;
    }
    .main-stage {
        padding: 10px 10px 14px;
    }
    .storybook-spread {
        padding: 12px;
    }
    .comic-sheet {
        padding: 10px;
    }
    .page-nav-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}
