/**
 * Book Reader Pro 3.0 — shared tokens and primitives.
 */

.br-reader-wrapper,
.br-shelf-container,
.br-wall,
.br-reviews-section,
.br-single-book {
    --br-ink: #211d18;
    --br-ink-soft: #4d463d;
    --br-muted: #837867;
    --br-paper: #f7f2e8;
    --br-paper-deep: #ede4d4;
    --br-paper-line: rgba(92, 76, 54, 0.14);
    --br-paper-line-strong: rgba(92, 76, 54, 0.24);
    --br-verdigris: #2f6b5f;
    --br-verdigris-deep: #234f47;
    --br-verdigris-soft: rgba(47, 107, 95, 0.1);
    --br-brass: #b08a4f;
    --br-brass-soft: rgba(176, 138, 79, 0.14);
    --br-danger: #a44437;
    --br-white: #fffdf8;
    --br-shadow-sm: 0 1px 2px rgba(40, 30, 18, 0.06), 0 6px 18px rgba(40, 30, 18, 0.05);
    --br-shadow-md: 0 18px 50px rgba(40, 30, 18, 0.12);
    --br-shadow-lg: 0 30px 80px rgba(40, 30, 18, 0.2);
    --br-radius: 14px;
    --br-radius-sm: 9px;
    --br-ui: "HarmonyOS Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --br-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
    --br-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    color: var(--br-ink);
    font-family: var(--br-ui);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.br-reader-wrapper button,
.br-reader-wrapper .br-primary-link,
.br-reader-wrapper .br-urge-login,
.br-drawer button,
.br-drawer .br-submit-btn {
    font-family: inherit;
    box-sizing: border-box;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: none;
}

.br-reader-wrapper *,
.br-reader-wrapper *::before,
.br-reader-wrapper *::after,
.br-shelf-container *,
.br-shelf-container *::before,
.br-shelf-container *::after,.br-wall *,
.br-wall *::before,
.br-wall *::after,
.br-reviews-section *,
.br-reviews-section *::before,
.br-reviews-section *::after {
    box-sizing: border-box;
}

.br-reader-wrapper :where(button, input, textarea, select),
.br-wall :where(button, input, textarea, select),
.br-reviews-section :where(button, input, textarea, select) {
    font: inherit;
}

/* 组件内部统一尊重 hidden 属性，避免 display:flex/grid 覆盖后拦截点击。 */
.br-reader-wrapper [hidden],
.br-shelf-container [hidden],
.br-wall [hidden],
.br-reviews-section [hidden],
.br-single-book [hidden] {
    display: none !important;
}

.br-reader-wrapper :where(button),
.br-wall :where(button),
.br-reviews-section :where(button) {
    -webkit-tap-highlight-color: transparent;
}

.br-reader-wrapper :where(button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible),
.br-wall :where(button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible),
.br-reviews-section :where(button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible) {
    outline: 2px solid var(--br-verdigris);
    outline-offset: 3px;
}

.br-reader-wrapper :where(a),
.br-wall :where(a),
.br-reviews-section :where(a) {
    color: var(--br-verdigris);
}

.br-reader-wrapper :where(img),
.br-wall :where(img),
.br-reviews-section :where(img) {
    max-width: 100%;
    height: auto;
}

.br-eyebrow {
    margin: 0 0 8px;
    color: var(--br-brass);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    line-height: 1.4;
    text-transform: uppercase;
}

.br-stars {
    position: relative;
    display: inline-block;
    color: rgba(176, 138, 79, 0.28);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.95em;
    letter-spacing: 0.08em;
    line-height: 1;
    vertical-align: -0.08em;
    white-space: nowrap;
}

.br-stars-base,
.br-stars-fill {
    display: block;
}

.br-stars-fill {
    position: absolute;
    inset: 0 auto 0 0;
    overflow: hidden;
    color: var(--br-brass);
    white-space: nowrap;
}

.br-stars-large {
    font-size: 1.45em;
}

.br-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--br-paper-deep);
}

.br-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
}

.br-status::before {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.br-status-pending {
    background: rgba(176, 138, 79, 0.16);
    color: #8b642a;
}

.br-status-approved {
    background: rgba(47, 107, 95, 0.12);
    color: var(--br-verdigris-deep);
}

.br-status-rejected {
    background: rgba(164, 68, 55, 0.12);
    color: var(--br-danger);
}

.br-status-spam {
    background: rgba(77, 70, 61, 0.12);
    color: var(--br-muted);
}

.br-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--br-muted);
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.5;
    transition: color 0.18s var(--br-ease);
}

.br-text-btn:hover {
    color: var(--br-verdigris);
}

.br-text-btn.br-danger:hover {
    color: var(--br-danger);
}

.br-text-link {
    color: var(--br-verdigris);
    font-size: 0.88rem;
    text-decoration: none;
}

.br-text-link:hover {
    text-decoration: underline;
}

.br-primary-link,
.br-submit-btn,
.br-load-more,
.br-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--br-verdigris);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    transition: transform 0.18s var(--br-ease), background 0.18s var(--br-ease), box-shadow 0.18s var(--br-ease);
}

.br-primary-link:hover,
.br-submit-btn:hover,
.br-load-more:hover,
.br-download-btn:hover {
    background: var(--br-verdigris-deep);
    box-shadow: 0 8px 22px rgba(47, 107, 95, 0.22);
    transform: translateY(-1px);
}

.br-primary-link:active,
.br-submit-btn:active,
.br-load-more:active,
.br-download-btn:active {
    transform: translateY(0) scale(0.98);
}

.br-submit-btn:disabled,
.br-load-more:disabled {
    cursor: wait;
    opacity: 0.55;
    transform: none;
}

.br-empty-state {
    margin: 0;
    padding: 28px 18px;
    border: 1px dashed var(--br-paper-line-strong);
    border-radius: var(--br-radius);
    color: var(--br-muted);
    font-size: 0.9rem;
    text-align: center;
}

.br-error {
    padding: 12px 16px;
    border-left: 3px solid var(--br-danger);
    background: rgba(164, 68, 55, 0.06);
    color: var(--br-danger);
}

.br-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.br-load-more {
    background: transparent;
    border-color: var(--br-verdigris);
    color: var(--br-verdigris);
}

.br-load-more:hover {
    background: var(--br-verdigris);
    color: #fff;
}

.br-char-count {
    color: var(--br-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.br-form-hint {
    margin: 8px 0 0;
    color: var(--br-muted);
    font-size: 0.75rem;
    line-height: 1.6;
}

.br-reveal {
    animation: br-reveal-in 0.62s var(--br-ease) both;
}

@keyframes br-reveal-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toasts */
.br-toast-stack {
    position: fixed;
    z-index: 100000;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100vw - 40px));
    pointer-events: none;
}

.br-toast {
    padding: 11px 15px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 11px;
    background: rgba(33, 29, 24, 0.94);
    box-shadow: var(--br-shadow-md);
    color: #f7f2e8;
    font-size: 0.86rem;
    line-height: 1.5;
    pointer-events: auto;
    animation: br-toast-in 0.28s var(--br-ease) both;
    backdrop-filter: blur(10px);
}

.br-toast.is-success {
    border-color: rgba(127, 184, 168, 0.35);
}

.br-toast.is-error {
    border-color: rgba(220, 120, 104, 0.45);
}

.br-toast.is-out {
    animation: br-toast-out 0.22s var(--br-ease) both;
}

@keyframes br-toast-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
}

@keyframes br-toast-out {
    to {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
}

.br-single-book-nav {
    max-width: 1240px;
    margin: 12px auto 0;
    padding: 0 20px;
    font-size: 0.85rem;
}

.br-single-book-nav a {
    color: var(--br-muted);
    text-decoration: none;
}

.br-single-book-nav a:hover {
    color: var(--br-verdigris);
}

@media (max-width: 720px) {
    .br-toast-stack {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .br-reveal,
    .br-toast,
    .br-toast.is-out {
        animation: none !important;
    }
}
