:root {
    --primary-color: #8b2b22;
    --secondary-color: #d4af37;
    --bg-color: #f4efdb;
    --text-color: #3b2b20;
    --border-color: #c9b08c;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --font-title: "Noto Serif SC", "STSong", "SimSun", serif;
    --font-text: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-text);
    background-color: #e6dfc9;
    color: var(--text-color);
    overflow-x: hidden;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-color);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.header {
    height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(to bottom, #f9f4e8, var(--bg-color));
}

.app-logo {
    font-family: var(--font-title);
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--border-color);
    border: 1px solid var(--primary-color);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    height: 65px;
    background-color: #fffaf0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
}

.nav-item {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item .icon {
    font-size: 24px;
    margin-bottom: 4px;
}

/* Content Area */
.view-content {
    padding-bottom: 80px;
}

/* Home Page */
.banner {
    padding: 20px;
}

.banner-card {
    height: 180px;
    background: linear-gradient(135deg, #8b2b22 0%, #5a1914 100%);
    border-radius: 12px;
    padding: 30px 20px;
    color: #ffefd5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(139, 43, 34, 0.3);
    position: relative;
    overflow: hidden;
}

.banner-card::after {
    content: "典";
    position: absolute;
    right: -20px;
    bottom: -20px;
    font-size: 120px;
    color: rgba(255, 239, 213, 0.05);
    font-family: var(--font-title);
}

.banner-card h2 {
    font-family: var(--font-title);
    font-size: 24px;
    margin-bottom: 10px;
}

.banner-card p {
    font-size: 14px;
    opacity: 0.8;
}

.book-section {
    padding: 10px 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    font-family: var(--font-title);
    font-size: 18px;
    color: var(--text-color);
}

.section-header a {
    font-size: 12px;
    color: #888;
    text-decoration: none;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.book-card {
    display: flex;
    flex-direction: column;
}

.book-cover {
    aspect-ratio: 2/3;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.08);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 8px;
    transition: transform 0.2s;
}

.book-card:active .book-cover {
    transform: scale(0.98);
}

.book-cover .calligraphy {
    font-family: var(--font-title);
    font-size: 28px;
    color: #222;
    writing-mode: vertical-rl;
    letter-spacing: 4px;
    line-height: 1.2;
}

.book-cover.free {
    background: linear-gradient(to right, #f4f4f4, #fff);
    border-left: 8px solid #ddd;
}

.book-cover.vip {
    background: linear-gradient(to right, #f9f1e1, #fffaf0);
    border-left: 8px solid var(--secondary-color);
}

.tag {
    position: absolute;
    top: 0;
    right: 10px;
    padding: 4px 6px;
    font-size: 10px;
    color: #fff;
    border-radius: 0 0 4px 4px;
}

.tag.free {
    background-color: #555;
}

.tag.vip {
    background-color: var(--primary-color);
}

.book-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 2px;
}

.book-author {
    font-size: 12px;
    color: #888;
}

/* Reader View */
.reader-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.reader-header {
    height: 50px;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.5);
}

.reader-text {
    flex: 1;
    padding: 30px;
    font-size: 18px;
    line-height: 2.2;
    text-align: justify;
    font-family: "Songti SC", "STSong", serif;
    overflow-y: auto;
    white-space: pre-wrap;
}

.reader-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.progress-bar {
    height: 4px;
    background-color: #ddd;
    border-radius: 2px;
    margin-bottom: 10px;
}

.current-progress {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

/* Pay Modal */
.pay-container {
    position: fixed;
    top: 10vh;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fffafa;
    border-radius: 30px 30px 0 0;
    padding: 30px 20px;
    z-index: 200;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.vip-benefit-card {
    background-color: #2c2c2c;
    color: var(--secondary-color);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.vip-benefit-card ul {
    list-style: none;
    font-size: 13px;
    margin-top: 10px;
}

.plan-option {
    border: 2px solid #eee;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.plan-option.selected {
    border-color: var(--primary-color);
    background-color: #fff5f5;
}

.plan-name {
    font-weight: bold;
    display: block;
}

.plan-note {
    font-size: 11px;
    color: #888;
}

.plan-price {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: bold;
}

.discount-tag {
    position: absolute;
    top: -10px;
    left: 10px;
    background-color: var(--primary-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-pay {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    margin-top: 20px;
}

.pay-methods {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #888;
}

/* Shelf Page */
.shelf-page,
.discover-page,
.profile-page {
    padding: 20px;
}

.shelf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.edit-btn {
    font-size: 14px;
    color: var(--primary-color);
}

.recent-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.recent-cover {
    width: 60px;
    height: 80px;
    background-color: #f9f4e8;
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calligraphy-small {
    writing-mode: vertical-rl;
    font-family: var(--font-title);
    font-size: 14px;
}

.recent-info {
    flex: 1;
}

.recent-info h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.recent-info p {
    font-size: 12px;
    color: #888;
}

.mini-progress {
    height: 4px;
    background-color: #eee;
    border-radius: 2px;
    margin-top: 8px;
}

.mini-progress .fill {
    height: 100%;
    background-color: var(--primary-color);
}

.resume-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
}

.shelf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.book-item {
    text-align: center;
}

.book-cover-mini {
    aspect-ratio: 3/4;
    background-color: #fff;
    box-shadow: var(--shadow);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover-mini.empty {
    border: 1px dashed var(--border-color);
    background-color: transparent;
    color: #ccc;
    font-size: 30px;
}

.book-item p {
    font-size: 12px;
}

/* Discover Page */
.search-bar {
    background-color: #eee;
    padding: 12px 20px;
    border-radius: 25px;
    color: #888;
    font-size: 14px;
    margin-bottom: 20px;
}

.categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 20px;
    scrollbar-width: none;
}

.cat-item {
    white-space: nowrap;
    padding: 6px 16px;
    border-radius: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    font-size: 14px;
}

.cat-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.scroll-row {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    margin-top: 15px;
    padding-bottom: 10px;
}

.scroll-item {
    width: 120px;
    flex-shrink: 0;
}

.scroll-img-placeholder {
    height: 80px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
    margin-bottom: 8px;
    color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

/* Profile Page */
.user-info-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(to right, #fdfbf7, #f4efdb);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    position: relative;
    margin-bottom: 20px;
}

.avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ddd;
    border: 2px solid var(--primary-color);
}

.user-details h3 {
    font-size: 20px;
    margin-bottom: 5px;
}

.user-details p {
    font-size: 12px;
    color: #888;
}

.btn-checkin {
    position: absolute;
    top: 20px;
    right: 20px;
    border: 1px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item .value {
    font-weight: bold;
    font-size: 18px;
    color: var(--primary-color);
}

.stat-item .label {
    font-size: 11px;
    color: #888;
}

.menu-list {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #f5f5f5;
}

.menu-icon {
    font-size: 20px;
    margin-right: 15px;
}

.menu-item span {
    flex: 1;
    font-size: 15px;
}

.arrow {
    color: #ccc;
    font-size: 14px;
}

.version-info {
    text-align: center;
    font-size: 12px;
    color: #ccc;
    margin-top: 30px;
}