/* ============================================================================
   InkPulse Studio · 墨脉选品台
   Dark Editorial & AI Novel Selection Workbench Design System
   ============================================================================ */

:root {
    --bg: #0b0e14;
    --bg-elevated: #111622;
    --surface: #151b28;
    --surface-hover: #1b2334;
    --surface-soft: rgba(255, 255, 255, 0.035);
    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.28);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* 女频默认：暖琥珀玫瑰金 */
    --accent: #f43f5e;
    --accent-2: #f59e0b;
    --accent-soft: rgba(244, 63, 94, 0.14);
    --accent-border: rgba(244, 63, 94, 0.35);
    --accent-glow: 0 0 28px rgba(244, 63, 94, 0.22);

    --emerald: #10b981;
    --emerald-soft: rgba(16, 185, 129, 0.14);
    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, 0.14);
    --sky: #38bdf8;
    --sky-soft: rgba(56, 189, 248, 0.14);
    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, 0.14);
    --violet: #a78bfa;

    --radius-xl: 18px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 7px;
    --radius-pill: 999px;

    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Inter, system-ui, sans-serif;
    --font-mono: "SFMono-Regular", ui-monospace, Menlo, Monaco, Consolas, monospace;

    --shadow-panel: 0 14px 36px rgba(0, 0, 0, 0.36);
    --shadow-float: 0 22px 54px rgba(0, 0, 0, 0.56);
    --max-w: 1440px;
}

/* 男频主题：极光电光青蓝 */
body.channel-male {
    --accent: #38bdf8;
    --accent-2: #6366f1;
    --accent-soft: rgba(56, 189, 248, 0.14);
    --accent-border: rgba(56, 189, 248, 0.38);
    --accent-glow: 0 0 28px rgba(56, 189, 248, 0.22);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(900px 420px at 12% -10%, var(--accent-soft), transparent 65%),
        radial-gradient(760px 380px at 88% -8%, rgba(99, 102, 241, 0.12), transparent 65%),
        var(--bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

/* ==================== Top Navigation Shell ==================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(11, 14, 20, 0.84);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid;
    place-items: center;
    box-shadow: var(--accent-glow);
    flex-shrink: 0;
}

.brand-mark svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.brand-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-elevated);
    padding: 4px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
}

.nav-tab {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.18s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--surface-hover);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Channel Switcher */
.channel-switcher {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.channel-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    transition: all 0.18s ease;
}

.channel-btn:hover {
    color: var(--text-primary);
}

.channel-btn.active[data-channel="female"] {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.32);
}

.channel-btn.active[data-channel="male"] {
    background: linear-gradient(135deg, #0ea5e9, #4f46e5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.32);
}

/* Date Controls */
.date-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-presets {
    display: inline-flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
}

.preset-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 7px;
    transition: all 0.16s ease;
}

.preset-btn.active {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.date-picker-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
}

.date-nav-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    font-size: 11px;
}

.date-nav-btn:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.date-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.date-picker-btn {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.date-picker-btn.is-historical {
    color: var(--amber);
}

.date-input-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.brand-ext-links {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.brand-ext-link {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    transition: all 0.16s ease;
}

.brand-ext-link:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}

/* ==================== Main Container ==================== */
.workspace-shell {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 20px 24px 110px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ==================== KPI Radar Strip ==================== */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 15px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0.55;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== Category Pill Rail ==================== */
.category-rail-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.rail-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-kicker {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.update-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.category-rail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cat-pill {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 6px 13px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.16s ease;
}

.cat-pill:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--surface-hover);
}

.cat-pill.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--text-primary);
    font-weight: 600;
}

.cat-pill.all-pill.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: #fff;
}

.cat-pill-badge {
    font-size: 10.5px;
    font-family: var(--font-mono);
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: var(--emerald-soft);
    color: var(--emerald);
    font-weight: 700;
}

.cat-pill.all-pill.active .cat-pill-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* ==================== Insight + Hot Keywords Strip ==================== */
.insight-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 14px;
}

.insight-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.insight-title {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-content {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-height: 170px;
    overflow-y: auto;
    padding-right: 4px;
}

.ai-content strong {
    color: var(--text-primary);
}

.ai-content .book-mark {
    color: var(--accent);
    font-weight: 600;
}

.keyword-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-content: flex-start;
}

.kw-chip {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.kw-chip:hover {
    border-color: var(--accent-border);
    color: var(--text-primary);
}

.kw-chip.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
    font-weight: 600;
}

.kw-chip small {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

/* ==================== Filter & View Toolbar ==================== */
.workbench-toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

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

.search-box {
    position: relative;
    min-width: 220px;
    flex: 0 1 260px;
}

.search-box input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 7px 12px 7px 32px;
    font-size: 13px;
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-border);
}

.search-box .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.filter-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-chip {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 6px 11px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.filter-chip:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.filter-chip.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sort-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    font-size: 12.5px;
    color: var(--text-primary);
}

.view-toggle {
    display: inline-flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
}

.view-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 7px;
}

.view-btn.active {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.action-outline-btn {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.action-outline-btn:hover {
    border-color: var(--accent-border);
    color: var(--text-primary);
}

.result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 0 2px;
}

/* ==================== Book Cards Grid ==================== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 14px;
}

.book-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.book-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-panel);
}

.book-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--accent-glow);
}

.book-card-top {
    display: flex;
    gap: 13px;
}

.book-cover-wrap {
    position: relative;
    width: 78px;
    height: 104px;
    border-radius: 9px;
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

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

.no-cover {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.rank-pill {
    position: absolute;
    top: 5px;
    left: 5px;
    min-width: 22px;
    height: 20px;
    padding: 0 5px;
    border-radius: 6px;
    background: rgba(11, 14, 20, 0.86);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.rank-pill.top-1 { background: linear-gradient(135deg, #f59e0b, #d97706); border: none; }
.rank-pill.top-2 { background: linear-gradient(135deg, #94a3b8, #64748b); border: none; }
.rank-pill.top-3 { background: linear-gradient(135deg, #c2410c, #9a3412); border: none; }

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

.book-title-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.book-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.38;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-title:hover {
    color: var(--accent);
}

.ai-score-badge {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid transparent;
}

.ai-score-badge.tier-s {
    background: var(--emerald-soft);
    color: var(--emerald);
    border-color: rgba(16, 185, 129, 0.35);
}

.ai-score-badge.tier-a {
    background: var(--sky-soft);
    color: var(--sky);
    border-color: rgba(56, 189, 248, 0.35);
}

.ai-score-badge.tier-mid {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.3);
}

.ai-score-badge.tier-c {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(251, 113, 133, 0.3);
}

.book-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.reads-chip {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
}

.cat-mini-chip {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 5px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.delta-badge {
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 5px;
}

.delta-badge.new { background: var(--emerald-soft); color: var(--emerald); }
.delta-badge.up { background: var(--sky-soft); color: var(--sky); }
.delta-badge.down { background: var(--danger-soft); color: var(--danger); }

.signal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.sig-tag {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.sig-tag.good {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--text-primary);
}

.sig-tag.warn {
    background: var(--danger-soft);
    border-color: rgba(251, 113, 133, 0.35);
    color: var(--danger);
}

.book-intro {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.book-card-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.card-btn {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.card-btn:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--surface-hover);
}

.card-btn.primary {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
    flex: 1;
}

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

.card-btn.selected {
    background: var(--emerald-soft);
    border-color: rgba(16, 185, 129, 0.45);
    color: var(--emerald);
}

/* ==================== Data Table View ==================== */
.books-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.books-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

.books-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.books-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13px;
}

.books-table tbody tr:hover {
    background: var(--surface-hover);
}

.books-table tbody tr.is-selected {
    background: var(--accent-soft);
}

.table-book-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 310px;
}

.table-book-title {
    font-weight: 700;
    color: var(--text-primary);
}

.table-book-title:hover {
    color: var(--accent);
}

.table-book-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.table-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* ==================== Floating Benchmark Basket ==================== */
.basket-dock {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) translateY(120%);
    z-index: 80;
    width: min(94vw, 860px);
    background: rgba(17, 22, 34, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-xl);
    padding: 12px 16px;
    box-shadow: var(--shadow-float), var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.basket-dock.show {
    transform: translateX(-50%) translateY(0);
}

.basket-items {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.basket-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.basket-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    font-size: 12px;
    max-width: 190px;
}

.basket-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.basket-pill button {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1;
}

.basket-pill button:hover {
    color: var(--danger);
}

.basket-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-primary-glow {
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--accent-glow);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.btn-primary-glow:hover {
    opacity: 0.94;
    transform: translateY(-1px);
}

/* ==================== Prompt Generator Modal ==================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(5, 8, 14, 0.78);
    backdrop-filter: blur(8px);
    display: none;
    place-items: center;
    padding: 20px;
}

.modal-backdrop.open {
    display: grid;
}

.modal-card {
    width: min(96vw, 860px);
    max-height: 88vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-float);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
}

.modal-controls {
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.modal-tab {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
}

.modal-tab.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}

.modal-mode-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.modal-body {
    padding: 16px 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prompt-textarea {
    width: 100%;
    min-height: 340px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.68;
    color: var(--text-primary);
    resize: vertical;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-tip {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== Trend Page Styles ==================== */
.market-board {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    gap: 14px;
}

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-card h2 {
    font-size: 16px;
    font-weight: 700;
}

.market-summary-text {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.75;
}

.market-source {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.hot-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hot-type-row {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 9px 11px;
    display: grid;
    grid-template-columns: 22px 1fr auto;
    grid-template-areas: "idx title val" "idx sub val";
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    transition: border-color 0.16s ease;
}

button.hot-type-row:hover {
    border-color: var(--accent-border);
}

.hot-type-row > span {
    grid-area: idx;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
    font-size: 12px;
}

.hot-type-row > strong {
    grid-area: title;
    font-size: 13.5px;
    color: var(--text-primary);
}

.hot-type-row > small {
    grid-area: sub;
    font-size: 11.5px;
    color: var(--text-muted);
}

.hot-type-row > em {
    grid-area: val;
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--emerald);
}

.theme-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.theme-chip {
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.theme-chip small {
    color: var(--accent);
    font-family: var(--font-mono);
    margin-left: 3px;
}

.trend-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.trend-block-wide {
    grid-column: 1 / -1;
}

.compact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease;
}

.compact-row:hover {
    border-color: var(--accent-border);
}

.compact-row strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
}

.compact-row small {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.compact-row > span {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--emerald);
    white-space: nowrap;
}

.summary-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 12px;
}

.summary-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-item time {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}

.summary-item > div {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.range-group {
    display: inline-flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
}

.range-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 5px 11px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
}

.range-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ==================== Book Detail Page ==================== */
.book-detail-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 24px;
}

.detail-cover {
    width: 160px;
    height: 214px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
}

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

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-main h1 {
    font-size: 24px;
    line-height: 1.3;
}

.detail-author {
    color: var(--text-secondary);
    font-size: 13.5px;
}

.detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.detail-stats > span {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    min-width: 118px;
}

.detail-stats strong {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--text-primary);
}

.detail-stats small {
    font-size: 11.5px;
    color: var(--text-muted);
}

.detail-intro {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.75;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.book-detail-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 16px;
}

.reads-chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.book-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.book-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 12.5px;
}

.book-history-row time {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* ==================== Lab Page (Title & Redline Tool) ==================== */
.lab-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
}

.lab-input-lg {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.lab-input-lg:focus,
.lab-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.lab-textarea {
    width: 100%;
    min-height: 150px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.7;
    resize: vertical;
}

.char-meter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    gap: 10px;
    flex-wrap: wrap;
}

.char-count-num {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 800;
}

.char-count-num.ok { color: var(--emerald); }
.char-count-num.warn { color: var(--amber); }
.char-count-num.bad { color: var(--danger); }

.char-boxes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.char-cell {
    width: 30px;
    height: 34px;
    border-radius: 7px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    position: relative;
}

.char-cell small {
    font-size: 8.5px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    line-height: 1;
}

.char-cell.punct {
    border-color: var(--accent-border);
    color: var(--accent);
}

.char-cell.over {
    border-color: rgba(251, 113, 133, 0.5);
    color: var(--danger);
}

.risk-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-item {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    border: 1px solid rgba(251, 113, 133, 0.35);
    font-size: 12.5px;
}

.risk-item strong {
    color: var(--danger);
    margin-right: 6px;
}

.risk-ok {
    padding: 11px 14px;
    border-radius: var(--radius-md);
    background: var(--emerald-soft);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--emerald);
    font-size: 13px;
    font-weight: 600;
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 560px;
    overflow-y: auto;
    padding-right: 4px;
}

.formula-item {
    width: 100%;
    text-align: left;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s ease;
}

.formula-item:hover {
    border-color: var(--accent-border);
}

.formula-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.formula-item-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13.5px;
}

.formula-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ==================== Misc & Toast ==================== */
.muted-line {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
}

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.site-footer {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 18px 24px 36px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.copy-toast {
    position: fixed;
    top: 76px;
    right: 24px;
    z-index: 200;
    background: var(--bg-elevated);
    border: 1px solid var(--emerald);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-float);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s ease;
}

.copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== Responsive ==================== */
@media (max-width: 1140px) {
    .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .insight-grid { grid-template-columns: 1fr; }
    .market-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .trend-grid { grid-template-columns: 1fr; }
    .lab-grid { grid-template-columns: 1fr; }
    .book-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .topbar-inner { padding: 10px 14px; }
    .workspace-shell { padding: 14px 14px 120px; }
    .kpi-strip { grid-template-columns: 1fr 1fr; }
    .market-board { grid-template-columns: 1fr; }
    .books-grid { grid-template-columns: 1fr; }
    .book-detail-hero { grid-template-columns: 1fr; }
    .detail-cover { width: 130px; height: 174px; }
    .basket-dock { flex-direction: column; align-items: stretch; }
}


/* ==================== Monetization & Pro Gate ==================== */
.pro-nav-btn {
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.pro-nav-btn:hover {
    background: var(--accent);
    color: #fff;
}

.pro-nav-btn.active {
    background: var(--emerald-soft);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--emerald);
}

.brand-ext-link.highlight {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}

.pro-perks-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-primary);
}

.pro-buy-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.pro-lock-banner {
    margin-top: 16px;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--surface), var(--bg-elevated));
    border: 1px dashed var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.pro-lock-banner strong {
    display: block;
    font-size: 14.5px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.pro-lock-banner p {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.affiliate-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-secondary);
}

.affiliate-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}


.brand-mark.brand-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    padding: 0;
    border: 2px solid var(--accent-border);
    background: var(--bg-elevated);
    box-shadow: var(--accent-glow);
}

.brand-mark.brand-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
