/* Newspaper Design System — 拾词阅读器 */

:root {
    /* Paper & Ink */
    --color-paper: #FAF8F5;
    --color-ink: #1A1A1A;
    --color-ink-secondary: #6B6560;
    --color-ink-tertiary: #A8A29E;

    /* Rules & Borders */
    --color-rule: #D6D0C8;
    --color-rule-dark: #8B8580;

    /* Accent — burnt sienna, used sparingly */
    --color-accent: #8B2500;
    --color-accent-bg: rgba(139, 37, 0, 0.06);

    /* Surfaces */
    --color-surface: #FFFFFF;

    /* Semantic */
    --color-success: #3D6B4F;
    --color-error: #9B2C2C;

    /* Font stacks */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body-cn: 'Noto Serif SC', 'Songti SC', serif;
    --font-body-en: 'Source Serif 4', Georgia, serif;
    --font-ui: 'Inter', -apple-system, sans-serif;
}

/* Base */
body.newspaper {
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-body-cn);
    -webkit-font-smoothing: antialiased;
}

/* Masthead */
.masthead {
    text-align: center;
    padding: 14px 0 0;
}

.masthead-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.25rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--color-ink);
}

.masthead-rule {
    margin-top: 12px;
    border: none;
    border-top: 1px solid var(--color-ink);
    position: relative;
}

.masthead-rule::after {
    content: '';
    display: block;
    border-top: 1px solid var(--color-ink);
    margin-top: 3px;
}

/* Hairline rules */
.rule {
    border: none;
    border-top: 1px solid var(--color-rule);
    margin: 0;
}

.rule-dark {
    border-color: var(--color-rule-dark);
}

/* Buttons */
.btn-primary {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.5rem;
    background: var(--color-ink);
    color: var(--color-paper);
    border: 1.5px solid var(--color-ink);
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--color-ink);
    border: 1px solid var(--color-rule);
    cursor: pointer;
    transition: border-color 0.15s;
}

.btn-secondary:hover {
    border-color: var(--color-ink);
}

.btn-ghost {
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--color-accent);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Input — underline only */
.input-underline {
    display: block;
    width: 100%;
    font-family: var(--font-body-cn);
    font-size: 0.9375rem;
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid var(--color-rule);
    background: transparent;
    color: var(--color-ink);
    outline: none;
    transition: border-color 0.15s;
}

.input-underline:focus {
    border-bottom: 2px solid var(--color-ink);
    margin-bottom: -1px;
}

.input-underline::placeholder {
    color: var(--color-ink-tertiary);
}

/* Badge — small caps with hairline border */
.badge {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 6px;
    border: 1px solid currentColor;
}

.badge-success {
    color: var(--color-success);
}

.badge-muted {
    color: var(--color-ink-tertiary);
}

/* Error message */
.error-bar {
    border-left: 3px solid var(--color-accent);
    padding: 0.625rem 0.75rem;
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    color: var(--color-error);
    background: transparent;
}

/* Tab navigation */
.tab-nav {
    background: var(--color-paper);
    border-top: 1px solid var(--color-rule);
}

.tab-item {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--color-ink-tertiary);
    border-top: 2px solid transparent;
    padding: 0.75rem 0;
    cursor: pointer;
    background: none;
    transition: color 0.15s;
}

.tab-item.active {
    color: var(--color-ink);
    border-top-color: var(--color-accent);
}

/* Book cover fallback */
.cover-fallback {
    background: var(--color-paper);
    border: 1px solid var(--color-rule);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.cover-fallback-title {
    font-family: var(--font-display);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    color: var(--color-ink);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* Settings option toggle */
.opt-toggle {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 0.25rem;
    color: var(--color-ink-tertiary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.opt-toggle.active {
    color: var(--color-ink);
    border-bottom-color: var(--color-accent);
}

/* Slider accent */
input[type="range"] {
    accent-color: var(--color-accent);
}

/* Upload card */
.upload-card {
    border: 1px solid var(--color-rule);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s;
}

.upload-card:hover {
    border-color: var(--color-ink-tertiary);
}

.upload-plus {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 400;
    color: var(--color-ink-tertiary);
    line-height: 1;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
    }
}

.modal-box {
    background: var(--color-surface);
    width: 100%;
    max-width: 28rem;
    padding: 1.5rem 1.5rem 2rem;
    border-radius: 2px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    color: var(--color-ink);
    margin-bottom: 0.25rem;
}

/* Per-book progress bar */
.progress-bar-track {
    height: 2px;
    background: var(--color-rule);
    border-radius: 1px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--color-accent);
    border-radius: 1px;
    transition: width 0.8s ease;
}

.progress-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* Delete button */
.delete-x {
    position: absolute;
    top: 4px;
    right: 4px;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    color: var(--color-ink-tertiary);
    background: var(--color-paper);
    border: 1px solid var(--color-rule);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.book-card:hover .delete-x,
.book-card:active .delete-x {
    opacity: 1;
}
