/* =====================================================
   app-shell.css — legacy stylesheet (rebadged)
   Phase 1 of design system migration:
   - Old :root token block REMOVED — tokens.css owns colors/type now.
   - .light-mode block REMOVED — app is ink-only per design spec.
   - Bridge :root below maps legacy vars (--bg-*, --text-*, --accent-*, etc.)
     to the new design tokens so legacy markup keeps rendering while we
     migrate per-view in subsequent phases.
   Once a view is migrated to new components.css selectors, the matching
   legacy rules below can be retired.
   ===================================================== */

:root {
  /* surfaces */
  --bg-primary:    var(--ink-800);
  --bg-secondary:  var(--ink-700);
  --bg-dark:       var(--ink-900);
  --bg-card:       rgba(17, 24, 39, 0.7);          /* glassmorphic over starfield */
  --bg-glass:      var(--surface-glass);
  --border-glass:  var(--border-hair);

  /* text */
  --text-primary:   var(--fg-1);
  --text-secondary: var(--fg-2);
  --text-muted:     var(--fg-3);

  /* accents → signal palette */
  --accent-blue:   var(--signal-azure);
  --accent-purple: var(--signal-violet);
  --accent-green:  var(--signal-leaf);
  --accent-red:    var(--signal-rose);
  --accent-amber:  var(--signal-amber);

  /* gradients */
  --gradient-primary: linear-gradient(135deg, var(--signal-azure), var(--signal-violet));
  --gradient-score:   linear-gradient(90deg,  var(--signal-azure), var(--signal-violet), var(--signal-amber));

  /* layout / shape */
  --sidebar-width: 220px;
  --radius:        var(--r-md);
  --radius-sm:     var(--r-sm);
  --shadow-card:   var(--elev-2);
  --shadow-glow:   0 0 30px rgba(111, 168, 255, 0.18);
  --transition:    var(--dur-2) var(--ease-out);

  /* fonts inherit from tokens.css (--font-sans / --font-display / --font-mono) */
}


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

html,
body {
    width: 100%;
    overflow-x: hidden;
    background-color: #000;
    /* Cosmos black base */
    color: var(--text-primary);
    font-family: var(--font-sans);
}

/* Hide scrollbars everywhere — wheel/trackpad still scrolls. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }


/* --- Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font-sans);
    background: transparent;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

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

a:hover {
    text-decoration: underline;
}

button {
    cursor: pointer;
    font-family: inherit;
}

::selection {
    background: rgba(139, 92, 246, 0.3);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

/* --- Sidebar --- */
#sidebar {
    width: var(--sidebar-width);
    background: rgba(17, 24, 39, 0.4);
    /* Glassmorphic sidebar */
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    /* Thinner border over canvas */
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 1.25rem;
    margin-bottom: 2rem;
}

.logo-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none;
}

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

.nav-link.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
    border-left-color: var(--accent-blue);
}

.nav-icon {
    font-size: 1.15rem;
}

.nav-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px solid var(--border-glass);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition);
}

.status-dot.connected {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.error {
    background: var(--accent-red);
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Main Content --- */
/* Old rule removed — see the unified #content below in LAYOUTS section */

/* --- Views --- */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: 2rem;
}

.view-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

/* --- Glass Card --- */
.glass-card {
    background: rgba(17, 24, 39, 0.6);
    /* Darker base for legibility over stars */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    transform: translateY(-2px);
}

/* --- Buttons --- */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-link {
    color: var(--accent-blue);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color var(--transition);
}

.btn-link:hover {
    color: var(--accent-purple);
}

.btn-text {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.btn-text:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ============================================
   FEED VIEW — Card Deck
   ============================================ */
.card-deck {
    position: relative;
    min-height: 480px;
    perspective: 1200px;
    margin-bottom: 1.5rem;
    isolation: isolate;
}

.paper-card {
    position: absolute;
    width: 100%;
    /* Same surface treatment as .card / .history-item / profile cards
       so feed papers visually match the rest of the protected app. */
    background: var(--ink-700);
    border: 1px solid var(--border-hair);
    border-radius: var(--r-md);
    padding: 28px;
    box-shadow: var(--elev-2);
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.4s ease,
        border-color var(--dur-2) var(--ease-out),
        box-shadow var(--dur-2) var(--ease-out);
    transform-origin: center bottom;
}

.paper-card:hover {
    border-color: var(--border-soft);
    box-shadow: var(--elev-2), var(--glow-azure);
}

/* Card stack effect */
.paper-card.stack-0 {
    z-index: 3;
    transform: scale(1) translateY(0);
    opacity: 1;
    overflow: visible;
    max-height: none;
}

.paper-card.stack-1 {
    z-index: 2;
    transform: scale(0.97) translateY(8px);
    opacity: 0.5;
    pointer-events: none;
    overflow: hidden;
    max-height: 10px;
}

.paper-card.stack-1>* {
    visibility: hidden;
}

.paper-card.stack-2 {
    z-index: 1;
    transform: scale(0.94) translateY(12px);
    opacity: 0.25;
    pointer-events: none;
    overflow: hidden;
    max-height: 6px;
}

.paper-card.stack-2>* {
    visibility: hidden;
}

.paper-card.stack-hidden {
    z-index: 0;
    transform: scale(0.88) translateY(36px);
    opacity: 0;
    pointer-events: none;
}

/* Swipe animations */
.paper-card.swipe-left {
    animation: swipeLeft 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.paper-card.swipe-right {
    animation: swipeRight 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes swipeLeft {
    to {
        transform: translateX(-120%) rotate(-15deg);
        opacity: 0;
    }
}

@keyframes swipeRight {
    to {
        transform: translateX(120%) rotate(15deg);
        opacity: 0;
    }
}

.card-source {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-purple);
    margin-bottom: 0.6rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.card-title-link {
    /* Ensure the title can be highlighted and copied even though the element
       is an <a>; combined with draggable="false" on the anchor this defeats
       the browser's default "drag the link" behaviour. */
    -webkit-user-select: text;
    user-select: text;
}

.card-authors {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.card-abstract {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

/* Score bar */
.score-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 80px;
    font-weight: 500;
}

.score-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--gradient-score);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-value {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    min-width: 40px;
    text-align: right;
}

.score-source {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 0.5rem;
    white-space: nowrap;
}

/* Expandables */
.card-expandables {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px solid var(--border-glass);
    padding-top: 1rem;
}

.expand-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}

.expand-btn:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.expand-icon {
    font-size: 1rem;
}

.expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}

.expand-content.expanded {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 0.5rem;
}

/* Figures carousel needs more vertical space than the summary shimmer */
.expand-content.expanded.with-carousel,
.expand-content.expanded:has(.figures-carousel) {
    max-height: 2000px;
}

/* Structured AI summary (headline + bullet sections) needs room too */
.expand-content.expanded.with-summary,
.expand-content.expanded:has(.ai-summary-structured) {
    max-height: 1200px;
}

.ai-summary-structured {
    padding: 0.85rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary-headline {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
    margin: 0;
}

.summary-section { display: flex; flex-direction: column; gap: 0.25rem; }

.summary-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.summary-list {
    list-style: disc;
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-secondary, var(--text-muted));
    font-size: 0.85rem;
    line-height: 1.45;
}

.summary-list li { margin: 0.1rem 0; }

.ai-summary-placeholder {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-glass);
}

.shimmer-line {
    height: 10px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.placeholder-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.75rem;
}

.figures-placeholder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem;
}

.fig-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.fig-box .fig-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}


.card-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    font-weight: 500;
}

/* Deck controls */
.deck-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
}

/* Center group: counter + skip stacked vertically */
.deck-controls-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.ctrl-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-glass);
    background: var(--bg-glass);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
}

.ctrl-btn:hover {
    transform: scale(1.12);
}

.ctrl-btn.like:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.ctrl-btn.dislike:hover {
    border-color: var(--accent-red);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

.ctrl-btn.skip {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.ctrl-btn.skip:hover {
    border-color: var(--accent-amber);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
    opacity: 1;
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.card-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 500;
}

/* Empty state */
.deck-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.deck-empty h2 {
    margin-top: 1rem;
    font-size: 1.3rem;
}

.deck-empty p {
    color: var(--text-secondary);
    margin: 0.5rem 0 1.5rem;
    font-size: 0.9rem;
}

.empty-icon {
    font-size: 3rem;
}

/* Top-candidates fallback banner */
.top-candidates-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
    text-align: center;
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
}

/* ============================================
   FEED THREAD — Active card + Scored list
   ============================================ */

/* Active (current unrated) card: in normal flow, not absolute */
/* Sticky wrapper that keeps the active card + controls pinned at the top while scored list scrolls below */
.feed-sticky-zone {
    /* No sticky pin / opaque band any more — the active card scrolls
       with the rest of the feed.  Removing position:sticky and the
       solid bg eliminates the dark "horizontal bar" that used to show
       at the top of the feed view. */
    position: relative;
    z-index: 1;
}

.paper-card.active-card {
    position: relative;
    width: 100%;
    margin-bottom: 0;
}

/* Active card abstract: show in full (no height cap). */
.paper-card.active-card .card-abstract {
    display: block;
    overflow: visible;
    max-height: none;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* Scored papers container — grows downward, newest at top */
.feed-scored-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1.5rem;
}

/* Individual scored paper row — same surface as .card/.paper-card. */
.scored-card {
    background: var(--ink-700);
    border: 1px solid var(--border-hair);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--elev-2);
    transition: border-color var(--dur-2) var(--ease-out),
                box-shadow var(--dur-2) var(--ease-out);
}

.scored-card:hover {
    border-color: var(--border-soft);
    box-shadow: var(--elev-2), var(--glow-azure);
}

.scored-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    /* right padding clears the absolute-positioned Zotero icon (right: 0.75rem + 2rem width) */
    padding: 0.65rem 3rem 0.65rem 0.9rem;
    cursor: pointer;
    user-select: none;
}

.scored-card-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.scored-badge {
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

.scored-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-width: 0;
}

.scored-score {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.scored-chevron {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform var(--transition);
}

.scored-card-body {
    padding: 0 0.9rem 0.9rem;
    border-top: 1px solid var(--border-glass);
}

/* ============================================
   PAPER DETAIL — Slide-in Panel
   ============================================ */
.paper-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    justify-content: flex-end;
    animation: fadeOverlay 0.25s ease;
}

.paper-detail-overlay.hidden {
    display: none;
}

@keyframes fadeOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.paper-detail-panel {
    width: 600px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.detail-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 10;
}

.detail-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.detail-scroll {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.detail-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.detail-authors {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.detail-scores {
    margin-bottom: 1.5rem;
}

.detail-section {
    margin-bottom: 1.75rem;
}

.detail-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.detail-section p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Placeholders */
.placeholder-box {
    background: var(--bg-glass);
    border: 1px dashed var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
}

.placeholder-box .placeholder-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.placeholder-box p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.figures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.placeholder-figure {
    background: var(--bg-glass);
    border: 1px dashed var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 2rem 1rem;
    text-align: center;
    aspect-ratio: 4/3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.placeholder-figure .placeholder-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.placeholder-figure p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============================================
   LIBRARY VIEW
   ============================================ */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.library-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all var(--transition);
}

.library-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.library-card .card-title {
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

.library-card .card-authors {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.library-card .score-mini {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* ============================================
   ONBOARDING VIEW
   ============================================ */
.onboarding-card {
    max-width: 550px;
}

.onboarding-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.seed-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: vertical;
    transition: border-color var(--transition);
}

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

.seed-input::placeholder {
    color: var(--text-muted);
}

.seed-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.seed-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.init-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.init-status.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.init-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================
   ADMIN VIEW
   ============================================ */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.admin-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.health-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.85rem;
}

.health-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.health-badge.ok {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.health-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.pipeline-log {
    margin-top: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    max-height: 100px;
    overflow-y: auto;
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}





/* ============================================
   AUTH CARD (global — applies at all sizes)
   ============================================ */
.auth-card {
    width: 420px;
    max-width: 90vw;
    padding: 2.5rem;
    text-align: center;
}

.auth-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.auth-msg {
    margin-top: 1rem;
    font-size: 0.85rem;
    min-height: 1.2em;
    color: var(--accent-red);
}

.full-width {
    width: 100%;
    margin-bottom: 0.75rem;
}

/* ============================================
   ONBOARDING FLOW (global)
   ============================================ */
.onboarding-step {
    animation: fadeIn 0.4s ease;
}

.onboarding-step.hidden {
    display: none;
}

.divider {
    margin: 1rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
    text-align: center;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--border-glass);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.onboarding-card.centered {
    text-align: center;
    padding: 3rem 2rem;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-purple);
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Library Review */
.review-header {
    margin-bottom: 1.5rem;
}

/* Seed-curation explainer — why these picks matter before any scoring.
   Theme-neutral: amber accent + faint tint reads on dark and paper. */
.seed-howto {
    margin: 0.85rem 0 0;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border-hair);
    border-left: 3px solid var(--signal-amber);
    background: rgba(229, 178, 93, 0.08);
    border-radius: 6px;
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text-secondary, inherit);
}
.seed-howto strong { color: var(--text-primary, inherit); }

/* Push C non-blocking toast (App._toast). Position/size here so the
   mobile breakpoint can clamp the width and lift it clear of the
   fixed bottom tab bar. Background colour is set inline per kind. */
.inv-toast {
    position: fixed;
    right: 16px;
    bottom: 20px;
    max-width: min(360px, calc(100vw - 32px));
    color: #fff;
    padding: 0.65rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.45;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* ---- Mobile adoption of the recent UI additions (≤768px) ---- */
@media (max-width: 768px) {
    /* Toast: full-width-ish + clear of the 64px bottom tab bar. */
    .inv-toast {
        left: 16px;
        right: 16px;
        bottom: 80px;
        max-width: none;
    }
    /* Bug FAB sits above the bottom tab bar (was overlapping it). */
    #fb-fab {
        bottom: 80px !important;
        left: 12px !important;
        padding: 9px 14px !important;
        font-size: 12.5px !important;
    }
    /* Seed explainer: tighter inside the narrower onboarding card. */
    .seed-howto {
        font-size: 0.82rem;
        padding: 0.6rem 0.75rem;
        margin-top: 0.7rem;
    }
}

.library-review-list {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 2rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.review-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: rgba(17, 24, 39, 0.4);
    border: 1px solid var(--border-glass);
    padding: 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.review-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.review-item.selected {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.review-checkbox {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.review-content {
    flex: 1;
}

.review-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    line-height: 1.35;
}

.review-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
}

.add-manual {
    margin-bottom: 2rem;
    padding: 1.25rem;
}

.add-manual h4 {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.input-row {
    display: flex;
    gap: 0.75rem;
}

.seed-input.small {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.review-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-glass);
    padding-top: 1.5rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

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

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* ============================================
   PUBLIC / PROTECTED LAYOUTS
   ============================================ */
.layout-public {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.layout-protected {
    /* Viewport-locked: sidebar fixed, #content scrolls internally. The
       outer body never scrolls in protected mode, so no "infinite scroll"
       past content. Scrollbar inside #content is hidden globally. */
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Middle column scrolls as much as needed; sidebar stays fixed. */
#content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 1080px;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Navbar */
.public-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.public-nav .logo {
    font-weight: 700;
    font-size: 1.2rem;
}

/* Hero */
.hero-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 600px;
    z-index: 2;
}

/* Removed old .hero-content h1 gradient — .inveni-title is white */

.hero-sub {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary.large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-secondary.large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.badge-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Inveni Landing Page Specifics */
.inveni-landing {
    position: relative;
    width: 100%;
    min-height: 100vh;
    flex-direction: column;
}

.view.inveni-landing.active {
    display: flex;
}

#starsCanvas {
    /* Document-sized canvas — JS sizes width/height to cover full
       scrollHeight so stars are anchored to the page (not the viewport)
       and revolve around the hero logo's *page* position. */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: -1;
    pointer-events: none;
    background-color: #000;
}
/* Black backdrop on the html element so the canvas blends seamlessly
   even when scrollHeight grows mid-frame. Body MUST stay transparent
   so the canvas (z-index:-1) shows through. */
html { background-color: #000; }

/* Base layouts over canvas */
.layout-public,
.layout-protected {
    background: transparent;
    /* Remove solid backgrounds to let cosmos show */
}

.inveni-nav {
    z-index: 10;
    background: transparent;
}

.inveni-nav .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.inveni-logo-icon {
    color: var(--accent-blue);
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.inveni-hero {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.inveni-hero .hero-content {
    text-align: center;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.inveni-title {
    font-family: var(--font-mono);
    font-size: 16rem;
    /* Double the requested size of standard display fonts */
    font-weight: 800;
    line-height: 1;
    margin-bottom: 2rem;
    color: #fff;
    text-shadow: 0 0 50px rgba(255, 255, 255, 0.2);
    letter-spacing: -0.02em;
}

.inveni-hero .hero-sub {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 700px;
    margin-bottom: 3.5rem;
    font-weight: 400;
    line-height: 1.6;
}

.inveni-hero .hero-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

/* Auth Containers */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    min-height: 100vh;
}

.auth-card {
    background: rgba(17, 24, 39, 0.5);
    /* Heavier glassmorphism for cosmos contrast */
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

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

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    margin-left: 0.25rem;
}

/* Visuals */
.hero-visual {
    position: absolute;
    right: -10%;
    top: 50%;
    transform: translateY(-50%);
    width: 600px;
    height: 600px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

.paper-stack-visual {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-visual {
    position: absolute;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.c1 {
    top: 10%;
    right: 20%;
    width: 300px;
    height: 400px;
    transform: rotate(-10deg);
    z-index: 1;
}

.c2 {
    top: 20%;
    right: 10%;
    width: 300px;
    height: 400px;
    transform: rotate(5deg);
    z-index: 2;
    background: rgba(30, 41, 59, 0.5);
}

.c3 {
    top: 15%;
    right: 15%;
    width: 300px;
    height: 400px;
    transform: rotate(-2deg);
    z-index: 3;
    border-color: var(--accent-purple);
    box-shadow: 0 0 50px rgba(139, 92, 246, 0.1);
}

/* Responsive Landing */
@media (max-width: 768px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-visual {
        display: none;
    }

    .public-nav {
        padding: 1rem;
    }

    .comparison-cards {
        flex-direction: column;
    }

    .comp-vs {
        margin: 0.5rem 0;
    }

    .comparison-controls {
        flex-wrap: wrap;
    }
}


/* ============================================
   COMPARISON VIEW — Pairwise Paper Comparison
   ============================================ */

.comparison-progress {
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 100px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comparison-cards {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.comp-card {
    flex: 1;
    padding: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    min-height: 300px;
}

.comp-card:hover {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.comp-card-badge {
    position: absolute;
    top: -10px;
    left: 1rem;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.75rem;
    border-radius: 100px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.comp-card-meta {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
}

.comp-score {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
}

.comp-sim {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
}

.comp-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.comp-abstract {
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-secondary);
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
    padding-right: 0.5rem;
}

.comp-abstract::-webkit-scrollbar {
    width: 3px;
}

.comp-abstract::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 100px;
}

.comp-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-glass);
}

.comp-id,
.comp-year {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.comp-vs {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-muted);
    opacity: 0.4;
    letter-spacing: 0.1em;
    flex-shrink: 0;
}

/* Comparison Controls */
.comparison-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.comp-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    min-width: 80px;
}

.comp-btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent-purple);
}

.comp-btn:active {
    transform: translateY(0);
}

.comp-btn-icon {
    font-size: 1.3rem;
}

.comp-btn-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Choice button variants */
.choose-a:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.choose-b:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.choose-both:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.choose-neither:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-red);
    color: var(--accent-red);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.choose-skip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Loading / Complete states */
.comparison-loading,
.comparison-complete {
    margin-top: 2rem;
}

/* Animation for card swap */
@keyframes compCardIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comp-card.animate-in {
    animation: compCardIn 0.35s ease forwards;
}

/* Updating overlay (during model update) */
.comp-updating-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
}

.comp-updating-overlay.hidden {
    display: none;
}

.comp-updating-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-blue);
    font-size: 0.85rem;
    font-weight: 500;
    animation: fadeIn 0.2s ease;
}

.comp-updating-content .spinner.small {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

/* Dim cards while updating */
.comparison-cards.updating {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Disabled state for comp buttons */
.comp-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Version badge — bottom left of landing page */
.version-badge {
    position: fixed;
    bottom: 16px;
    left: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.3));
    letter-spacing: 0.05em;
    z-index: 10;
    pointer-events: none;
}

/* -----------------------------
 * Attention Pulse Animation (No Model)
 * ----------------------------- */
@keyframes pulse-attention {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); border-color: rgba(167, 139, 250, 0.4); }
    50% { box-shadow: 0 0 16px 6px rgba(167, 139, 250, 0.5); border-color: rgba(74, 222, 128, 0.6); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); border-color: rgba(167, 139, 250, 0.4); }
}

.attention-pulse {
    animation: pulse-attention 2s infinite;
    border: 1px solid rgba(167, 139, 250, 0.5);
    border-radius: 8px; /* Matches standard sidebar nav links */
}

/* -----------------------------
 * Mobile Responsiveness
 * ----------------------------- */
@media (max-width: 768px) {
    .auth-card, .onboarding-card, .glass-card {
        padding: 1.5rem;
    }
    .inveni-title {
        font-size: 3.5rem;
    }
    .hero-sub {
        font-size: 1.05rem;
        max-width: 90%;
    }
    .seed-input {
        font-size: 16px; /* Prevents iOS auto-zoom */
    }
    .view-header h1 {
        font-size: 1.5rem;
    }
}
/* ============================================
   RESPONSIVE OVERRIDES (MUST REMAIN AT BOTTOM)
   ============================================ */

/* Tablet (768px) */
@media (max-width: 768px) {
    #sidebar { width: 60px; }
    .logo-text, .nav-label, .sidebar-footer .status-text { display: none; }
    .main-content { margin-left: 60px; padding: 1.5rem; }
    .nav-link { justify-content: center; padding: 0.7rem; }
    .inveni-title { font-size: 5rem; }
    
    .deck-container { width: 100%; max-width: 600px; margin: 1rem auto; min-height: 480px; height: auto; }
    .paper-card { padding: 1.25rem; width: 100%; }
    .card-title { font-size: 1rem; }
    .card-abstract { font-size: 0.85rem; }
    .auth-card, .onboarding-card, .glass-card { padding: 1.5rem; max-width: 95vw; }
}

/* Phone (600px) */
@media (max-width: 600px) {
    #sidebar {
        position: fixed; bottom: 0; left: 0; right: 0; top: auto;
        width: 100% !important; height: 56px;
        flex-direction: row; padding: 0; z-index: 200;
        border-right: none; border-top: 1px solid var(--border-glass);
    }
    .sidebar-logo { display: none; }
    .sidebar-nav {
        display: flex; flex-direction: row; justify-content: space-around;
        width: 100%; padding: 0; gap: 0;
    }
    .nav-link {
        flex-direction: column; padding: 0.4rem 0; font-size: 0.7rem; gap: 0.15rem;
    }
    .nav-link .nav-icon { font-size: 1.2rem; }
    .logo-text, .nav-label, .sidebar-footer { display: none; }
    
    .main-content {
        margin-left: 0; padding: 1rem 0.75rem; padding-bottom: 72px;
    }
    .inveni-title { font-size: 3.5rem; }
    .hero-section { flex-direction: column; text-align: center; }
    
    .deck-container { width: 100%; height: auto; min-height: 450px; }
    .paper-card { padding: 1rem; }
    .card-title { font-size: 0.95rem; }
    .card-abstract { font-size: 0.82rem; -webkit-line-clamp: 4; line-clamp: 4; }
    
    .deck-controls { flex-wrap: wrap; gap: 0.5rem; }
    .deck-controls .btn { min-width: unset; padding: 0.6rem 1rem; font-size: 0.85rem; }
    
    .auth-card { width: 100%; max-width: 95vw; padding: 1.5rem; }
}

/* ============================================
   HISTORY VIEW
   ============================================ */

/* Week navigation bar */
.history-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.history-week-label {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 180px;
}

.history-nav-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.history-week-picker {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
    transition: border-color var(--transition);
}

.history-week-picker:hover {
    border-color: rgba(255, 255, 255, 0.25);
}

/* Paper thread container — free-flowing, no height cap */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 4px;
}

/* Individual expandable row — matches the new .card / .paper surface so
   history rows visually align with feed papers and profile cards. */
.history-item {
    background: var(--ink-700);
    border: 1px solid var(--border-hair);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--elev-2);
    transition: border-color var(--dur-2) var(--ease-out),
                box-shadow var(--dur-2) var(--ease-out);
}

.history-item:hover {
    border-color: var(--border-soft);
    box-shadow: var(--elev-2), var(--glow-azure);
}

.history-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    gap: 0.75rem;
    user-select: none;
}

.history-item-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.history-item-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.history-item-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.history-item-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.history-item-chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform var(--transition);
    line-height: 1;
}

/* Rating badges */
.history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.85rem;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.history-badge.liked {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
}

.history-badge.disliked {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}

.history-badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Expanded body */
.history-item-body {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    animation: fadeIn 0.2s ease;
}

.history-item-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0.6rem 0 0.5rem;
}

.history-item-abstract {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    max-height: 8rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.history-arxiv-link {
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 500;
    transition: color var(--transition);
}

.history-arxiv-link:hover {
    color: var(--accent-purple);
}

/* Loading + empty states */
.history-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.history-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Day divider — horizontal rule with centred date label */
.history-day-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.1rem 0 0.35rem;
    padding: 0 0.25rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.history-day-divider::before,
.history-day-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}

.history-day-divider span {
    white-space: nowrap;
}

/* Remove the top margin on the very first divider */
.history-day-divider:first-child {
    margin-top: 0;
}

/* Row layout: history list on left, jump buttons pinned on right */
.history-content-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.history-content-row .history-list {
    flex: 1;
    min-width: 0;
}

/* Floating day-jump buttons — sticky column to the right of the thread */
.history-jump-btns {
    position: sticky;
    top: 4rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
    z-index: 10;
}

.history-jump-btn {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(14px);
    color: var(--text-primary);
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.history-jump-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}


/* ---- Paper Search Dropdown ---- */
.paper-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    z-index: 1000;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.paper-search-result {
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: background var(--transition);
}

.paper-search-result:last-child { border-bottom: none; }
.paper-search-result:hover { background: var(--bg-glass); }

.psr-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.psr-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ---- Zotero Save Button ---- */
.zotero-save-btn {
    margin-top: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.65rem;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}

.zotero-save-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.zotero-save-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ---- Zotero Icon Button (top-right corner) ---- */
.zotero-icon-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(204, 41, 54, 0.12);
    border: 1px solid rgba(204, 41, 54, 0.45);
    border-radius: 50%;
    color: #cc2936;
    font-family: var(--font-mono, Georgia, serif);
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition);
    z-index: 4;
    padding: 0;
}

.zotero-icon-btn:hover {
    background: #cc2936;
    color: #fff;
    transform: scale(1.05);
}

.zotero-icon-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.zotero-icon-btn .zotero-z {
    font-size: 0.95rem;
    line-height: 1;
}

/* ---- Share Icon Button (sits to the left of Zotero, top-right) ---- */
.share-icon-btn {
    position: absolute;
    top: 0.75rem;
    right: 3.25rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(70, 90, 120, 0.10);
    border: 1px solid rgba(70, 90, 120, 0.35);
    border-radius: 50%;
    color: #3a4f70;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition);
    z-index: 4;
    padding: 0;
}

.share-icon-btn:hover {
    background: #3a4f70;
    color: #fff;
    transform: scale(1.05);
}

.share-icon-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.share-icon-btn .icon {
    display: block;
}

.scored-card { position: relative; }

/* ---- Figures Carousel ---- */
.figures-carousel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.figures-carousel-stage {
    position: relative;       /* anchor for magnifier lens */
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    overflow: hidden;
    user-select: none;
}

.figures-carousel-stage img {
    cursor: zoom-in;
}

.figure-magnifier-lens {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.45);
    background-repeat: no-repeat;
    background-color: #fff;
    z-index: 5;
}

.figures-carousel-stage img {
    display: block;
    height: auto;          /* preserve native aspect ratio */
    max-width: 100%;       /* widest figure = 100% of card width */
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: #fff;
}

.figures-caption {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary, var(--text-muted));
    margin: 0;
    max-height: 6rem;
    overflow-y: auto;
    padding: 0.25rem 0.1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.figures-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
}

.figures-nav-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: background var(--transition), border-color var(--transition);
}

.figures-nav-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.25);
}

.figures-counter {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 3rem;
    text-align: center;
}

/* --- Category tree (onboarding + profile) --- */
.cat-tree {
    max-height: 26rem;
    overflow-y: auto;
    padding: 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
}
.cat-archive {
    margin-bottom: 0.1rem;
}
.cat-archive-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.35rem;
    min-height: 1.7rem;        /* every archive row identical height */
    box-sizing: border-box;
    border-radius: 6px;
    cursor: pointer;
}
.cat-archive-row:hover {
    background: rgba(255,255,255,0.04);
}
.cat-archive-toggle {
    display: inline-block;
    width: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    user-select: none;
    text-align: center;
}
.cat-archive-toggle.empty {
    visibility: hidden;
}
.cat-archive-label {
    color: var(--text-primary);
    font-weight: 600;
}
.cat-archive-code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}
/* Was a repeat(auto-fill, minmax(18rem,1fr)) grid — on the narrow
   onboarding card that produced uneven tracks / big empty space and
   made rows look different sizes. A flat column keeps every sub-row
   identical, like the (already-correct) mobile rule. */
.cat-subs {
    margin: 0.1rem 0 0.2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}
/* Collapsed sub-list is removed from layout via inline style="display:none"
   set by App.renderCategoryTree / the toggle handler in app.js. The
   display:flex above only applies in the expanded state. */
.cat-subs[style*="display:none"] {
    display: none !important;
}
.cat-sub-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.12rem 0.25rem;
    min-height: 1.5rem;        /* every sub row identical height */
    box-sizing: border-box;
    border-radius: 6px;
    cursor: pointer;
}
.cat-sub-row:hover {
    background: rgba(255,255,255,0.03);
}
.cat-sub-code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.cat-sub-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.cat-tree input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    min-width: 15px;
    flex: 0 0 15px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: 1.5px solid var(--border-soft, rgba(120,120,120,.5));
    border-radius: 4px;
    background: var(--surface-raised, transparent);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    transition: background .12s, border-color .12s;
}
.cat-tree input[type="checkbox"]:checked {
    background: var(--signal-azure, #2F6CDB);
    border-color: var(--signal-azure, #2F6CDB);
}
.cat-tree input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.cat-tree input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--signal-azure, #2F6CDB);
    outline-offset: 1px;
}
.cat-archive.archive-selected > .cat-archive-row {
    background: rgba(59,130,246,0.08);
}
.cat-pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    margin: 0.15rem 0.25rem 0.15rem 0;
    border-radius: 999px;
    background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.3);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* ---- Source badges on review-list candidates ---- */
.source-badge {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    margin-left: 0.4rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}
.source-badge.source-zotero { background: rgba(173, 84, 60, 0.18); border: 1px solid rgba(173, 84, 60, 0.55); color: #e9b3a3; }
.source-badge.source-gs     { background: rgba(66, 133, 244, 0.16); border: 1px solid rgba(66, 133, 244, 0.55); color: #a8c8fa; }
.source-badge.source-manual { background: rgba(120, 120, 130, 0.16); border: 1px solid rgba(160, 160, 170, 0.5); color: #c8c8d2; }
.source-badge.source-library { background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.5); color: #a7e6c0; }

.review-section { margin-bottom: 1rem; }
.review-section > summary {
    cursor: pointer;
    padding: 0.45rem 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    user-select: none;
}
.review-section > summary:hover { background: rgba(255, 255, 255, 0.06); }

/* ---- Zotero picker modal ---- */
.zotero-modal {
    position: fixed; inset: 0;
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
}
.zotero-modal.hidden { display: none; }
.zotero-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
}
.zotero-modal-card {
    position: relative;
    width: min(960px, 100%);
    max-height: 88vh;
    display: flex; flex-direction: column;
    padding: 1.25rem 1.5rem;
}
.zotero-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.zotero-modal-header h3 { margin: 0; }
.zotero-modal-close {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 0.4rem;
}
.zotero-modal-close:hover { color: var(--text-primary); }
.zotero-modal-body {
    flex: 1; overflow: hidden;
    display: grid; grid-template-columns: 1fr 1.4fr; gap: 1rem;
    min-height: 360px;
}
@media (max-width: 720px) { .zotero-modal-body { grid-template-columns: 1fr; } }
.zotero-modal-collections, .zotero-modal-preview {
    overflow-y: auto;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.6rem;
    background: rgba(0,0,0,0.18);
}
.zotero-coll-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.4rem 0.55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 0.15rem;
    font-size: 0.86rem;
}
.zotero-coll-row:hover { background: rgba(255,255,255,0.06); }
.zotero-coll-row.selected { background: rgba(59,130,246,0.18); border: 1px solid rgba(59,130,246,0.5); }
.zotero-coll-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zotero-coll-count { font-size: 0.72rem; color: var(--text-muted); margin-left: 0.5rem; }

.zotero-preview-row {
    display: flex; gap: 0.55rem; align-items: flex-start;
    padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border-glass);
    font-size: 0.83rem;
}
.zotero-preview-row:last-child { border-bottom: none; }
.zotero-preview-row input[type="checkbox"] { margin-top: 0.2rem; flex-shrink: 0; }
.zotero-preview-meta { color: var(--text-muted); font-size: 0.72rem; margin-top: 0.15rem; }
.zotero-modal-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 0.8rem; padding-top: 0.75rem;
    border-top: 1px solid var(--border-glass);
}

/* ---------- Search view (v1.3, desktop-only) ---------- */
#view-search { max-width: 820px; margin: 0 auto; }

.search-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.search-input {
    width: 100%;
    resize: vertical;
    min-height: 3.5rem;
    padding: 0.85rem 1rem;
    font: inherit;
    color: var(--text-primary, #e8e8ec);
    background: var(--surface-glass, rgba(255,255,255,0.04));
    border: 1px solid var(--border-glass, rgba(255,255,255,0.12));
    border-radius: 10px;
    outline: none;
}
.search-input:focus {
    border-color: var(--accent-purple, #8b5cf6);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.search-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.search-status {
    text-align: center;
    margin: 1.5rem 0;
}

.search-debug {
    margin: 0 0 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted, #9aa);
    background: var(--surface-glass, rgba(255,255,255,0.03));
    border: 1px solid var(--border-glass, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
}
.search-debug summary { cursor: pointer; user-select: none; }
.search-debug p { margin: 0.4rem 0; line-height: 1.4; }

.search-results { display: block; }

/* Daily-digest message: desktop/mobile variant spans (toggled in index.html) */
.dd-msg-mobile { display: none; }
@media (max-width: 768px) {
    .dd-msg-desktop { display: none; }
    .dd-msg-mobile { display: inline; }
}

/* A/B intro: desktop/mobile variant divs inside #compIntroOverlay .comp-intro-card */
.ab-intro-mobile { display: none; }
.ab-intro-desktop { display: block; }
@media (max-width: 768px) {
    .ab-intro-desktop { display: none; }
    .ab-intro-mobile { display: block; }
}
