:root {
    --primary: #1a1f36;
    --accent: #4f6ef7;
    --accent-light: #eef1fe;
    --text: #1a1f36;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 32px rgba(79,110,247,0.13), 0 4px 12px rgba(0,0,0,0.07);
    --radius: 14px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ── Header ── */
header {
    background: var(--primary);
    color: white;
    padding: 52px 0 44px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(79,110,247,0.25) 0%, transparent 65%),
                radial-gradient(ellipse at 20% 80%, rgba(79,110,247,0.15) 0%, transparent 55%);
    pointer-events: none;
}

header .container { position: relative; }

.site-label {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #fff;
    margin-bottom: 16px;
    text-shadow: 0 2px 16px rgba(79,110,247,0.45);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
    color: #fff;
}

header h2 {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255,255,255,0.72);
    margin-top: 6px;
    letter-spacing: 0.02em;
}

header h3 {
    display: inline-block;
    margin-top: 18px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 5px 18px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

/* ── Main ── */
main.container {
    padding-top: 48px;
    padding-bottom: 64px;
}

/* ── Book Grid ── */
.book-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.book-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(79,110,247,0.25);
}

.book-cover-wrap {
    background: #f0f2f8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    height: 220px;
}

.book-cover {
    max-height: 180px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transition: var(--transition);
}

.book-card:hover .book-cover {
    transform: scale(1.04);
}

.book-info {
    padding: 16px 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid var(--border);
}

.book-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.45;
}

.book-author {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Purchase section ── */
.content-section {
    margin: 40px 0;
    padding: 24px 28px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.content-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.content-section ul {
    list-style: none;
    padding: 0;
}

.content-section li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
}

.content-section li:last-child { border-bottom: none; }

.content-section li::before {
    content: "📄";
    font-size: 1rem;
    flex-shrink: 0;
}

.content-section li a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

.content-section li a:hover { opacity: 0.75; }

.download-link { color: #16a34a !important; }
.download-link::before { content: "⬇️" !important; }

.purchase-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.purchase-links a {
    padding: 9px 22px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(79,110,247,0.25);
}

.purchase-links a:hover {
    background: #3a57e8;
    box-shadow: 0 4px 14px rgba(79,110,247,0.35);
    transform: translateY(-1px);
}

/* ── Detail page ── */
.detail-page {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 44px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin: 24px auto;
    max-width: 1000px;
}

.book-detail {
    display: flex;
    gap: 44px;
    margin-bottom: 40px;
}

.book-cover-large {
    width: 240px;
    height: 320px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
    background: #f0f2f8;
    padding: 10px;
}

.book-meta { flex: 1; }

.book-meta h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 22px;
    line-height: 1.35;
}

.meta-item {
    display: flex;
    margin-bottom: 11px;
    font-size: 0.93rem;
    align-items: baseline;
}

.meta-label {
    font-weight: 600;
    color: var(--text);
    width: 80px;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.meta-value { color: var(--text-muted); }

.meta-value a {
    color: var(--accent);
    text-decoration: none;
}

.meta-value a:hover { opacity: 0.75; }

/* ── Back link ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: var(--accent-light);
    color: var(--accent);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 24px;
    border: 1px solid rgba(79,110,247,0.2);
}

.back-link:hover {
    background: var(--accent);
    color: white;
    transform: translateX(-3px);
}

/* ── Breadcrumb ── */
nav.breadcrumb {
    margin-bottom: 20px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

nav.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

nav.breadcrumb span { margin: 0 6px; }

/* ── Misc ── */
.section-title {
    font-size: 1.3rem;
    color: var(--text);
    margin: 40px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.adopt-list { columns: 2; column-gap: 40px; }
.adopt-list li { break-inside: avoid; margin-bottom: 8px; }

.btn-primary {
    display: inline-block;
    padding: 12px 28px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(79,110,247,0.3);
}

.btn-primary:hover {
    background: #3a57e8;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(79,110,247,0.35);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--accent);
    color: white;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.price {
    font-size: 1.3rem;
    color: #e53e3e;
    font-weight: 700;
}

/* ── Footer ── */
footer {
    background: var(--primary);
    color: rgba(255,255,255,0.55);
    text-align: center;
    padding: 28px 0;
    font-size: 0.85rem;
    margin-top: 0;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .book-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .book-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .container { padding: 0 16px; }
    header { padding: 36px 0 30px; }
    header h1 { font-size: 1.35rem; }
    .book-detail { flex-direction: column; align-items: center; }
    .book-cover-large { width: 180px; height: 240px; }
    .adopt-list { columns: 1; }
    .detail-page { padding: 24px 18px; }
}

@media (max-width: 480px) {
    .book-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .book-cover-wrap { height: 160px; padding: 14px; }
    .book-cover { max-height: 130px; }
}
