:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --primary: #0071e3;
    --primary-dark: #0051d2;
    --primary-light: #e8f4ff;
    --danger: #d70015;
    --danger-bg: #fff2f4;
    --success: #1d8230;
    --success-bg: #e8fff0;
    --border: #d2d2d7;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.08);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.15);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-lg: 28px;
    --header-height: 52px;
    --sidebar-width: 400px;
    --drawer-handle: 44px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* clip 与 hidden 一样禁止横向滚动，但不会把 body 变成滚动容器，
       从而让阅读页左侧词表窗口的 position: sticky 生效。不支持的旧浏览器回退到上一行 hidden。 */
    overflow-x: clip;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
    overflow-x: clip;
}

a {
    color: var(--primary);
    text-decoration: none;
}

.text-secondary {
    color: var(--text-secondary);
}

button {
    font-family: inherit;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 22px;
}

.container.narrow {
    max-width: 420px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
    letter-spacing: 0;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 0.9rem;
}

.top-nav a {
    color: var(--text-secondary);
    transition: color 0.15s;
}

.top-nav a:hover {
    color: var(--text);
}

/* Mobile hamburger nav (hidden on desktop) */
.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    margin-left: 10px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
}

.nav-toggle:active {
    background: rgba(0, 0, 0, 0.05);
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: var(--text);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 99;
    padding: 6px 22px 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.mobile-nav a {
    display: block;
    padding: 13px 4px;
    font-size: 1rem;
    color: var(--text);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-nav a:last-child {
    border-bottom: none;
}

@keyframes mobileNavIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary, .btn-text, .btn-danger, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary.small {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-primary.full {
    width: 100%;
}

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

.btn-secondary.small,
.btn-text.small {
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 0.82rem;
}

.btn-secondary.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.btn-text {
    background: transparent;
    color: var(--primary);
}

.btn-text.full {
    width: 100%;
}

.btn-text:hover {
    background: var(--primary-light);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-danger:hover {
    background: #ffe6e9;
}

/* Hero */
.hero {
    padding: 96px 0 56px;
    text-align: center;
}

.hero h1 {
    font-size: 2.75rem;
    line-height: 1.1;
    letter-spacing: 0;
    margin: 0 0 16px;
    font-weight: 700;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.15rem;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}

.hero h1 span,
.hero p span {
    display: inline;
}

.hero-visual {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    font-size: 3.5rem;
}

.hero-orb {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--primary-light), #dbeafe);
    filter: blur(2px);
    opacity: 0.8;
}

/* Book list */
.category-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto;
    padding: 0 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
    display: none;
}

.category-tab {
    flex: 0 0 auto;
    min-width: 78px;
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid rgba(0, 113, 227, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.category-tab:hover {
    border-color: rgba(0, 113, 227, 0.42);
    color: var(--primary);
}

.category-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 113, 227, 0.18);
}

.category-tab.is-empty {
    opacity: 0.55;
    border-style: dashed;
}

.category-tab.is-empty:hover {
    opacity: 0.85;
    border-color: rgba(0, 113, 227, 0.42);
}

.category-tab.is-locked {
    position: relative;
    padding-right: 30px;
}

.category-tab.is-locked::after {
    content: '🔒';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    opacity: 0.7;
}

.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
    gap: 18px;
    padding: 28px 0 80px;
}

.book-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: stretch;
    gap: 16px;
    max-width: 100%;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.book-card h3 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.35;
    font-weight: 600;
}

.book-headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.book-category {
    display: inline-block;
    align-self: flex-start;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary);
}

.book-heat {
    flex: 0 0 auto;
    color: #8a8a90;
    font-size: 0.78rem;
}

.book-cover-link {
    display: block;
    flex: 0 0 132px;
    position: relative;
    text-decoration: none;
    margin: 0;
    height: 176px;
    overflow: hidden;
    border-radius: var(--radius-sm);
}

.book-cover-link:hover {
    opacity: 0.95;
}

.book-cover {
    width: 100%;
    height: 176px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-sm);
    background: var(--border);
}

.book-score {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 600;
}

.book-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 9px;
}

.book-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.93rem;
    line-height: 1.55;
}

.book-hook {
    display: -webkit-box;
    min-height: 2.9em;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.book-tags span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #f2f2f4;
    color: #66666b;
    font-size: 0.76rem;
    font-weight: 500;
}

.book-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary);
}

.book-card .actions {
    margin-top: auto;
    padding-top: 8px;
}

.book-card .actions .btn-primary.full {
    width: auto;
    min-width: 128px;
    padding: 9px 18px;
}

/* Page back */
.page-back {
    padding: 24px 0 14px;
}

.page-back a {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.page-back a:hover {
    color: var(--text);
}

/* Book header */
.book-header {
    padding: 24px 0 48px;
    text-align: center;
}

.book-header h1 {
    margin: 0 0 10px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0;
}

.book-header p {
    margin: 0 auto;
    color: var(--text-secondary);
    max-width: 560px;
    line-height: 1.6;
}

/* Chapter list */
.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 80px;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.chapter-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.chapter-item.locked {
    opacity: 0.65;
}

.chapter-item .title {
    font-weight: 500;
}

.chapter-item .status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Reader */
.reader-layout {
    display: flex;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
    padding-bottom: 0;
    background: var(--bg);
}

.reader-sidebar {
    position: relative;
    align-self: stretch;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}

/* 词表悬浮窗口：position: sticky 纯 CSS 跟随视口，轨道为 .reader-sidebar（align-self: stretch 撑到整章高度）。
   sticky 自动处理底部钳制：到达轨道底部后随轨道一起滚走，不会盖住页脚，无需 JS 参与定位。
   前提：html/body 必须用 overflow-x: clip（hidden 会把 body 变成滚动容器导致 sticky 失效）。
   不支持 clip 的老浏览器由 main.js 的 syncWordListShellPosition() 用 transform 兜底。 */
.word-list-shell {
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height)); /* dvh 适配 iPad Safari 动态工具栏 */
    max-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow: hidden;
    background: var(--surface);
    background-clip: padding-box;
}

.word-list-shell .sidebar-header {
    flex-shrink: 0;
}

.word-list-shell .word-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
}

.sidebar-header {
    margin-bottom: 24px;
}

.sidebar-header a {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sidebar-header a:hover {
    color: var(--text);
}

.sidebar-header h2 {
    margin: 12px 0 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.word-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.word-list .placeholder {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 24px 0;
}

.word-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: background 0.2s, border-color 0.2s;
}

.word-card.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

/* 词典风格词卡 */
.dict-card {
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.dict-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dict-word {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0;
}

.dict-actions {
    display: flex;
    gap: 6px;
}

.dict-icon-btn {
    min-width: 64px;
    height: auto;
    padding: 4px 6px;
    border-radius: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.dict-icon-btn:hover {
    background: var(--bg);
    color: var(--primary);
}

.dict-icon-btn.active {
    color: var(--primary);
}

.dict-icon-btn .btn-label {
    font-size: 0.65rem;
    line-height: 1;
    white-space: nowrap;
}

.dict-phonetic {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.phone-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dict-entries {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dict-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.55;
}

.dict-entry .pos {
    font-style: italic;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    min-width: 2.8em;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.dict-entry .pos.context {
    font-style: normal;
}

.dict-entry .cn-meaning {
    color: var(--text);
    font-size: 1rem;
}

.dict-body,
.icon-btn,
.word-card .actions {
    display: none;
}

.reader-content {
    flex: 1;
    padding: 36px;
    max-width: 900px;
    transition: max-width 0.25s ease;
}

.reader-layout.sidebar-hidden .reader-sidebar {
    display: none;
}

.reader-layout.sidebar-hidden .reader-content {
    max-width: 1040px;
}

.chapter-review-mode .reader-sidebar {
    display: none;
}

.chapter-review-mode .mobile-drawer {
    display: none;
}

.chapter-review-mode .reader-content {
    max-width: 1040px;
}

.review-word-popover {
    display: none;
    position: fixed;
    top: calc(var(--header-height) + 72px);
    right: max(18px, calc((100vw - 1360px) / 2));
    width: min(320px, calc(100vw - 32px));
    z-index: 115;
}

.review-word-popover.visible {
    display: block;
}

.review-word-popover-shell {
    max-height: calc(100vh - var(--header-height) - 104px);
    overflow-y: auto;
    border: 1px solid rgba(210, 210, 215, 0.95);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
}

.review-word-popover-top {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px 8px 16px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(210, 210, 215, 0.72);
}

.review-word-popover-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.review-word-popover-close {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(110, 110, 115, 0.12);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 30px;
}

.review-word-popover-close:hover,
.review-word-popover-close:focus-visible {
    background: rgba(0, 113, 227, 0.12);
    color: var(--primary);
    outline: none;
}

.review-word-popover-body {
    padding: 14px 16px 18px;
}

.review-floating-card .dict-word {
    font-size: 1.38rem;
}

.review-floating-card .dict-icon-btn {
    min-width: 44px;
}

.review-floating-card .dict-entry .cn-meaning {
    font-size: 0.96rem;
}

@media (max-width: 1100px) {
    .review-word-popover {
        top: auto;
        left: auto;
        right: 16px;
        bottom: 18px;
        width: min(420px, calc(100vw - 32px));
    }

    .review-word-popover-shell {
        max-height: 44vh;
    }
}

.reader-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.word-count {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.word-count strong {
    color: var(--primary);
    font-weight: 600;
}

.review-status {
    min-height: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.content-header {
    text-align: center;
    margin-bottom: 32px;
}

.content-header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.content-body {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 48px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.content-body p {
    margin: 0 0 1.25em;
    font-size: 1.125rem;
    line-height: 1.85;
    text-align: justify;
    color: var(--text);
}

.content-body p:last-child {
    margin-bottom: 0;
}

.chapter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.chapter-nav .nav-prev,
.chapter-nav .nav-toc,
.chapter-nav .nav-next {
    min-width: 88px;
    text-align: center;
}

.chapter-nav .nav-prev.disabled,
.chapter-nav .nav-next.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chapter-nav .nav-toc {
    color: var(--text-secondary);
}

.chapter-nav .nav-next {
    padding: 10px 18px;
    border-radius: 18px;
}

.hl {
    display: inline;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    padding: 1px 4px;
    border-radius: 6px;
    background: var(--primary-light);
    transition: background 0.15s;
}

.hl:hover {
    background: #d6eaff;
}

.hl .meaning-inline {
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 2px;
}

.hl.active {
    background: var(--primary);
    color: #fff;
}

.chapter-review-mode .hl {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    padding: 2px 5px;
    cursor: default;
    vertical-align: baseline;
}

.chapter-review-mode .hl:hover {
    background: var(--primary-light);
}

.review-input {
    min-width: 68px;
    max-width: 190px;
    height: 1.8em;
    border: none;
    border-bottom: 2px solid rgba(0, 113, 227, 0.38);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.76);
    color: var(--primary);
    font: inherit;
    font-weight: 700;
    line-height: 1.3;
    padding: 0 4px;
    outline: none;
}

.review-input:focus {
    border-bottom-color: var(--primary);
    background: #fff;
}

.review-clear-btn {
    width: 24px;
    height: 24px;
    margin-left: -1px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(110, 110, 115, 0.16);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 24px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.chapter-review-mode .hl:focus-within .review-clear-btn,
.chapter-review-mode .hl.has-review-value .review-clear-btn {
    opacity: 1;
}

.review-clear-btn:hover,
.review-clear-btn:focus-visible {
    background: rgba(215, 0, 21, 0.12);
    color: var(--danger);
    outline: none;
}

.review-meaning {
    color: var(--text-secondary);
    font-weight: 600;
}

.review-reveal-btn,
.review-card-btn {
    margin-left: 2px;
    min-height: 26px;
    padding: 2px 8px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 113, 227, 0.1);
    color: var(--primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-size: 0.76em;
    font-weight: 600;
    line-height: 1.5;
    touch-action: manipulation;
}

.review-card-btn {
    display: none;
    min-width: 44px;
    background: rgba(110, 110, 115, 0.13);
    color: var(--text-secondary);
}

.hl.revealed .review-card-btn {
    display: inline-flex;
}

.review-reveal-btn:hover,
.review-card-btn:hover {
    background: rgba(0, 113, 227, 0.18);
    color: var(--primary);
}

.review-reveal-btn:disabled {
    color: #8a5a00;
    cursor: default;
    opacity: 0.8;
}

.hl.correct {
    background: var(--success-bg);
    color: var(--success);
}

.hl.correct .review-input {
    border-bottom-color: var(--success);
    color: var(--success);
}

.hl.wrong {
    background: var(--danger-bg);
    color: var(--danger);
}

.hl.wrong .review-input {
    border-bottom-color: var(--danger);
    color: var(--danger);
}

.hl.revealed {
    background: #fff7df;
    color: #8a5a00;
}

.hl.revealed .review-input {
    border-bottom-color: #c58a00;
    color: #8a5a00;
}

/* Mobile drawer */
.mobile-drawer {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border);
}

.modal-content h3 {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-content p {
    color: var(--text-secondary);
}

.wechat-id {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text);
    margin: 12px 0;
}

.form-msg {
    font-size: 0.85rem;
    color: var(--primary);
    min-height: 1.2em;
    margin: 10px 0 0;
}

.form-msg.error {
    color: var(--danger);
}

.form-msg.success {
    color: var(--success);
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-group.inline {
    display: flex;
    gap: 10px;
}

.form-group.inline input {
    flex: 1;
}

/* Auth */
.auth-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    margin-top: 48px;
    box-shadow: var(--shadow);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.auth-tabs .tab {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.auth-tabs .tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-links {
    text-align: center;
    margin-top: 6px;
}

.auth-links a {
    font-size: 0.9rem;
    color: var(--primary);
}

/* Security */
.security-section {
    margin-bottom: 28px;
}

.security-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.security-card h2 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    font-weight: 600;
}

.security-status {
    color: var(--text-secondary);
    margin: 0 0 16px;
}

.security-status.warning {
    color: var(--danger);
    background: var(--danger-bg);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.security-question-text {
    margin: 0;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
}

.wechat-help {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.wechat-help strong {
    color: var(--text);
    font-weight: 600;
}

/* Wordbook */
.wordbook-toolbar {
    margin: 24px 0;
}

.wordbook-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding-bottom: 80px;
}

.wordbook-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wordbook-item.dict-card {
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.wordbook-item .source {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Review card */
.review-card {
    text-align: center;
    max-width: 520px;
    padding: 32px;
}

.review-progress {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: right;
    margin-bottom: 10px;
}

.card-front h2,
.card-back h2 {
    font-size: 2.75rem;
    font-weight: 700;
    margin: 0 0 16px;
    letter-spacing: 0;
}

.review-kicker {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 24px 0 8px;
}

.review-context {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.75;
    margin: 0;
    padding: 16px;
    text-align: left;
}

.review-no-context {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 20px 0 0;
}

.review-source {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 14px 0 0;
}

.card-back .meaning {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.65;
    margin: 14px 0;
    padding: 16px;
    text-align: left;
}

.card-back .phonetic {
    color: var(--text-secondary);
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 1rem;
}

.card-back .phonetic .phone-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.review-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.review-actions button {
    flex: 1;
}

/* Membership */
.membership-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.membership-header {
    background: linear-gradient(135deg, var(--primary-light), var(--surface));
    padding: 28px;
    border-bottom: 1px solid var(--border);
}

.membership-header h2 {
    margin: 0 0 6px;
    font-size: 1.4rem;
    font-weight: 700;
}

.membership-header p {
    margin: 0;
    color: var(--text-secondary);
}

.membership-body {
    padding: 24px 28px;
}

.claim-code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.claim-code-box code {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0;
    word-break: break-all;
}

.membership-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.membership-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.membership-list li:last-child {
    border-bottom: none;
}

.redeem-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.redeem-section h2 {
    margin: 0 0 16px;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 14px;
    display: block;
}

.empty-state h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 600;
}

.empty-state p {
    margin: 0 0 20px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.locked-category {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
}

.locked-category .locked-icon {
    font-size: 3rem;
    margin-bottom: 14px;
    display: block;
}

.locked-category h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 600;
}

.locked-category p {
    margin: 0 0 20px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

/* 锁定分类：整面封面墙 + 中央锁提示 */
.locked-category-wall {
    position: relative;
    width: 100%;
    min-height: 520px;
    max-height: 72vh;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin: 12px 0 80px;
}

.locked-wall-backdrop {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 1fr;
    gap: 10px;
    padding: 10px;
    filter: blur(8px) grayscale(0.25) brightness(0.88);
    transform: scale(1.04);
    pointer-events: none;
}

.locked-wall-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    opacity: 0.9;
}

.locked-wall-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(1px);
    color: var(--text);
    z-index: 2;
}

.locked-wall-icon {
    font-size: 2.6rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.85;
}

.locked-wall-overlay h3 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
}

.locked-wall-overlay p {
    margin: 0 0 20px;
    max-width: 340px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.55;
}

.locked-wall-overlay .btn-primary {
    padding: 11px 28px;
    font-size: 1rem;
    box-shadow: 0 8px 24px rgba(0, 113, 227, 0.22);
}

@media (max-width: 768px) {
    .locked-category-wall {
        min-height: 420px;
        max-height: none;
    }

    .locked-wall-backdrop {
        grid-template-columns: repeat(3, 1fr);
    }

    .locked-wall-overlay h3 {
        font-size: 1.15rem;
    }

    .locked-wall-overlay p {
        font-size: 0.9rem;
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translate(-50%, 12px);
    background: rgba(29, 29, 31, 0.88);
    color: #fff;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Admin */
.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

.admin-sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px;
}

.admin-sidebar h2 {
    margin: 0 0 20px;
    font-size: 1.2rem;
}

.admin-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-sidebar nav a {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.admin-sidebar nav a.active,
.admin-sidebar nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.admin-main {
    flex: 1;
    padding: 24px 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.list-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.list-title-row h3 {
    margin: 0;
}

.list-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.filter-bar .search-field {
    min-width: min(100%, 320px);
}

.filter-bar .form-group,
.custom-date-row .form-group,
.advanced-filter .form-group {
    margin-bottom: 0;
}

.custom-date-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 220px));
    gap: 12px;
    margin: -4px 0 14px;
}

.advanced-filter {
    margin: -4px 0 14px;
    color: var(--text-secondary);
}

.advanced-filter summary {
    cursor: pointer;
    display: inline-flex;
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--primary);
}

.advanced-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 220px));
    gap: 12px;
    padding-top: 8px;
}

.filter-actions {
    display: flex;
    align-items: end;
    min-height: 72px;
}

.filter-actions .btn-secondary {
    height: 44px;
    white-space: nowrap;
}

.pagination-bar {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.pagination-size,
.pagination-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-size label,
.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-size select {
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    background: var(--surface);
}

.pagination-actions .btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.admin-table-wrap .admin-table {
    min-width: 1180px;
    border: 0;
    border-radius: 0;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.admin-table th {
    background: var(--bg);
    color: var(--text-secondary);
    font-weight: 500;
}

.admin-table td code {
    white-space: normal;
    word-break: break-word;
}

.audit-detail-main {
    line-height: 1.6;
}

.audit-detail-muted {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.audit-code-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.audit-code-list code {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.btn-text.danger {
    color: #c62828;
}

.btn-text.danger:hover {
    color: #9f1f1f;
}

.status-muted {
    color: #c62828;
    font-size: 0.78rem;
}

/* Loading */
.loading {
    color: var(--text-secondary);
    padding: 20px 0;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .header-inner {
        gap: 10px;
        width: 100%;
        padding: 0;
    }

    .logo {
        font-size: 1rem;
        white-space: nowrap;
    }

    .top-nav {
        gap: 9px;
        font-size: 0.8rem;
        margin-left: auto;
        flex: 0 0 auto;
    }

    .top-nav a[href="/"] {
        display: none;
    }

    .top-nav a[href="/wordbook"],
    .top-nav a[href="/membership"] {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .mobile-nav.open {
        display: block;
        animation: mobileNavIn 0.18s ease-out;
    }

    .btn-primary.small {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .hero {
        padding: 56px 0 36px;
    }

    .hero h1 {
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
        font-size: 1.78rem;
        line-height: 1.18;
        overflow-wrap: anywhere;
    }

    .hero p {
        max-width: 318px;
        font-size: 1rem;
    }

    .hero h1 span,
    .hero p span {
        display: block;
    }

    .hero-visual {
        font-size: 2.5rem;
        margin-top: 28px;
        gap: 16px;
    }

    .hero-orb {
        width: 68px;
        height: 68px;
    }

    .reader-sidebar {
        display: none;
    }

    .reader-content {
        padding: 0;
        max-width: 100%;
    }

    .reader-toolbar {
        padding: 16px 20px 0;
        margin-bottom: 14px;
    }

    .content-header {
        padding: 0 20px;
        margin-bottom: 24px;
    }

    .content-header h1 {
        font-size: 1.15rem;
    }

    .content-body {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 28px 20px;
        box-shadow: none;
    }

    .content-body p {
        font-size: 1.15rem;
        line-height: 1.9;
        margin-bottom: 1.1em;
    }

    .chapter-nav {
        margin: 36px 20px;
        padding-top: 22px;
    }

    .chapter-nav .nav-prev,
    .chapter-nav .nav-toc,
    .chapter-nav .nav-next {
        min-width: 72px;
        font-size: 0.9rem;
    }

    .mobile-drawer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        border-radius: var(--radius) var(--radius) 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
        z-index: 92;
        transform: translateY(calc(100% - var(--drawer-handle)));
        transition: transform 0.25s ease;
    }

    .mobile-drawer.open {
        transform: translateY(0);
    }

    .drawer-handle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: var(--drawer-handle);
        cursor: pointer;
        gap: 4px;
    }

    .handle-bar {
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }

    #drawer-title {
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-weight: 500;
    }

    .drawer-content {
        max-height: 50vh;
        overflow-y: auto;
        padding: 0 16px 16px;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px;
    }

    .admin-sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .admin-main {
        padding: 16px;
    }

    .list-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .custom-date-row,
    .advanced-filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        min-height: 0;
    }

    .auth-box {
        padding: 24px;
        margin-top: 32px;
    }

    .membership-header,
    .membership-body,
    .redeem-section {
        padding: 20px;
    }

    .category-strip {
        justify-content: flex-start;
        margin: 0 -22px;
        padding: 0 22px 8px;
    }

    .category-tab {
        min-width: 72px;
        min-height: 36px;
        padding: 7px 14px;
        font-size: 0.86rem;
    }

    /* 移动端书籍卡片横排适配 */
    .book-list {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px 0 60px;
    }

    .book-card {
        flex-direction: row;
        align-items: flex-start;
        padding: 16px;
        gap: 12px;
    }

    .book-cover-link {
        flex: 0 0 112px;
        height: 149px;
        margin-bottom: 0;
    }

    .book-cover {
        height: 149px;
        border-radius: var(--radius-sm);
    }

    .book-info {
        flex: 1;
        gap: 6px;
        min-width: 0;
    }

    .book-headline {
        gap: 6px;
    }

    .book-heat {
        font-size: 0.72rem;
    }

    .book-card h3 {
        font-size: 1rem;
        line-height: 1.3;
    }

    .book-card p {
        font-size: 0.85rem;
        line-height: 1.45;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .book-category {
        font-size: 0.7rem;
        padding: 3px 10px;
        margin-bottom: 0;
    }

    .book-meta {
        margin-top: auto;
        font-size: 0.74rem;
        gap: 6px;
        flex-wrap: wrap;
    }

    .book-card .actions {
        padding-top: 8px;
    }

    .book-card .actions .btn-primary.full {
        padding: 9px 18px;
        font-size: 0.9rem;
    }
}

/* ============== 用户分析 ============== */
.analytics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.analytics-header h1 {
    margin-bottom: 6px;
}

.analytics-header p {
    margin: 0;
    color: var(--text-secondary);
}

.analytics-range-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.analytics-overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.analytics-card {
    margin-top: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    box-shadow: var(--shadow);
}

.analytics-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.analytics-card-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.analytics-controls {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.analytics-control-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 18px;
}

.analytics-control-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.analytics-control-row input[type="checkbox"],
.analytics-control-row input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.analytics-control-label {
    font-weight: 600;
    color: var(--text);
    min-width: 72px;
}

.analytics-custom-range,
.analytics-inline-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.analytics-custom-range input,
.analytics-inline-control select {
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    background: var(--surface);
}

.analytics-inline-control label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.analytics-chart-container {
    box-shadow: none;
    border: 1px solid var(--border);
    box-sizing: border-box;
    height: 360px;
    min-height: 320px;
    padding: 14px 16px 8px;
}

.analytics-chart-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.analytics-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.analytics-chart-legend i {
    display: inline-block;
    width: 14px;
    height: 3px;
    border-radius: 999px;
}

.analytics-line-chart {
    height: 260px;
}

.analytics-line-chart text {
    font-size: 10px;
}

.analytics-section {
    margin-top: 32px;
}

.analytics-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    margin: 0;
}

.analytics-section h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
    color: var(--text);
}

.chart-container {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 20px;
    box-shadow: var(--shadow);
    min-height: 220px;
}

.line-chart-svg {
    width: 100%;
    height: 220px;
    overflow: visible;
}

.line-chart-svg polyline,
.line-chart-svg circle {
    vector-effect: non-scaling-stroke;
}

.line-chart-svg text {
    font-size: 3px;
    fill: var(--text-secondary);
}

.bar-chart {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 20px;
    box-shadow: var(--shadow);
    min-height: 220px;
}

.bars-wrap {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 180px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
}

.bar-fill {
    width: 100%;
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.chart-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.chart-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

.bar-item:hover .bar-fill {
    background: var(--primary-dark);
}

.chart-point:hover circle {
    r: 6;
    cursor: pointer;
}
