
        :root {
            --accent: #4facfe;
            --accent-2: #9479ff;
            --accent-warm: #f97316;
            --success: #34d399;
            --danger: #ef4444;
            --glass-bg: rgba(6, 12, 24, 0.75);
            --glass-border: rgba(79, 172, 254, 0.22);
            --shadow-lg: 0 45px 120px rgba(15, 23, 42, 0.45);
            --text-primary: #f8fafc;
            --text-muted: rgba(248, 250, 252, 0.7);
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
            background: radial-gradient(circle at top left, rgba(79, 172, 254, 0.18), transparent 45%),
                radial-gradient(circle at top right, rgba(148, 121, 255, 0.22), transparent 52%),
                linear-gradient(165deg, #050811 0%, #01030a 100%);
            color: var(--text-primary);
            min-height: 100dvh;
        }

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

        .wisdom-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: clamp(2rem, 4vw, 3.5rem) 1.6rem 4rem;
            display: flex;
            flex-direction: column;
            gap: 2rem;
        }

        .wisdom-header {
            /* No box — plain header per mockup; layout handled by .page-head */
            background: none;
            border: none;
            border-radius: 0;
            box-shadow: none;
            padding: 0;
        }

        .wisdom-hero-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            flex-wrap: wrap;
        }

        .brand-chip {
            display: inline-flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.6rem 1.35rem;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.78);
            border: 1px solid rgba(79, 172, 254, 0.4);
            box-shadow: 0 18px 44px rgba(79, 172, 254, 0.28);
            color: var(--text-primary);
            font-weight: 600;
            letter-spacing: 0.04em;
        }

        .brand-chip img {
            width: 42px;
            height: 42px;
            border-radius: 14px;
            object-fit: cover;
            border: 1px solid rgba(79, 172, 254, 0.35);
            box-shadow: 0 12px 28px rgba(79, 172, 254, 0.3);
        }

        .brand-chip-text {
            font-size: 1.2rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--accent), var(--accent-2));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .wisdom-hero-actions {
            display: flex;
            gap: 0.75rem;
            flex-wrap: wrap;
        }

        .btn,
        .btn-primary,
        .btn-secondary,
        .btn-outline {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0.65rem 1.6rem;
            border-radius: 999px;
            border: none;
            font-weight: 600;
            letter-spacing: 0.01em;
            cursor: pointer;
            transition: all 0.25s ease;
            background: rgba(5, 10, 20, 0.65);
            color: var(--text-primary);
            box-shadow: 0 18px 42px rgba(15, 23, 42, 0.35);
        }

        .btn:hover,
        .btn-primary:hover,
        .btn-secondary:hover,
        .btn-outline:hover {
            transform: translateY(-2px);
            box-shadow: 0 26px 58px rgba(79, 172, 254, 0.28);
        }

        .btn-primary {
            background: var(--gradient-brand, linear-gradient(135deg, #2563EB 0%, #7C3AED 100%)) !important;
            color: #fff !important;
            box-shadow: 0 24px 60px rgba(148, 121, 255, 0.35);
        }

        .btn-primary:hover {
            box-shadow: 0 32px 70px rgba(148, 121, 255, 0.45);
        }

        .btn-secondary {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: #05070f;
            box-shadow: 0 22px 52px rgba(102, 126, 234, 0.28);
        }

        .btn-outline {
            background: rgba(5, 10, 20, 0.65);
            border: 1px solid rgba(79, 172, 254, 0.35);
        }

        .btn-outline:hover {
            border-color: rgba(148, 121, 255, 0.5);
            box-shadow: 0 22px 52px rgba(79, 172, 254, 0.28);
        }

        .wisdom-header h1 {
            margin: 0;
            font-size: clamp(2.2rem, 4.5vw, 3.2rem);
            letter-spacing: -0.02em;
        }

        .wisdom-header p {
            margin: 0;
            color: var(--text-muted);
            font-size: 1.05rem;
            max-width: 640px;
            line-height: 1.7;
        }

        /* Tab row sits directly under the header — no box wrapper */
        .wisdom-tabs-panel {
            padding: 0;
        }

        /* Pill tabs matching mockup */
        .wisdom-tabs {
            display: flex;
            gap: 6px;
            padding: 0;
            background: transparent;
            border: none;
            border-radius: 0;
            margin: 0 0 28px;
            width: fit-content;
            max-width: 100%;
            overflow-x: auto;
        }

        /* Flat tab strip: inactive = ghost text, active = single subtle pill.
           styles.css `button:not(.btn)` paints a gradient — beat it with !important. */
        .wisdom-tab {
            padding: 9px 18px !important;
            border-radius: 999px !important;
            border: 1px solid transparent !important;
            background: transparent !important;
            color: rgba(248, 250, 252, 0.55) !important;
            font-weight: 600 !important;
            font-size: 13.5px !important;
            cursor: pointer;
            white-space: nowrap;
            min-height: 0 !important;
            box-shadow: none !important;
            transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
            /* `.wisdom-tabs` is a flex row with `overflow-x: auto`, so the strip
               is MEANT to scroll once the four tabs stop fitting. But flex items
               default to `flex-shrink: 1`, so instead they squeezed below their
               content width and — with `overflow: hidden` inherited from the
               button reset — silently cut their own labels: at 390px every tab
               lost 6-11px ("Community" and "Reflections" worst) and the strip
               reported scrollWidth <= clientWidth, i.e. no scrollbar to reach
               them. Measured identical in BOTH themes, so this is not a cozy
               regression; found during the cozy 390px pass 2026-07-30.
               Refusing to shrink is what lets `overflow-x: auto` do its job. */
            flex: 0 0 auto !important;
        }

        .wisdom-tab:hover {
            color: rgba(248, 250, 252, 0.92) !important;
            background: rgba(255, 255, 255, 0.04) !important;
        }

        .wisdom-tab.active {
            background: rgba(79, 172, 254, 0.16) !important;
            color: #c5dafe !important;
            border-color: rgba(79, 172, 254, 0.35) !important;
            box-shadow: none !important;
        }

        .search-bar {
            margin-bottom: 1.5rem;
        }

        .search-bar input {
            width: 100%;
            padding: 0.85rem 1rem;
            border-radius: 16px;
            border: 1px solid rgba(79, 172, 254, 0.28);
            background: rgba(5, 10, 20, 0.75);
            color: var(--text-primary);
            /* 16px floor: prevent iOS Safari from auto-zooming on focus. */
            font-size: 16px;
        }

        .search-bar input:focus {
            outline: none;
            border-color: rgba(148, 121, 255, 0.55);
            box-shadow: 0 16px 38px rgba(79, 172, 254, 0.25);
        }

        .wisdom-content {
            display: none;
            background: transparent;
            border: none;
            border-radius: 0;
            box-shadow: none;
            padding: 0;
        }

        .wisdom-content.active {
            display: block;
        }

        /* Grid layout for dynamically loaded wisdom cards - 2 per row */
        #myWisdomContent {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1.25rem;
        }

        .wisdom-categories {
            display: flex;
            flex-direction: column;
            gap: 2rem;
        }

        @media (max-width: 900px) {
            #myWisdomContent {
                grid-template-columns: 1fr;
            }
        }

        /* Community section: no big box — just a heading row + card row */
        .wisdom-category-section {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        /* Section header: label left, note count right */
        .wisdom-category-section .category-header {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            margin: 0;
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-primary);
        }

        .category-note-count {
            font-size: 0.78rem;
            color: var(--fg-muted, rgba(248,250,252,0.55));
            text-transform: uppercase;
            letter-spacing: 0.08em;
            font-weight: 500;
        }

        /* Card row: horizontal scroll on mobile, auto-fill on desktop */
        .wisdom-section-cards {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 0.9rem;
        }

        @media (max-width: 900px) {
            .wisdom-section-cards {
                grid-template-columns: 1fr;
            }
        }

        .category-header {
            margin: 0;
            font-size: 1.2rem;
            font-weight: 600;
            color: var(--text-primary);
        }


        .wisdom-tools-section {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            margin-bottom: 1.5rem;
        }

        .section-header {
            margin: 0;
            font-size: 1.3rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .stats-grid .stat-card strong {
            font-size: 1.6rem;
            display: block;
            margin-bottom: 0.4rem;
        }

        .stats-grid .stat-card span {
            color: var(--text-muted);
            font-size: 0.85rem;
        }

        .stat-number {
            font-size: 2rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--accent), var(--accent-2));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            display: block;
            margin-bottom: 0.35rem;
            line-height: 1;
        }

        .stat-label {
            color: var(--text-muted);
            font-size: 0.85rem;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }

        /* ── Toast notifications ── */
        #wisdomToast {
            position: fixed;
            bottom: 2rem;
            left: 50%;
            transform: translateX(-50%) translateY(120%);
            z-index: 99999;
            min-width: 280px;
            max-width: 90vw;
            padding: 0.9rem 1.5rem;
            border-radius: 16px;
            font-weight: 600;
            font-size: 0.95rem;
            text-align: center;
            transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
            pointer-events: none;
            backdrop-filter: blur(12px);
        }

        #wisdomToast.show {
            transform: translateX(-50%) translateY(0);
        }

        #wisdomToast.toast-success {
            background: rgba(22, 163, 74, 0.88);
            border: 1px solid rgba(74, 222, 128, 0.45);
            color: #f0fdf4;
            box-shadow: 0 20px 48px rgba(22, 163, 74, 0.35);
        }

        #wisdomToast.toast-error {
            background: rgba(185, 28, 28, 0.88);
            border: 1px solid rgba(239, 68, 68, 0.45);
            color: #fff1f2;
            box-shadow: 0 20px 48px rgba(239, 68, 68, 0.35);
        }

        /* ── Spirit Baby quick-status banner (calm dark card) ── */
        .sb-banner {
            background: rgba(8, 13, 26, 0.65);
            border: 1px solid rgba(79, 172, 254, 0.18);
            border-radius: 16px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
            padding: 1.1rem 1.5rem;
            display: flex;
            align-items: center;
            gap: 1.25rem;
            flex-wrap: wrap;
        }

        .sb-banner-avatar {
            width: 56px;
            height: 56px;
            border-radius: 14px;
            border: 1px solid rgba(79, 172, 254, 0.2);
            overflow: hidden;
            flex-shrink: 0;
            background: rgba(8, 13, 26, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.75rem;
        }

        .sb-banner-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .sb-banner-info {
            flex: 1;
            min-width: 200px;
        }

        .sb-banner-name {
            font-size: 1rem;
            font-weight: 600;
            margin: 0 0 0.25rem;
            color: var(--text-primary);
        }

        .sb-banner-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            align-items: center;
            margin-top: 0.4rem;
        }

        /* Muted pills for Seedling / streak / XP inside the calm banner */
        .sb-banner .spirit-chip {
            font-size: 0.78rem;
            padding: 0.25rem 0.6rem;
            border-color: rgba(79, 172, 254, 0.14);
            background: rgba(8, 13, 26, 0.55);
            color: rgba(248, 250, 252, 0.55);
        }

        .sb-banner-progress {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            flex: 1;
            min-width: 140px;
        }

        /* Subtle 2px track — fill only visible when there's real progress */
        .sb-progress-track {
            flex: 1;
            height: 2px;
            border-radius: 999px;
            background: rgba(79, 172, 254, 0.12);
            overflow: hidden;
        }

        .sb-progress-fill {
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(90deg, var(--accent), var(--accent-2));
            transition: width 0.4s ease;
        }

        .sb-banner-actions {
            display: flex;
            gap: 0.65rem;
            align-items: center;
            flex-shrink: 0;
        }

        /* ── Category filter pills ── */
        .category-filter-bar {
            display: none;
            flex-wrap: wrap;
            gap: 0.55rem;
            margin-bottom: 1.5rem;
        }

        .cat-filter-pill {
            padding: 0.45rem 1.1rem;
            border-radius: 999px;
            border: 1px solid rgba(79, 172, 254, 0.3);
            background: rgba(5, 10, 20, 0.65);
            color: var(--text-muted);
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.22s ease;
        }

        .cat-filter-pill:hover {
            color: var(--text-primary);
            border-color: rgba(148, 121, 255, 0.45);
        }

        .cat-filter-pill.active {
            background: linear-gradient(135deg, var(--accent), var(--accent-2));
            color: #05070f;
            border-color: transparent;
            box-shadow: 0 12px 32px rgba(148, 121, 255, 0.3);
        }

        .spirit-baby-container {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }
        /* The legacy container is a hidden data-mount for the bridge JS;
           the design hero above is the visible surface. Ensure [hidden]
           wins over the .spirit-baby-container display rule (specificity). */
        .spirit-baby-container[hidden] { display: none !important; }

        .spirit-baby-grid {
            display: grid;
            gap: 1.5rem;
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        @media (max-width: 1279px) {
            .spirit-baby-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (max-width: 700px) {
            .spirit-baby-grid {
                grid-template-columns: 1fr;
            }
        }

        /* iSpirit tab breaks out of the 1200px wisdom-container cap so
           the 4-column grid can fill the available main-column width.

           2026-05-17 fix: the original `calc(50% - 50vw + 1rem)` reached
           leftward all the way to the viewport edge — but wisdom.html
           lives inside `.app > .main` (sidebar = 256px on the left), so
           the breakout pushed the patterns / hero sections UNDER the
           sidebar, where the sticky theme-toggle (Standard | Cozy)
           overlapped the "What Lumis is noticing" eyebrow.

           New approach: instead of a viewport-aware negative-margin
           breakout, just widen the section to the main column's full
           width with a small inline padding. `.main` itself fills the
           remaining grid track after the sidebar, so a child that uses
           negative margin equal to its parent's horizontal padding
           reaches the main column edges without overflowing into the
           sidebar or past the viewport on the right. */
        #spirit-baby.wisdom-content {
            max-width: none;
            /* Negative margin = the wisdom-container's own horizontal
               padding (1.6rem = ~25.6px). Pulling outward by that exact
               amount lets the section reach the .main column's edges
               without crossing into the sidebar or past the viewport. */
            margin-left: -1.6rem;
            margin-right: -1.6rem;
        }

        @media (max-width: 700px) {
            #spirit-baby.wisdom-content {
                margin-left: 0;
                margin-right: 0;
            }
        }

        .spirit-card-full {
            grid-column: 1 / -1;
        }

        .spirit-card {
            background: rgba(5, 10, 20, 0.7);
            border-radius: 24px;
            border: 1px solid rgba(79, 172, 254, 0.24);
            box-shadow: 0 22px 48px rgba(15, 23, 42, 0.32);
            padding: 1.6rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .spirit-card h3 {
            margin: 0;
            font-size: 1.35rem;
        }

        .spirit-card p {
            margin: 0;
            color: var(--text-muted);
        }

        .spirit-card-centered {
            align-items: center;
            text-align: center;
        }

        .spirit-card-header {
            display: flex;
            justify-content: space-between;
            gap: 0.75rem;
            align-items: center;
        }

        .spirit-stat-list {
            list-style: none;
            padding: 0;
            margin: 0;
            display: grid;
            gap: 0.75rem;
        }

        .spirit-stat-list li {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            background: rgba(5, 10, 20, 0.6);
            border-radius: 14px;
            border: 1px solid rgba(79, 172, 254, 0.18);
            padding: 0.75rem 1rem;
            font-size: 0.95rem;
        }

        .spirit-stat-list strong {
            color: var(--text-primary);
            font-size: 1rem;
        }

        .spirit-progress {
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }

        .spirit-progress-track {
            width: 100%;
            height: 8px;
            border-radius: 999px;
            background: rgba(79, 172, 254, 0.18);
            overflow: hidden;
        }

        .spirit-progress-fill {
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(135deg, var(--accent), var(--accent-2));
            transition: width 0.3s ease;
        }

        .spirit-history-list {
            list-style: none;
            padding: 0;
            margin: 0;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .spirit-history-item {
            border: 1px solid rgba(79, 172, 254, 0.18);
            border-radius: 16px;
            padding: 0.85rem 1rem;
            background: rgba(5, 10, 20, 0.6);
        }

        .spirit-history-head {
            display: flex;
            justify-content: space-between;
            gap: 0.75rem;
            align-items: baseline;
        }

        .spirit-history-title {
            font-weight: 600;
            color: var(--text-primary);
        }

        .spirit-history-meta {
            margin-top: 0.25rem;
            color: var(--text-muted);
            font-size: 0.85rem;
        }

        .spirit-history-empty {
            text-align: center;
            color: var(--text-muted);
            padding: 1.2rem;
            border-radius: 16px;
            border: 1px dashed rgba(79, 172, 254, 0.28);
        }

        .spirit-text-muted {
            color: var(--text-muted);
            font-size: 0.95rem;
        }

        .spirit-history-question {
            margin-top: 0.45rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .spirit-history-insight {
            margin-top: 0.35rem;
            color: rgba(248, 250, 252, 0.85);
            font-size: 0.92rem;
            line-height: 1.6;
        }

        .spirit-answer-block {
            margin-top: 0.75rem;
            padding: 0.85rem 1rem;
            border-radius: 16px;
            border: 1px solid rgba(79, 172, 254, 0.28);
            background: rgba(5, 10, 20, 0.65);
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }

        .spirit-answer-block label {
            font-weight: 600;
            color: var(--text-primary);
        }

        .spirit-answer-block textarea {
            width: 100%;
            min-height: 90px;
            border-radius: 14px;
            border: 1px solid rgba(79, 172, 254, 0.28);
            background: rgba(5, 10, 20, 0.8);
            color: var(--text-primary);
            padding: 0.75rem 1rem;
            font-size: 0.95rem;
            resize: vertical;
        }

        .spirit-answer-block textarea:focus {
            outline: none;
            border-color: rgba(148, 121, 255, 0.55);
            box-shadow: 0 16px 38px rgba(79, 172, 254, 0.25);
        }

        .spirit-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            margin-top: 0.5rem;
        }

        .spirit-chip {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.35rem 0.75rem;
            border-radius: 999px;
            border: 1px solid rgba(79, 172, 254, 0.28);
            background: rgba(5, 10, 20, 0.65);
            font-size: 0.875rem;
            color: var(--text-primary);
        }

        .spirit-chip.success {
            border-color: rgba(74, 222, 128, 0.35);
            background: rgba(22, 101, 52, 0.35);
            color: #bbf7d0;
        }

        .spirit-chip.warning {
            border-color: rgba(249, 115, 22, 0.35);
            background: rgba(249, 115, 22, 0.2);
            color: #fed7aa;
        }

        .spirit-chip.status {
            text-transform: uppercase;
            font-size: 0.72rem;
            letter-spacing: 0.06em;
        }

        .spirit-chip.status-pending {
            border-color: rgba(251, 191, 36, 0.45);
            background: rgba(217, 119, 6, 0.25);
            color: #fde68a;
        }

        .spirit-chip.status-processing {
            border-color: rgba(96, 165, 250, 0.4);
            background: rgba(30, 64, 175, 0.3);
            color: #cbd5f5;
        }

        .spirit-chip.status-completed {
            border-color: rgba(74, 222, 128, 0.45);
            background: rgba(22, 101, 52, 0.35);
            color: #bbf7d0;
        }

        .spirit-chip.status-error {
            border-color: rgba(239, 68, 68, 0.45);
            background: rgba(127, 29, 29, 0.35);
            color: #fecaca;
        }

        .spirit-loader {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            padding: 2rem;
            color: var(--text-muted);
        }

        .spirit-spinner {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            border: 3px solid rgba(79, 172, 254, 0.25);
            border-top-color: var(--accent);
            animation: spiritSpin 1s linear infinite;
        }

        .spirit-spinner.small {
            width: 16px;
            height: 16px;
            border-width: 2px;
        }

        .spirit-avatar-card {
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
        }

        .spirit-avatar-preview {
            position: relative;
            border-radius: 22px;
            background: radial-gradient(circle at 30% 20%, rgba(148, 121, 255, 0.25), rgba(79, 172, 254, 0.1));
            border: 1px solid rgba(79, 172, 254, 0.28);
            aspect-ratio: 9 / 16;
            max-width: 320px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            box-shadow: inset 0 0 35px rgba(79, 172, 254, 0.18);
        }

        .spirit-avatar-preview img,
        .spirit-avatar-preview video {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .spirit-avatar-placeholder {
            text-align: center;
            color: var(--text-muted);
            padding: 1rem;
            line-height: 1.6;
        }

        .spirit-avatar-actions,
        .spirit-avatar-video-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: center;
        }

        .spirit-avatar-video {
            display: flex;
            flex-direction: column;
            gap: 0.9rem;
        }

        .spirit-avatar-status-text {
            font-size: 0.9rem;
            color: var(--text-muted);
            line-height: 1.4;
        }

        .spirit-avatar-message {
            border-radius: 16px;
            padding: 0.75rem 1rem;
            font-size: 0.9rem;
            line-height: 1.4;
        }

        .spirit-avatar-message-info {
            background: rgba(79, 172, 254, 0.18);
            border: 1px solid rgba(79, 172, 254, 0.32);
            color: #bfdbfe;
        }

        .spirit-avatar-message-success {
            background: rgba(22, 163, 74, 0.18);
            border: 1px solid rgba(34, 197, 94, 0.35);
            color: #bbf7d0;
        }

        .spirit-avatar-message-error {
            background: rgba(239, 68, 68, 0.16);
            border: 1px solid rgba(239, 68, 68, 0.35);
            color: #fecaca;
        }

        .spirit-avatar-video-player {
            width: 100%;
            border-radius: 18px;
            aspect-ratio: 9 / 16;
            max-width: 320px;
            background: rgba(15, 23, 42, 0.45);
        }

        .spirit-avatar-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            font-size: 0.78rem;
            color: var(--text-muted);
        }

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

        @media (max-width: 600px) {
            .spirit-baby-grid {
                grid-template-columns: 1fr;
            }
        }

        .form-group small {
            color: var(--text-muted);
            font-size: 0.8rem;
        }

        /* ── Identity Section ── */
        .identity-section {
            margin-bottom: 1.5rem;
        }
        .identity-section-header {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            margin-bottom: 0.8rem;
        }
        .identity-section-header h3 {
            margin: 0;
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--text-primary);
        }
        .identity-section-header .section-icon {
            font-size: 1.3rem;
        }
        .identity-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 0.5rem;
        }
        .identity-check {
            display: flex;
            align-items: center;
            gap: 0.55rem;
            padding: 0.55rem 0.8rem;
            border-radius: 10px;
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(148,121,255,0.18);
            cursor: pointer;
            transition: all 0.2s ease;
            user-select: none;
        }
        .identity-check:hover {
            background: rgba(148,121,255,0.12);
            border-color: rgba(148,121,255,0.35);
        }
        .identity-check input[type="checkbox"] {
            width: 17px;
            height: 17px;
            accent-color: #9479ff;
            flex-shrink: 0;
            cursor: pointer;
        }
        .identity-check span {
            color: rgba(248,250,252,0.88);
            font-size: 0.88rem;
            line-height: 1.3;
        }
        .identity-check.checked {
            background: rgba(148,121,255,0.18);
            border-color: rgba(148,121,255,0.45);
        }
        .identity-custom-row {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.5rem;
        }
        .identity-custom-input {
            flex: 1;
            padding: 0.55rem 0.8rem;
            border-radius: 10px;
            background: rgba(255,255,255,0.06);
            border: 1px solid rgba(148,121,255,0.25);
            color: var(--text-primary);
            font-size: 0.88rem;
            outline: none;
            transition: border-color 0.2s;
        }
        .identity-custom-input:focus {
            border-color: rgba(148,121,255,0.55);
        }
        .identity-custom-input::placeholder {
            color: rgba(248,250,252,0.35);
        }
        .identity-add-btn {
            padding: 0.55rem 1rem;
            border-radius: 10px;
            background: rgba(148,121,255,0.25);
            border: 1px solid rgba(148,121,255,0.4);
            color: #c4b5fd;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.2s;
        }
        .identity-add-btn:hover {
            background: rgba(148,121,255,0.4);
        }
        .identity-save-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            margin-top: 1.2rem;
            padding-top: 1rem;
            border-top: 1px solid rgba(148,121,255,0.15);
        }
        .identity-save-btn {
            padding: 0.7rem 2rem;
            border-radius: 12px;
            background: linear-gradient(135deg, #9479ff, #4facfe);
            border: none;
            color: #fff;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s;
        }
        .identity-save-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(148,121,255,0.35);
        }
        .identity-save-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }
        .identity-status {
            color: rgba(248,250,252,0.6);
            font-size: 0.85rem;
        }
        .identity-extract-card {
            background: linear-gradient(135deg, rgba(79,172,254,0.1), rgba(148,121,255,0.08));
            border: 1px solid rgba(79,172,254,0.25);
            border-radius: 14px;
            padding: 1.1rem 1.25rem;
            margin-top: 1.5rem;
        }
        .identity-extract-card h4 {
            margin: 0 0 0.5rem;
            color: #c4b5fd;
            font-size: 0.95rem;
        }
        .identity-extract-card p {
            margin: 0 0 0.8rem;
            color: rgba(248,250,252,0.7);
            font-size: 0.85rem;
            line-height: 1.5;
        }
        .identity-saved-list {
            margin-top: 0.8rem;
        }
        .identity-saved-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.4rem 0.7rem;
            margin-bottom: 0.3rem;
            border-radius: 8px;
            background: rgba(255,255,255,0.04);
            font-size: 0.85rem;
            color: rgba(248,250,252,0.8);
        }
        .identity-saved-item .saved-badge {
            color: #22c55e;
            font-size: 0.75rem;
            font-weight: 600;
        }

        /* Community cards: dark thin-bordered per mockup */
        .wisdom-card {
            background: rgba(5, 10, 20, 0.65);
            border-radius: 16px;
            border: 1px solid rgba(248, 250, 252, 0.10);
            padding: 1.1rem 1.2rem;
            display: flex;
            flex-direction: column;
            gap: 0.65rem;
            transition: all 0.22s ease;
            position: relative;
        }

        .wisdom-card:hover {
            transform: translateY(-2px);
            border-color: rgba(79, 172, 254, 0.28);
            box-shadow: 0 12px 32px rgba(15, 23, 42, 0.38);
        }

        .wisdom-card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 0.75rem;
        }

        .wisdom-card-title {
            margin: 0;
            font-size: 1rem;
            font-weight: 700;
            color: var(--text-primary);
            line-height: 1.35;
            flex: 1;
        }

        /* Category tag: uppercase small, top-right */
        .wisdom-card-category {
            padding: 0.2rem 0.55rem;
            border-radius: 4px;
            background: transparent;
            border: none;
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--fg-muted, rgba(248,250,252,0.55));
            flex-shrink: 0;
            white-space: nowrap;
        }

        .wisdom-card-content {
            color: rgba(248, 250, 252, 0.78);
            font-size: 0.88rem;
            line-height: 1.6;
            margin: 0;
            flex: 1;
        }

        /* Card footer: "From the community" + bookmark */
        .wisdom-card-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            padding-top: 0.55rem;
            border-top: 1px solid rgba(248,250,252,0.06);
            margin-top: auto;
        }

        .wisdom-card-source {
            font-size: 0.75rem;
            color: var(--fg-muted, rgba(248,250,252,0.45));
            font-style: italic;
        }

        .wisdom-card-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.6rem;
            color: var(--text-muted);
            font-size: 0.85rem;
        }

        .wisdom-card-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 0.45rem;
        }

        .wisdom-tag {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.3rem 0.7rem;
            border-radius: 999px;
            background: rgba(5, 10, 20, 0.65);
            border: 1px solid rgba(79, 172, 254, 0.28);
            font-size: 0.75rem;
            color: var(--text-primary);
        }

        .wisdom-card-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.6rem;
        }

        .wisdom-action-btn {
            padding: 0.55rem 1.2rem;
            border-radius: 999px;
            border: 1px solid rgba(79, 172, 254, 0.28);
            background: rgba(5, 10, 20, 0.65);
            color: var(--text-primary);
            font-weight: 600;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.25s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
        }

        .wisdom-action-btn:hover {
            transform: translateY(-2px);
            border-color: rgba(148, 121, 255, 0.45);
            box-shadow: 0 18px 40px rgba(79, 172, 254, 0.25);
        }

        /* Bookmark button — inline in card footer */
        .wisdom-action-btn.like {
            border: none;
            background: transparent;
            color: rgba(248,250,252,0.4);
            padding: 0.25rem;
            font-size: 1rem;
            line-height: 1;
            min-width: auto;
            justify-content: center;
        }

        .wisdom-action-btn.like:hover {
            color: rgba(248,250,252,0.8);
            transform: none;
            box-shadow: none;
            border: none;
        }

        .wisdom-action-btn.like.saved {
            color: #a78bfa;
            border: none;
        }

        .wisdom-action-btn.share {
            display: none !important;
            border-color: rgba(16, 185, 129, 0.45);
            background: rgba(16, 185, 129, 0.18);
            color: #a7f3d0;
        }

        .wisdom-form {
            background: rgba(5, 10, 20, 0.65);
            border-radius: 24px;
            border: 1px solid rgba(79, 172, 254, 0.18);
            padding: clamp(1.6rem, 3vw, 2.4rem);
            box-shadow: 0 22px 48px rgba(15, 23, 42, 0.32);
            display: flex;
            flex-direction: column;
            gap: 1.2rem;
        }

        .wisdom-form h3 {
            margin: 0;
            font-size: 1.4rem;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .form-group label {
            font-weight: 600;
            color: var(--text-primary);
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 0.85rem 1rem;
            border-radius: 14px;
            border: 1px solid rgba(79, 172, 254, 0.28);
            background: rgba(5, 10, 20, 0.78);
            color: var(--text-primary);
            transition: all 0.25s ease;
        }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: rgba(148, 121, 255, 0.55);
            box-shadow: 0 16px 38px rgba(79, 172, 254, 0.25);
        }

        .form-group textarea {
            min-height: 140px;
            resize: vertical;
        }

        .form-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1rem;
        }

        input[type="range"] {
            accent-color: var(--accent);
        }

        #difficultyValue,
        #impactValue {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 42px;
            height: 42px;
            border-radius: 14px;
            background: rgba(79, 172, 254, 0.18);
            border: 1px solid rgba(79, 172, 254, 0.3);
            color: var(--text-primary);
            font-weight: 600;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1.2rem;
        }

        .stat-card {
            background: rgba(5, 10, 20, 0.65);
            border-radius: 24px;
            border: 1px solid rgba(79, 172, 254, 0.2);
            padding: 1.4rem;
            box-shadow: 0 18px 42px rgba(15, 23, 42, 0.28);
        }

        .stat-card h4 {
            margin: 0 0 0.8rem 0;
        }

        .stat-card p {
            margin: 0;
            color: var(--text-muted);
        }

        .loading {
            text-align: center;
            padding: 2rem;
            border-radius: 20px;
            background: rgba(5, 10, 20, 0.6);
            border: 1px dashed rgba(79, 172, 254, 0.24);
            color: var(--text-muted);
        }

        .error {
            text-align: center;
            padding: 1.5rem;
            border-radius: 18px;
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.4);
            color: #fca5a5;
            font-weight: 600;
        }

        @media (max-width: 900px) {
            .brand-chip {
                display: none;
            }

            .wisdom-hero-top,
            .wisdom-hero-actions {
                flex-direction: column;
                align-items: stretch;
            }

            .btn,
            .btn-outline,
            .btn-secondary {
                width: 100%;
                justify-content: center;
            }

            .wisdom-category-section {
                padding: 1.3rem;
            }

            .wisdom-card {
                padding: 1.4rem;
            }
        }

        @media (max-width: 600px) {
            .wisdom-container {
                padding: 2rem 1.2rem 3rem;
            }
        }

        @media (max-width: 480px) {
            .spirit-chip {
                font-size: 14px !important;
            }
            .dashboard-footer-brand,
            .dashboard-footer-links a {
                font-size: 14px;
            }
        }

        /* Wisdom page selects/inputs: 16px floor to prevent iOS Safari
           auto-zoom on focus. Scoped to wisdom-content + form modals so
           it doesn't affect other pages. !important defeats styles.css
           global `select:not(.brand-select):not(.filter-select)…` at (0,7,1). */
        .wisdom-content select,
        .wisdom-content input[type="text"],
        .wisdom-content input[type="email"],
        .wisdom-content input[type="search"],
        .wisdom-content textarea,
        #wisdomCategory, #wisdomVisibility, #wisdomSource,
        #spiritFeedSourceSelect {
            font-size: 16px !important;
        }

        /* ─── Legacy sbBanner suppression (replaced by iSpirit companion card) ─── */
        #sbBanner { display: none !important; }

        /* ─── iSpirit companion hero (round 8) ───
           Reorganized: identity card becomes a true hero block with stronger
           visual anchor. Action buttons removed (page-head already owns those
           CTAs). Stats row sits below tagline with a subtle inset bg so it
           reads as a unified strip, not floating numbers. Patterns section
           sits below with its own eyebrow header + count badge so the
           hierarchy reads: hero (identity) → secondary (patterns). */
        .ispirit-hero {
            display: grid;
            grid-template-columns: 196px 1fr;
            gap: 28px;
            background: linear-gradient(135deg, rgba(79,172,254,0.12), rgba(148,121,255,0.12));
            border: 1px solid rgba(148,121,255,0.18);
            border-radius: 22px;
            padding: 28px 30px;
            align-items: center;
            margin: 6px 0 28px;
            position: relative;
            overflow: hidden;
        }
        .ispirit-hero::before {
            /* soft glow behind avatar — anchors the visual weight */
            content: '';
            position: absolute;
            top: -40px; left: -40px;
            width: 280px; height: 280px;
            background: radial-gradient(circle, rgba(148,121,255,0.18), transparent 65%);
            pointer-events: none;
        }
        .ispirit-hero .ispirit-avatar {
            width: 176px;
            height: 176px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(148,121,255,0.28), transparent 70%);
            display: grid;
            place-items: center;
            position: relative;
            z-index: 1;
        }
        .ispirit-hero .ispirit-avatar img {
            width: 92%; height: 92%; object-fit: contain;
        }
        .ispirit-avatar-fallback {
            display: none;
            font-size: 3rem;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
        }
        .ispirit-meta {
            display: flex;
            flex-direction: column;
            gap: 14px;
            position: relative;
            z-index: 1;
            min-width: 0;
        }
        .ispirit-meta .eyebrow {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.16em;
            color: rgba(248,250,252,0.55);
            display: block;
            margin-bottom: 2px;
        }
        .ispirit-name {
            margin: 0;
            font-size: 32px;
            line-height: 1.1;
            font-weight: 700;
            color: var(--text-primary);
            letter-spacing: -0.01em;
        }
        .ispirit-tagline {
            font-size: 16px;
            font-style: italic;
            color: rgba(248,250,252,0.92);
            line-height: 1.55;
            max-width: 680px;
            margin: 0;
        }
        .ispirit-stats {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 0;
            margin-top: 6px;
            background: rgba(5,10,20,0.32);
            border: 1px solid rgba(248,250,252,0.08);
            border-radius: 14px;
            padding: 14px 4px;
        }
        .ispirit-stat {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 0 14px;
            border-right: 1px solid rgba(248,250,252,0.08);
        }
        .ispirit-stat:last-child { border-right: 0; }
        .ispirit-stat .l {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.12em;
            color: rgba(248,250,252,0.55);
            margin-bottom: 6px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }
        .ispirit-stat .v {
            font-size: 22px;
            font-weight: 700;
            color: var(--text-primary);
            line-height: 1;
        }

        /* Section separator between hero and patterns */
        .ispirit-section-head {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 16px;
            margin: 6px 2px 14px;
            padding-bottom: 10px;
            border-bottom: 1px solid rgba(248,250,252,0.06);
        }
        .ispirit-section-head .title-block { display: flex; flex-direction: column; gap: 4px; }
        .ispirit-section-head .eyebrow {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.16em;
            color: rgba(148,121,255,0.85);
        }
        .ispirit-section-head h3 {
            margin: 0;
            font-size: 17px;
            font-weight: 700;
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .ispirit-section-head h3 .icon { color: rgba(148,121,255,0.85); }
        .ispirit-section-head .count-pill {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.12em;
            color: rgba(248,250,252,0.55);
            background: rgba(248,250,252,0.04);
            border: 1px solid rgba(248,250,252,0.08);
            border-radius: 999px;
            padding: 4px 10px;
            white-space: nowrap;
        }

        /* Patterns Lumis is watching — secondary content, narrower than hero */
        .ispirit-patterns-section { margin: 0 0 24px; }
        .ispirit-patterns-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
            gap: 14px;
        }
        .ispirit-pattern-card {
            background: rgba(5,10,20,0.55);
            border: 1px solid rgba(248,250,252,0.10);
            border-left: 3px solid rgba(148,121,255,0.55);
            border-radius: 14px;
            padding: 16px 18px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            transition: border-color 0.18s ease, transform 0.18s ease;
        }
        .ispirit-pattern-card:hover {
            border-color: rgba(248,250,252,0.18);
            border-left-color: rgba(148,121,255,0.85);
        }
        .ispirit-pattern-title {
            margin: 0;
            font-size: 15px;
            font-weight: 700;
            color: var(--text-primary);
        }
        .ispirit-pattern-body {
            margin: 0;
            font-size: 13.5px;
            line-height: 1.55;
            color: rgba(248,250,252,0.75);
        }
        .ispirit-pattern-foot {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.10em;
            color: rgba(248,250,252,0.40);
            margin-top: 4px;
        }

        @media (max-width: 820px) {
            .ispirit-stats { grid-template-columns: repeat(2, 1fr); padding: 14px 0; }
            .ispirit-stat { padding: 10px 8px; border-right: 0; border-bottom: 1px solid rgba(248,250,252,0.06); }
            .ispirit-stat:nth-last-child(-n+2) { border-bottom: 0; }
        }
        @media (max-width: 700px) {
            .ispirit-hero { grid-template-columns: 1fr; text-align: center; padding: 24px 20px; }
            .ispirit-hero .ispirit-avatar { margin: 0 auto; width: 144px; height: 144px; }
            .ispirit-tagline { margin-left: auto; margin-right: auto; }
            .ispirit-section-head { flex-direction: column; align-items: flex-start; }
        }

        /* ─── R9: cozy-mode parity overrides ──────────────────────────
           The R8 hero + pattern cards used dark gradients + dark ink that
           sat wrong on the cozy paper background. These overrides only fire
           when [data-ux-mode="cozy"] is on <html>, so standard mode is
           untouched. Scoped to wisdom.html (Dev Rule #4 + tri-platform). */
        [data-ux-mode="cozy"] .wisdom-tab {
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .wisdom-tab:hover {
            color: var(--cozy-ink, #2c2418) !important;
            background: rgba(182,151,99,0.10) !important;
        }
        [data-ux-mode="cozy"] .wisdom-tab.active {
            background: rgba(182,151,99,0.18) !important;
            color: var(--cozy-ink, #2c2418) !important;
            border-color: rgba(182,151,99,0.45) !important;
        }
        [data-ux-mode="cozy"] .ispirit-hero {
            background: var(--cozy-paper-elevated, #f7efe1) !important;
            border: 1px solid var(--cozy-gold-soft, rgba(182,151,99,0.32)) !important;
            box-shadow: 0 6px 18px var(--cozy-warm-shadow, rgba(182,151,99,0.18)) !important;
        }
        [data-ux-mode="cozy"] .ispirit-hero::before {
            background: radial-gradient(circle, rgba(182,151,99,0.16), transparent 65%) !important;
        }
        [data-ux-mode="cozy"] .ispirit-hero .ispirit-avatar {
            background: radial-gradient(circle, rgba(182,151,99,0.20), transparent 70%) !important;
        }
        [data-ux-mode="cozy"] .ispirit-name {
            color: var(--cozy-ink, #2c2418) !important;
        }
        [data-ux-mode="cozy"] .ispirit-meta .eyebrow {
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .ispirit-tagline {
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .ispirit-stats {
            background: rgba(255, 252, 245, 0.6) !important;
            border: 1px solid var(--cozy-gold-soft, rgba(182,151,99,0.20)) !important;
        }
        [data-ux-mode="cozy"] .ispirit-stat {
            border-right-color: var(--cozy-gold-soft, rgba(182,151,99,0.16)) !important;
        }
        [data-ux-mode="cozy"] .ispirit-stat .l {
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .ispirit-stat .v {
            color: var(--cozy-ink, #2c2418) !important;
        }
        [data-ux-mode="cozy"] .ispirit-section-head {
            border-bottom-color: var(--cozy-gold-soft, rgba(182,151,99,0.22)) !important;
        }
        [data-ux-mode="cozy"] .ispirit-section-head .eyebrow {
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .ispirit-section-head h3 {
            color: var(--cozy-ink, #2c2418) !important;
        }
        [data-ux-mode="cozy"] .ispirit-section-head h3 .icon {
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .ispirit-section-head .count-pill {
            background: rgba(182,151,99,0.10) !important;
            border-color: var(--cozy-gold-soft, rgba(182,151,99,0.24)) !important;
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .ispirit-pattern-card {
            background: var(--cozy-paper-elevated, #f7efe1) !important;
            border: 1px solid var(--cozy-gold-soft, rgba(182,151,99,0.24)) !important;
            border-left: 3px solid rgba(182,151,99,0.62) !important;
            box-shadow: 0 4px 12px var(--cozy-warm-shadow, rgba(182,151,99,0.12)) !important;
        }
        [data-ux-mode="cozy"] .ispirit-pattern-card:hover {
            border-color: rgba(182,151,99,0.45) !important;
            border-left-color: rgba(182,151,99,0.88) !important;
        }
        [data-ux-mode="cozy"] .ispirit-pattern-title {
            color: var(--cozy-ink, #2c2418) !important;
        }
        [data-ux-mode="cozy"] .ispirit-pattern-body {
            color: var(--cozy-ink-muted, #6b5f4a) !important;
        }
        [data-ux-mode="cozy"] .ispirit-pattern-foot {
            color: rgba(108, 95, 74, 0.65) !important;
        }

        /* R9: keep the patterns section + hero horizontally inset so the
           section-head + cards never bleed against the iSpirit-tab full-width
           breakout. iSpirit tab has a CSS rule that breaks out of the 1200px
           wisdom-container cap (line 561) using negative margins; that exposed
           the .ispirit-section-head left edge to the viewport edge. */
        #spirit-baby > .ispirit-hero,
        #spirit-baby > .ispirit-patterns-section {
            padding-left: clamp(8px, 1.2vw, 24px);
            padding-right: clamp(8px, 1.2vw, 24px);
        }
        /* The hero itself already has interior padding, so we use margin-inset
           for it but interior padding for the section-head wrapper. */
        #spirit-baby > .ispirit-hero {
            padding-left: 30px;
            padding-right: 30px;
            margin-left: clamp(8px, 1.2vw, 24px);
            margin-right: clamp(8px, 1.2vw, 24px);
        }
        #spirit-baby > .ispirit-patterns-section {
            padding-left: 0;
            padding-right: 0;
            margin-left: clamp(8px, 1.2vw, 24px);
            margin-right: clamp(8px, 1.2vw, 24px);
        }
    
        /* Cozy: dark badge + dark --text-primary was ~2.46:1 (sub-AA). Warm
           tint + readable dark ink on cream paper (QA R4). */
        [data-ux-mode="cozy"] .wisdom-tag {
            background: color-mix(in srgb, var(--accent-purple, #b5842a) 14%, transparent);
            border-color: color-mix(in srgb, var(--accent-purple, #b5842a) 30%, transparent);
            color: var(--fg-strong, #1a2438);
        }
