:root {
    --bg: #efe8da;
    --bg-strong: #e4d2b3;
    --panel: rgba(255, 250, 242, 0.82);
    --panel-border: rgba(90, 55, 22, 0.12);
    --text: #2b2117;
    --muted: #7d6650;
    --accent: #a64512;
    --accent-dark: #7f3410;
    --danger: #9d2c2c;
    --success: #2f6f3c;
    --shadow: 0 24px 60px rgba(78, 43, 14, 0.12);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font-display: "Georgia", "Times New Roman", serif;
    --font-body: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-body);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.88), transparent 28%),
        radial-gradient(circle at bottom right, rgba(175, 98, 43, 0.16), transparent 34%),
        linear-gradient(135deg, #f7f0e3 0%, #ead8bb 50%, #dcc09a 100%);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 28px 22px;
    background: linear-gradient(180deg, rgba(58, 31, 13, 0.92), rgba(87, 49, 17, 0.86));
    color: #fdf3e5;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 36px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #f3c37a, #c55e1b);
    color: #2b180b;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
}

.brand-title {
    font-size: 24px;
    font-family: var(--font-display);
}

.brand-subtitle,
.sidebar-note {
    color: rgba(253, 243, 229, 0.72);
    line-height: 1.7;
}

.nav {
    display: grid;
    gap: 10px;
    margin-bottom: 30px;
}

.nav-link {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    transition: 180ms ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.16);
    transform: translateX(4px);
}

.main {
    padding: 26px;
}

.hero,
.recent-banner,
.panel,
.book-card,
.empty-card,
.notice {
    border: 1px solid var(--panel-border);
    background: var(--panel);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.notice {
    border-radius: 18px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.notice-success {
    border-color: rgba(47, 111, 60, 0.18);
    color: var(--success);
}

.notice-error {
    border-color: rgba(157, 44, 44, 0.18);
    color: var(--danger);
}

.hero {
    border-radius: 28px;
    padding: 34px;
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 24px;
}

.hero h1,
.page-heading h1,
.reader-head h1,
.recent-banner h2,
.detail-layout h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hero h1 {
    font-size: clamp(34px, 4vw, 54px);
    line-height: 1.05;
    max-width: 12ch;
}

.hero p,
.page-heading p,
.reader-head p,
.recent-banner p,
.book-intro,
.data-row p,
.reader-book-meta,
.panel p {
    color: var(--muted);
    line-height: 1.7;
}

.eyebrow,
.section-eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--accent);
}

.hero-stats {
    display: grid;
    gap: 16px;
}

.stat-card {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.55);
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 34px;
    font-family: var(--font-display);
}

.stat-label {
    color: var(--muted);
}

.toolbar,
.page-heading,
.table-header,
.form-actions,
.toolbar-actions,
.book-actions,
.row-actions,
.reader-head,
.detail-actions,
.inline-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toolbar,
.page-heading,
.recent-banner,
.form-section,
.book-grid,
.reader-layout,
.detail-layout {
    margin-top: 24px;
}

.search-form {
    display: flex;
    gap: 12px;
    flex: 1;
}

.search-input,
input[type="text"],
input[type="url"],
input[type="search"],
input[type="number"],
select,
textarea {
    width: 100%;
    border: 1px solid rgba(116, 78, 44, 0.16);
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid rgba(116, 78, 44, 0.16);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease;
    font: inherit;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff5ec;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.button-danger {
    color: #fff3f3;
    background: linear-gradient(135deg, #b03939, var(--danger));
}

.recent-banner {
    border-radius: 24px;
    padding: 24px 26px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.book-card {
    border-radius: 24px;
    padding: 20px;
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 18px;
}

.book-cover {
    width: 96px;
    height: 132px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #c76e34, #5b3116);
    color: #fff2df;
    display: grid;
    place-items: center;
    font-size: 42px;
    font-family: var(--font-display);
}

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

.book-meta h3 {
    margin: 8px 0 6px;
    font-size: 22px;
    font-family: var(--font-display);
}

.book-author,
.book-topline,
.book-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.book-intro {
    min-height: 52px;
    white-space: pre-line;
}

.book-category,
.book-status,
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.book-category {
    background: rgba(166, 69, 18, 0.12);
    color: var(--accent);
}

.book-status,
.badge-live {
    background: rgba(54, 120, 68, 0.14);
    color: #2f6f3c;
}

.badge-muted {
    background: rgba(96, 96, 96, 0.14);
    color: #6c6c6c;
}

.empty-card,
.panel {
    border-radius: 24px;
    padding: 22px;
}

.form-section,
.detail-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.source-editor {
    display: grid;
    gap: 20px;
    margin-top: 24px;
}

.source-editor-panel {
    padding: 24px;
}

.toggle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-top: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid label {
    display: grid;
    gap: 8px;
}

.full-width {
    grid-column: 1 / -1;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-table {
    display: grid;
    gap: 14px;
}

.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid rgba(116, 78, 44, 0.12);
}

.data-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.data-row strong {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
}

.reader-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
}

.reader-sidebar,
.reader-content {
    min-height: calc(100vh - 52px);
}

.chapter-list {
    margin-top: 18px;
    display: grid;
    gap: 10px;
    max-height: calc(100vh - 200px);
    overflow: auto;
}

.chapter-list.compact {
    max-height: 720px;
}

.chapter-link {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--muted);
}

.chapter-link.active,
.chapter-link:hover,
.chapter-link.static {
    background: rgba(166, 69, 18, 0.12);
    color: var(--accent);
}

.chapter-content {
    margin-top: 20px;
    font-size: 18px;
    line-height: 2;
}

.chapter-content p {
    margin: 0 0 1.2em;
    text-indent: 2em;
}

.inline-form {
    flex-wrap: wrap;
}

.inline-limit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-limit input {
    width: 120px;
}

.detail-actions {
    margin-top: 18px;
}

@media (max-width: 1100px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .hero,
    .form-section,
    .reader-layout,
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .main {
        padding: 18px;
    }

    .hero,
    .panel,
    .book-card,
    .empty-card,
    .notice {
        border-radius: 20px;
    }

    .toolbar,
    .page-heading,
    .recent-banner,
    .table-header,
    .form-actions,
    .toolbar-actions,
    .book-actions,
    .row-actions,
    .reader-head,
    .detail-actions,
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .source-editor {
        margin-top: 18px;
    }

    .book-card {
        grid-template-columns: 1fr;
    }
}
