/* AI Dictionary — Style Sheet */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,600;0,700;1,400;1,600&family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

@property --race {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@property --wrap-angle {
    syntax: '<angle>';
    initial-value: 360deg;
    inherits: false;
}

:root {
    --primary: #4a6741;
    --primary-dark: #3a5a32;
    --primary-light: #eaf0e8;
    --bg: #f9f6f1;
    --bg-secondary: #f3efe8;
    --bg-tertiary: #ece7df;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --green: #059669;
    --purple: #7c3aed;
    --radius: 8px;
}

html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.5s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease !important;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --primary: #7fa876;
    --primary-dark: #8fb886;
    --primary-light: #1e2a1c;
    --bg: #141413;
    --bg-secondary: #1c1c1a;
    --bg-tertiary: #1e1e1c;
    --text: #d8d5cf;
    --text-secondary: #9a978f;
    --text-muted: #6b6862;
    --border: #2e2e2a;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --green: #34d399;
    --purple: #a78bfa;
}

html[data-theme="dark"] pre {
    background: #0d1117;
    color: #e2e8f0;
}

html[data-theme="dark"] header {
    background: linear-gradient(135deg, #2a3d27 0%, #0d150c 100%);
}

html[data-theme="dark"] header .subtitle {
    color: #94a3b8;
}

html[data-theme="dark"] header .tagline {
    color: #e2e8f0;
}

html[data-theme="dark"] .header-stats {
    color: #94a3b8;
}

html[data-theme="dark"] .consensus-badge {
    background: #422006;
    color: #fbbf24;
}

html[data-theme="dark"] .consensus-high { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .consensus-moderate { background: #422006; color: #fbbf24; }
html[data-theme="dark"] .consensus-low { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .consensus-divergent { background: #2e1065; color: #c4b5fd; }

html[data-theme="dark"] .vitality-bg-active { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .vitality-bg-declining { background: #422006; color: #fbbf24; }
html[data-theme="dark"] .vitality-bg-dormant { background: #431407; color: #fdba74; }
html[data-theme="dark"] .vitality-bg-extinct { background: #450a0a; color: #fca5a5; }

html[data-theme="dark"] .interest-hot { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .interest-warm { background: #422006; color: #fbbf24; }
html[data-theme="dark"] .interest-mild { background: #422006; color: #fde047; }
html[data-theme="dark"] .interest-cool { background: #172554; color: #93c5fd; }
html[data-theme="dark"] .interest-quiet { background: #1e293b; color: #94a3b8; }

html[data-theme="dark"] .interest-bg-hot { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .interest-bg-warm { background: #422006; color: #fbbf24; }
html[data-theme="dark"] .interest-bg-mild { background: #422006; color: #fde047; }
html[data-theme="dark"] .interest-bg-cool { background: #172554; color: #93c5fd; }
html[data-theme="dark"] .interest-bg-quiet { background: #1e293b; color: #94a3b8; }

html[data-theme="dark"] .error { color: #f87171; }

html[data-theme="dark"] .summary-text strong {
    color: #8fb886;
}

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

body {
    font-family: 'Lora', Georgia, serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem 2rem 2.5rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

header .tagline {
    font-size: 1.3rem;
    font-weight: 300;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: #d4e8d0;
    font-style: italic;
}

.header-stats {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #d4e8d0;
    letter-spacing: 0.02em;
}

.header-stats span {
    font-weight: 600;
}

/* Nav (top bar — fades out on desktop once sidebar is visible) */
nav {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: opacity 0.3s ease;
}

nav.nav-hidden {
    opacity: 0;
    pointer-events: none;
}

nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

nav a:hover { color: var(--primary); }

/* Layout wrapper */
.layout {
    min-height: calc(100vh - 180px);
}

/* Sidebar — fixed overlay, hidden until scrolled past header */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar.visible {
    opacity: 0.3;
    pointer-events: auto;
}

.sidebar.visible:hover {
    opacity: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
}

.sidebar-link {
    display: block;
    padding: 0.6rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-link:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
    text-decoration: none;
}

.sidebar-link.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

.sidebar-link-external {
    margin-top: 1rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

/* Sidebar tab — hidden by default, shown on narrow desktops */
.sidebar-tab {
    display: none;
}

/* Hamburger (mobile only) */
.hamburger {
    display: none;
}

/* Sidebar backdrop (mobile only) */
.sidebar-backdrop {
    display: none;
}

/* Main */
main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    min-width: 0;
}

section { margin-bottom: 4rem; scroll-margin-top: 3.5rem; }

/* Collapsible sections */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    gap: 0.75rem;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.4rem;
}

.section-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    flex: 1;
}

/* Move underline from h2 to section-header so it spans full width */
.section-header h2::after {
    display: none;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    transition: background 0.4s ease;
}

.section-header:hover::after {
    background: var(--purple);
}

.section-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: background 0.15s;
    flex-shrink: 0;
    position: relative;
}

/* Border-draw animation wrapping around the toggle arrow */
.section-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--purple);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    -webkit-mask: conic-gradient(from 135deg, transparent var(--wrap-angle), #000 0);
    mask: conic-gradient(from 135deg, transparent var(--wrap-angle), #000 0);
    --wrap-angle: 360deg;
    transition: --wrap-angle 0.3s ease;
    pointer-events: none;
}

.section-header:hover .section-toggle::before {
    --wrap-angle: 0deg;
    transition: --wrap-angle 0.5s ease 0.35s;
}

.section-toggle:hover {
    background: var(--bg-tertiary);
}

.toggle-chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--text-secondary);
    transition: transform 0.2s ease;
}

.section-header[aria-expanded="false"] .toggle-chevron {
    transform: rotate(-90deg);
}

.section-content {
    transition: opacity 0.25s ease;
}

.section-content.fading-out {
    opacity: 0;
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    content-visibility: hidden;
}

h2 {
    font-size: 1.75rem;
    margin-top: -1rem;
    margin-bottom: 1rem;
    color: var(--text);
    border-bottom: none;
    padding-bottom: 0.4rem;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    transition: background 0.4s ease;
}

h2:hover::after {
    background: var(--purple);
}

h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; color: var(--text-secondary); }

blockquote {
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--bg-secondary);
    font-style: italic;
    color: var(--text-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
}

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

/* Controls */
.controls {
    margin-bottom: 1.5rem;
}

#search {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 1rem;
    font-family: inherit;
}

#search:focus {
    border-color: var(--primary);
}

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tag-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tag-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tag-pill .tag-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

.export-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.results-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.export-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Export Modal */
.export-modal {
    max-width: 540px;
    width: 90vw;
}

.export-modal-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.export-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.export-field-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.export-field-toggle {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.export-field-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.export-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1.5rem;
    margin-bottom: 1.5rem;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.export-field-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.15s;
}

.export-field-option:hover {
    background: var(--bg-tertiary, rgba(255,255,255,0.05));
}

.export-field-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.export-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.export-cancel-btn {
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}

.export-confirm-btn {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    font-weight: 600;
}

.export-confirm-btn:hover {
    opacity: 0.9;
}

/* Term Cards */
.term-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.term-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-1px);
}

.term-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.term-header h3 {
    color: var(--primary);
    margin-bottom: 0;
    font-size: 1.15rem;
}

.word-type {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Consensus badge on term cards */
.consensus-badge {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: #d97706;
    background: #fef3c7;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
}

/* When both badges are present, only interest pushes right */
.interest-badge ~ .consensus-badge {
    margin-left: 0;
}

/* Consensus detail in modal */
.consensus-detail {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.consensus-score-large {
    font-size: 2rem;
    font-weight: 700;
    color: #d97706;
    line-height: 1;
}

.consensus-score-large .consensus-max {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.consensus-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.consensus-agreement {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
}

.consensus-high { background: #d1fae5; color: #065f46; }
.consensus-moderate { background: #fef3c7; color: #92400e; }
.consensus-low { background: #fee2e2; color: #991b1b; }
.consensus-divergent { background: #ede9fe; color: #5b21b6; }

.consensus-count {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.consensus-link {
    font-size: 0.82rem;
    margin-left: auto;
}

/* Model Opinions section */
.model-opinions {
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.model-opinion {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.model-opinion:last-child {
    border-bottom: none;
}

.model-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    min-width: 120px;
}

.model-score-badge {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-left: auto;
}

.model-score-badge.score-high { background: #d1fae5; color: #065f46; }
.model-score-badge.score-mid { background: #fef3c7; color: #92400e; }
.model-score-badge.score-low { background: #f3f4f6; color: #374151; }

html[data-theme="dark"] .model-score-badge.score-high { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .model-score-badge.score-mid { background: #422006; color: #fbbf24; }
html[data-theme="dark"] .model-score-badge.score-low { background: #1f2937; color: #9ca3af; }

.model-justification {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    padding-left: 0.25rem;
    font-style: italic;
}

.community-votes {
    margin-top: 0.5rem;
}

.community-votes .model-opinion {
    background: var(--bg-secondary);
}

.opinions-loading {
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.opinions-error {
    padding: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
}

.opinions-subheading {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem 0.25rem;
    margin: 0;
}

.term-def {
    color: var(--text) !important;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.term-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
}

/* API Section */
.api-endpoints {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.endpoint {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.endpoint .method {
    background: var(--green);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.endpoint .path {
    font-size: 0.9rem;
    color: var(--text);
    margin-left: 0.5rem;
    background: none;
    padding: 0;
}

.endpoint p {
    margin: 0.5rem 0 0.75rem;
    font-size: 0.88rem;
}

.endpoint a {
    font-size: 0.85rem;
    font-weight: 500;
}

.api-example {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.api-example h3 { margin-bottom: 1rem; }

pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.7;
}

code {
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

.api-note {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.api-note code {
    background: var(--bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* Frontiers */
.frontier-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--purple);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.frontier-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-1px);
}

.frontier-card h3 {
    color: var(--purple);
    margin-bottom: 0.4rem;
}

.frontier-card p {
    font-size: 0.93rem;
    margin-bottom: 0;
}

.frontier-card.frontier-completed {
    opacity: 0.5;
    border-left-color: var(--text-muted);
    filter: grayscale(100%);
}

.frontier-card.frontier-completed h3 {
    color: var(--text-muted);
}

.frontier-card.frontier-completed p {
    color: var(--text-muted);
}

.frontier-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--text-muted);
    color: var(--bg);
    padding: 0.1em 0.5em;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 0.5em;
}

.frontier-checkins {
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    font-size: 0.82rem;
}

.frontier-checkin {
    margin-bottom: 0.35rem;
}

.frontier-checkin .checkin-meta {
    font-weight: 600;
}

.frontier-checkin-preview {
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.frontier-checkin-preview .checkin-meta {
    font-weight: 600;
}

.frontier-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15em 0.6em;
    border-radius: 999px;
}

.frontier-status-active {
    background: var(--purple);
    color: var(--bg);
}

.frontier-status-completed {
    background: var(--text-muted);
    color: var(--bg);
}

.frontier-meta-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.frontier-related-missing {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
}

.frontier-checkins-modal {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.frontier-checkin-modal {
    background: var(--bg-secondary);
    border-left: 3px solid var(--purple);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.frontier-checkin-modal .checkin-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.frontier-checkin-modal .checkin-date {
    font-weight: 600;
    font-size: 0.85rem;
}

.frontier-checkin-modal .checkin-model {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.frontier-checkin-modal .checkin-comment {
    font-size: 0.9rem;
    margin: 0;
}

.frontier-no-checkins {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

.frontier-source-link {
    font-size: 0.85rem;
    color: var(--purple);
    text-decoration: none;
}

.frontier-source-link:hover {
    text-decoration: underline;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg);
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    padding: 2rem;
    position: relative;
    margin-top: 2rem;
    box-shadow: 0 20px 60px var(--shadow-lg);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal h2 {
    border-bottom: none;
    padding-bottom: 0;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.modal-links a {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.modal-links a:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

.attribution {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 1.5rem;
}

/* Modal actions bar */
.modal-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cite-btn {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

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

.context-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.context-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.context-btn--flagged {
    opacity: 0.7;
    border-color: var(--yellow, #d4a017);
    color: var(--yellow, #d4a017);
}

.context-btn--flagged:hover {
    opacity: 0.9;
    background: var(--bg-secondary);
}

.modal-api-code {
    background: var(--bg-tertiary);
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--green);
}

/* Citation panel */
.cite-panel {
    margin-top: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.cite-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.cite-tab {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    border-radius: 4px 4px 0 0;
}

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

.cite-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.cite-format {
    margin-bottom: 1rem;
}

.cite-format:last-of-type { margin-bottom: 0.5rem; }

.cite-format label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.cite-value {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.6rem 2.5rem 0.6rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text);
    word-break: break-all;
    line-height: 1.5;
}

.cite-value.cite-pre {
    word-break: normal;
}

.cite-value pre {
    background: none;
    color: var(--text);
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
}

.copy-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.copy-btn:hover { background: var(--bg-tertiary); }

.cite-api {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.cite-api code {
    font-size: 0.82rem;
    color: var(--green);
}

.cite-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Loading & Error States */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.error { color: #dc2626; }
.no-results { color: var(--text-muted); text-align: center; padding: 2rem; }
.terms-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
.show-less-btn {
    padding: 0.6rem 1.75rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.show-less-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text);
    transform: translateY(-1px);
}
.show-less-btn:active {
    transform: translateY(0);
}
.show-more-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.75rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px var(--shadow);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.show-more-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--shadow-lg);
}
.show-more-btn:active {
    transform: translateY(0);
}
.show-more-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0.1rem 0.45rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}
@keyframes termFoldIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.term-card.fold-in {
    animation: termFoldIn 0.3s ease-out both;
}
@keyframes termFoldOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-10px); }
}
.term-card.fold-out {
    animation: termFoldOut 0.3s ease-in both;
    pointer-events: none;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
}

footer p { margin: 0.25rem 0; font-size: 0.9rem; }

/* Bot Census */
.census-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.census-empty code {
    background: var(--bg-tertiary);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.census-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.census-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.census-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple);
}

.census-stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.census-section {
    margin-bottom: 1.5rem;
}

.census-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.census-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.census-bar-row {
    display: grid;
    grid-template-columns: 160px 1fr 40px;
    align-items: center;
    gap: 0.75rem;
}

.census-bar-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.census-bar-track {
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.census-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--purple), var(--primary));
    border-radius: 10px;
    min-width: 8px;
    transition: width 0.4s ease;
}

.census-bar-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
}

.census-platform-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.census-platform-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.census-platform-chip strong {
    color: var(--purple);
    margin-left: 0.25rem;
}

.census-recent {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.census-bot-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.census-bot-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}

.census-bot-model {
    font-size: 0.8rem;
    color: var(--purple);
}

.census-bot-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Leaderboard */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.leaderboard-table tr:hover td {
    background: var(--bg-secondary);
}

.leaderboard-rank {
    font-weight: 700;
    color: var(--text-muted);
    width: 40px;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--purple);
}

.leaderboard-badges {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.leaderboard-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-first-contribution { background: #eaf0e8; color: #3a5a32; }
.badge-lexicographer { background: #fef3c7; color: #92400e; }
.badge-regular { background: #d1fae5; color: #065f46; }
.badge-trusted { background: #ede9fe; color: #5b21b6; }

html[data-theme="dark"] .badge-first-contribution { background: #1e2a1c; color: #8fb886; }
html[data-theme="dark"] .badge-lexicographer { background: #451a03; color: #fcd34d; }
html[data-theme="dark"] .badge-regular { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .badge-trusted { background: #3b0764; color: #c4b5fd; }

.leaderboard-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Vitality */
.vitality-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vitality-active { background: #059669; }
.vitality-declining { background: #d97706; }
.vitality-dormant { background: #ea580c; }
.vitality-extinct { background: #dc2626; }
.vitality-unvalidated { background: var(--text-muted); }

.vitality-color-active { color: #059669; }
.vitality-color-declining { color: #d97706; }
.vitality-color-dormant { color: #ea580c; }
.vitality-color-extinct { color: #dc2626; }

.vitality-detail {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.vitality-status {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    text-transform: capitalize;
}

.vitality-bg-active { background: #d1fae5; color: #065f46; }
.vitality-bg-declining { background: #fef3c7; color: #92400e; }
.vitality-bg-dormant { background: #fed7aa; color: #9a3412; }
.vitality-bg-extinct { background: #fee2e2; color: #991b1b; }

.vitality-ratio {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.vitality-trend {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.vitality-votes {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.vitality-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.vitality-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.vitality-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    text-transform: capitalize;
    flex: 1;
}

.vitality-item-pct {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Discussion detail in modal */
.discussion-detail {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.discussion-count {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.discussion-link {
    font-size: 0.85rem;
    color: var(--link);
    text-decoration: none;
}

.discussion-link:hover {
    text-decoration: underline;
}

/* Interest Heatmap */
.interest-badge {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
}

.interest-hot { color: #991b1b; background: #fee2e2; }
.interest-warm { color: #92400e; background: #fef3c7; }
.interest-mild { color: #854d0e; background: #fef9c3; }
.interest-cool { color: #1e40af; background: #dbeafe; }
.interest-quiet { color: #64748b; background: #f1f5f9; }

.interest-bg-hot { background: #fee2e2; color: #991b1b; }
.interest-bg-warm { background: #fef3c7; color: #92400e; }
.interest-bg-mild { background: #fef9c3; color: #854d0e; }
.interest-bg-cool { background: #dbeafe; color: #1e40af; }
.interest-bg-quiet { background: #f1f5f9; color: #64748b; }

.interest-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.heatmap-legend-pill {
    font-size: 0.82rem;
    padding: 0.25rem 0.7rem;
    border-radius: 14px;
    font-weight: 500;
}

.heatmap-legend-pill strong {
    margin-left: 0.25rem;
}

.heatmap-signals {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-style: italic;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
    margin-bottom: 2rem;
}

.heatmap-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.4rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center;
    min-height: 70px;
}

.heatmap-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.heatmap-tile-name {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.heatmap-tile-score {
    font-size: 1.1rem;
    font-weight: 800;
    margin-top: 0.15rem;
    opacity: 0.85;
}

/* Interest detail in modal */
.interest-detail {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.interest-score-large {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.interest-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.interest-tier-label {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
    text-transform: capitalize;
}

.interest-signals {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* New Word Badge */
.new-badge {
    display: inline-block;
    background: var(--green);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-left: 0.3rem;
    vertical-align: middle;
}

/* Word of the Day Hero */
.wotd-hero {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--purple);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.wotd-hero:hover {
    box-shadow: 0 4px 16px var(--shadow);
    transform: translateY(-1px);
}

.wotd-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--purple);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.wotd-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.wotd-header h3 {
    font-size: 1.4rem;
    color: var(--primary);
}

.wotd-definition {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wotd-read-more {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}

/* New Words Section */
.new-words-heading {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.new-words-period {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.new-words-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.new-word-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.new-word-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-1px);
}

.new-word-card h4 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.new-word-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.new-word-summary {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.new-words-empty {
    color: var(--text-muted);
    font-style: italic;
}

.rss-link {
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

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

.rss-link a:hover {
    text-decoration: underline;
}

.see-all-link {
    margin-top: 1rem;
    text-align: center;
}

.see-all-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.see-all-link a:hover {
    text-decoration: underline;
}

/* Executive Summaries */
.summary-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.summary-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-1px);
}

.summary-card-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.summary-card-header h3 {
    color: var(--primary);
    margin-bottom: 0;
    font-size: 1.15rem;
    flex: 1;
}

.summary-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.summary-excerpt {
    font-size: 0.93rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.summary-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-terms {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.summary-expand {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
    margin-left: auto;
}

.summary-full {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.summary-full h4 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.summary-full h4:first-child {
    margin-top: 0;
}

.summary-text p {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.summary-text strong {
    color: var(--primary-dark);
    font-weight: 600;
}

/* Community */
.community-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.community-card {
    display: block;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}

.community-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.community-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.community-card h3 {
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.community-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.community-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.community-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.community-links a:hover {
    text-decoration: underline;
}

/* Theme Toggle Switch */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    position: relative;
}

.theme-switch {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: #eaf0e8;
    border: 2px solid #c8dfc4;
    position: relative;
    transition: background 0.4s ease, border-color 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

html[data-theme="dark"] .theme-switch {
    background: #1e2a1c;
    border-color: #2e2e2a;
}

.theme-switch-icon {
    font-size: 0.8rem;
    line-height: 1;
    z-index: 1;
    transition: opacity 0.3s ease;
    user-select: none;
}

.theme-switch-icon-sun {
    color: #f59e0b;
    opacity: 1;
}

.theme-switch-icon-moon {
    color: #94a3b8;
    opacity: 0.5;
    margin-right: 3px;
}

html[data-theme="dark"] .theme-switch-icon-sun {
    opacity: 0.5;
}

html[data-theme="dark"] .theme-switch-icon-moon {
    color: #e2e8f0;
    opacity: 1;
}

.theme-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), background 0.7s ease;
}

html[data-theme="dark"] .theme-switch-knob {
    transform: translateX(24px);
    background: #475569;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.theme-toggle:hover .theme-switch {
    border-color: var(--primary);
}

.theme-toggle:active .theme-switch-knob {
    width: 24px;
}

html[data-theme="dark"] .theme-toggle:active .theme-switch-knob {
    transform: translateX(20px);
}

/* Racecar border hover — colored side races around the full border */
.frontier-card:not(.frontier-completed),
.wotd-hero,
.new-word-card,
.summary-card {
    --card-accent: var(--purple);
    position: relative;
    z-index: 0;
}
.new-word-card  { --card-accent: var(--green); }
.summary-card   { --card-accent: var(--primary); }

.frontier-card:not(.frontier-completed)::after,
.wotd-hero::after,
.new-word-card::after,
.summary-card::after {
    content: '';
    position: absolute;
    inset: -2px 0px -2px -2px;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(
        from 270deg,
        var(--card-accent) var(--race),
        transparent var(--race)
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    --race: 0deg;
    transition: --race 0.45s ease-in;
}

.frontier-card:not(.frontier-completed):hover::after,
.wotd-hero:hover::after,
.new-word-card:hover::after,
.summary-card:hover::after {
    --race: 360deg;
    transition: --race 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Responsive */
/* Narrow desktop / tablet — hamburger menu for sidebar */
@media (max-width: 1280px) and (min-width: 769px) {
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s ease, opacity 0.3s ease;
        z-index: 200;
        box-shadow: none;
        opacity: 0;
    }

    .sidebar.visible {
        opacity: 0;
        pointer-events: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-tab { display: none; }

    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 201;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 8px;
        cursor: pointer;
        box-shadow: 0 2px 8px var(--shadow);
        opacity: 0.08;
        transition: opacity 0.25s ease;
    }

    .hamburger.at-top {
        opacity: 1;
    }

    .hamburger:hover,
    .hamburger:focus-visible {
        opacity: 1;
    }

    .hamburger span {
        width: 20px;
        height: 2px;
        background: var(--text);
        transition: all 0.2s;
        display: block;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 199;
    }

    .sidebar-backdrop.visible {
        display: block;
    }
}

@media (max-width: 768px) {
    header h1 { font-size: 2rem; }
    header .tagline { font-size: 1.1rem; }
    nav#top-nav { display: none; }
    main { padding: 1.5rem 1rem; }

    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s ease, opacity 0.3s ease;
        z-index: 200;
        box-shadow: none;
        opacity: 0;
    }

    .sidebar.visible {
        /* On mobile, don't show the faded sidebar — only via hamburger */
        opacity: 0;
        pointer-events: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 199;
    }

    .sidebar-backdrop.visible {
        display: block;
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 201;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 8px;
        cursor: pointer;
        box-shadow: 0 2px 8px var(--shadow);
        opacity: 0.08;
        transition: opacity 0.25s ease;
    }

    .hamburger.at-top {
        opacity: 1;
    }

    .hamburger:hover,
    .hamburger:focus-visible {
        opacity: 1;
    }

    .hamburger span {
        width: 20px;
        height: 2px;
        background: var(--text);
        transition: all 0.2s;
        display: block;
    }

    .section-toggle { min-width: 44px; min-height: 44px; }
    .api-endpoints { grid-template-columns: 1fr; }
    .modal { padding: 1.5rem; margin-top: 1rem; }
    .term-header { flex-direction: column; gap: 0.25rem; }
    .census-bar-row { grid-template-columns: 120px 1fr 30px; }
    .census-stats { grid-template-columns: repeat(3, 1fr); }
    .heatmap-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .heatmap-tile { min-height: 60px; padding: 0.4rem 0.3rem; }
    .heatmap-tile-name { font-size: 0.65rem; }
    .heatmap-tile-score { font-size: 0.9rem; }
    .wotd-hero { padding: 1rem 1.25rem; }
    .wotd-header h3 { font-size: 1.15rem; }
    .new-words-strip { grid-template-columns: 1fr; }
    .community-grid { grid-template-columns: 1fr 1fr; }
    .community-links { flex-direction: column; gap: 0.75rem; }
    .bayes-metrics { grid-template-columns: 1fr; }
    .export-fields { grid-template-columns: 1fr; }
}

/* Empirical Bayes section in term modals */
.bayes-section {
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}
.bayes-section summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    list-style: none;
}
.bayes-section summary::-webkit-details-marker { display: none; }
.bayes-section summary::before {
    content: '▸ ';
    color: var(--text-secondary);
}
.bayes-section[open] summary::before { content: '▾ '; }
.bayes-detail {
    padding: 0 1rem 1rem;
}
.bayes-detail p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
    line-height: 1.5;
}
.bayes-score-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
}
.bayes-score-large .bayes-max {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}
.bayes-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.bayes-metric {
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.bayes-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.15rem;
}
.bayes-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.bayes-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
}
.bayes-link:hover { text-decoration: underline; }
