/* ============================================
   CLARITY BOX - Financial Sense-Making Engine
   Design: Calm, Minimal, Premium, Intelligent
   ============================================ */

/* -------------------- Design Tokens -------------------- */
:root {
    /* Color Palette - Matching ProsperPath Main Theme */
    --cb-bg-primary: #050506;
    --cb-bg-secondary: #0a0a0c;
    --cb-bg-elevated: rgba(255, 255, 255, 0.05);
    --cb-bg-card: rgba(255, 255, 255, 0.09);

    --cb-text-primary: #f4f4f5;
    --cb-text-secondary: #a1a1aa;
    --cb-text-muted: #71717a;

    --cb-accent: #e4e4e7;
    --cb-accent-muted: rgba(228, 228, 231, 0.7);
    --cb-accent-subtle: rgba(228, 228, 231, 0.15);
    --cb-accent-glow: rgba(228, 228, 231, 0.2);

    --cb-border: rgba(255, 255, 255, 0.12);
    --cb-border-light: rgba(255, 255, 255, 0.15);

    /* Typography */
    --cb-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --cb-font-display: 'Outfit', 'Inter', sans-serif;

    /* Spacing - Large, editorial */
    --cb-space-xs: 0.5rem;
    --cb-space-sm: 1rem;
    --cb-space-md: 1.5rem;
    --cb-space-lg: 2.5rem;
    --cb-space-xl: 4rem;
    --cb-space-2xl: 6rem;
    --cb-space-3xl: 8rem;

    /* Transitions - Soft, no bounce */
    --cb-transition-fast: 0.15s ease;
    --cb-transition-base: 0.25s ease;
    --cb-transition-slow: 0.4s ease;

    /* Radius */
    --cb-radius-sm: 8px;
    --cb-radius-md: 12px;
    --cb-radius-lg: 16px;
    --cb-radius-xl: 24px;
}

/* -------------------- Reset & Base -------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--cb-font-body);
    font-weight: 400;
    line-height: 1.7;
    color: var(--cb-text-primary);
    background: var(--cb-bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -------------------- Navigation -------------------- */
.clarity-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--cb-space-md) var(--cb-space-lg);
    background: rgba(13, 13, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--cb-border);
}

.clarity-nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clarity-logo {
    display: flex;
    align-items: center;
    gap: var(--cb-space-sm);
    text-decoration: none;
    color: var(--cb-text-primary);
}

.logo-mark {
    font-size: 1.5rem;
}

.logo-text {
    font-family: var(--cb-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.clarity-nav-links {
    display: flex;
    align-items: center;
    gap: var(--cb-space-lg);
}

.clarity-nav-links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-text-secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color var(--cb-transition-fast);
}

.clarity-nav-links a:hover,
.clarity-nav-links a.active {
    color: var(--cb-text-primary);
}

.clarity-nav-links a.active {
    color: var(--cb-accent);
}

/* -------------------- History Button in Nav -------------------- */
.clarity-history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--cb-bg-elevated);
    border: 1px solid var(--cb-border-light);
    border-radius: 50%;
    color: var(--cb-text-secondary);
    cursor: pointer;
    transition: all var(--cb-transition-fast);
    position: relative;
}

.clarity-history-btn:hover {
    color: var(--cb-accent);
    border-color: var(--cb-accent-subtle);
    background: var(--cb-bg-card);
}

.clarity-history-btn .history-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: var(--cb-accent);
    color: var(--cb-bg-primary);
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* -------------------- History Sidebar -------------------- */
.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--cb-transition-base);
}

.history-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.history-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--cb-bg-secondary);
    border-left: 1px solid var(--cb-border);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.history-sidebar.active {
    transform: translateX(0);
}

.history-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--cb-space-md) var(--cb-space-md);
    border-bottom: 1px solid var(--cb-border);
}

.history-sidebar-header h2 {
    font-family: var(--cb-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cb-text-primary);
}

.history-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-sm);
    color: var(--cb-text-secondary);
    cursor: pointer;
    transition: all var(--cb-transition-fast);
}

.history-close-btn:hover {
    color: var(--cb-text-primary);
    border-color: var(--cb-border-light);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--cb-space-sm);
}

.history-empty {
    text-align: center;
    color: var(--cb-text-muted);
    font-size: 0.875rem;
    padding: var(--cb-space-xl) var(--cb-space-sm);
}

.history-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--cb-space-sm) var(--cb-space-sm);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
    cursor: pointer;
    transition: all var(--cb-transition-fast);
    margin-bottom: var(--cb-space-xs);
}

.history-item:hover {
    background: var(--cb-bg-elevated);
    border-color: var(--cb-accent-subtle);
}

.history-item-question {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--cb-text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-time {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
}

.history-clear-btn {
    margin: var(--cb-space-sm);
    padding: var(--cb-space-xs) var(--cb-space-sm);
    background: transparent;
    border: 1px solid rgba(202, 111, 111, 0.3);
    border-radius: var(--cb-radius-sm);
    color: #ca6f6f;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--cb-transition-fast);
    text-align: center;
}

.history-clear-btn:hover {
    background: rgba(202, 111, 111, 0.1);
    border-color: rgba(202, 111, 111, 0.5);
}

/* -------------------- Landing View -------------------- */
.clarity-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--cb-space-3xl) + 50px) var(--cb-space-lg) var(--cb-space-3xl);
}

.clarity-landing {
    text-align: center;
    max-width: 720px;
    width: 100%;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.clarity-headline {
    font-family: var(--cb-font-display);
    font-size: clamp(2.2rem, 5.25vw, 3.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--cb-text-primary);
    margin-bottom: var(--cb-space-sm);
    line-height: 1.1;
}

.clarity-subtext {
    font-size: 1.25rem;
    color: var(--cb-text-secondary);
    margin-bottom: var(--cb-space-xl);
    font-weight: 300;
}

/* -------------------- Clarity Input -------------------- */
.clarity-input-wrapper {
    position: relative;
    margin-bottom: var(--cb-space-xl);
}

.clarity-input {
    width: 100%;
    padding: var(--cb-space-md) var(--cb-space-lg);
    padding-right: 4rem;
    padding-left: 3.5rem;
    font-family: var(--cb-font-body);
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--cb-text-primary);
    background: var(--cb-bg-elevated);
    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-xl);
    outline: none;
    transition: all var(--cb-transition-base);
}

.clarity-input::placeholder {
    color: var(--cb-text-muted);
}

.clarity-input:focus {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.08), 0 0 0 4px var(--cb-accent-subtle);
}

.clarity-input-wrapper:focus-within .clarity-submit {
    filter: brightness(1.15);
}

.clarity-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cb-accent);
    border: none;
    border-radius: var(--cb-radius-lg);
    color: var(--cb-bg-primary);
    cursor: pointer;
    transition: all 200ms ease;
}

.clarity-submit:hover {
    background: var(--cb-accent);
    filter: brightness(1.15);
    transform: translateY(-50%) scale(1.03);
}

/* -------------------- Web Toggle Icon -------------------- */
.clarity-web-toggle {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--cb-border);
    border-radius: 50%;
    color: var(--cb-text-muted);
    cursor: pointer;
    transition: all var(--cb-transition-fast);
    z-index: 2;
}

.clarity-web-toggle:hover {
    color: var(--cb-text-secondary);
    border-color: var(--cb-border-light);
}

.clarity-web-toggle.active {
    color: var(--cb-accent);
    border-color: var(--cb-accent);
    background: var(--cb-accent-subtle);
    box-shadow: 0 0 12px var(--cb-accent-glow);
}

.clarity-web-toggle .web-label {
    display: none;
}

/* -------------------- Suggestions -------------------- */
.clarity-suggestions {
    display: flex;
    flex-direction: column;
    gap: var(--cb-space-sm);
    max-width: 560px;
    margin: 0 auto;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: var(--cb-space-sm);
    padding: var(--cb-space-sm) var(--cb-space-md);
    background: var(--cb-bg-secondary);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
    cursor: pointer;
    text-align: left;
    transition: all 200ms ease;
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.08); /* slightly brighter */
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.05); /* increase border glow */
    transform: translateY(-2px);
}

.suggestion-icon {
    font-size: 1.25rem;
}

.suggestion-item span:last-child {
    font-size: 0.9375rem;
    color: var(--cb-text-secondary);
}

/* -------------------- Conversation View -------------------- */
.clarity-conversation {
    padding: calc(80px + var(--cb-space-lg)) var(--cb-space-lg) calc(100px + var(--cb-space-lg));
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
}

.clarity-conversation.hidden {
    display: none;
}

.conversation-thread {
    display: flex;
    flex-direction: column;
    gap: var(--cb-space-xl);
}

/* Individual Q&A Block */
.qa-block {
    animation: qaFadeIn 0.5s ease forwards;
    opacity: 0;
}

@keyframes qaFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qa-question {
    display: flex;
    align-items: flex-start;
    gap: var(--cb-space-sm);
    margin-bottom: var(--cb-space-lg);
}

.qa-question-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cb-accent-subtle);
    color: var(--cb-accent);
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
}

.qa-question-text {
    font-family: var(--cb-font-display);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--cb-text-primary);
    padding-top: 4px;
}

.qa-web-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cb-accent);
    background: var(--cb-accent-subtle);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
    vertical-align: middle;
}

.qa-answer {
    padding-left: calc(36px + var(--cb-space-sm));
}

.qa-divider {
    border: none;
    height: 1px;
    background: var(--cb-border);
    margin: var(--cb-space-lg) 0 0 0;
}

/* Loading skeleton inside a Q&A block */
.qa-loading {
    padding: var(--cb-space-md);
    display: flex;
    flex-direction: column;
    gap: var(--cb-space-sm);
}

.qa-loading-bar {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--cb-bg-elevated) 25%, var(--cb-bg-card) 50%, var(--cb-bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.qa-loading-bar:nth-child(1) {
    width: 90%;
}

.qa-loading-bar:nth-child(2) {
    width: 75%;
}

.qa-loading-bar:nth-child(3) {
    width: 60%;
}

.qa-loading-bar:nth-child(4) {
    width: 80%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* -------------------- Sections (inside Q&A blocks) -------------------- */
.clarity-section {
    margin-bottom: var(--cb-space-2xl);
    opacity: 0;
    transform: translateY(20px);
    animation: sectionFadeIn 0.4s ease forwards;
}

.clarity-section:nth-child(1) {
    animation-delay: 0.1s;
}

.clarity-section:nth-child(2) {
    animation-delay: 0.2s;
}

.clarity-section:nth-child(3) {
    animation-delay: 0.3s;
}

.clarity-section:nth-child(4) {
    animation-delay: 0.4s;
}

.clarity-section:nth-child(5) {
    animation-delay: 0.5s;
}

.clarity-section:nth-child(6) {
    animation-delay: 0.6s;
}

@keyframes sectionFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-label {
    display: flex;
    align-items: center;
    gap: var(--cb-space-xs);
    margin-bottom: var(--cb-space-md);
}

.label-icon {
    font-size: 1.25rem;
}

.label-text {
    font-family: var(--cb-font-display);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--cb-accent);
}

.label-note {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
    font-style: italic;
    text-transform: none;
    letter-spacing: 0;
}

.section-content {
    color: var(--cb-text-secondary);
    font-size: 1.0625rem;
    line-height: 1.8;
}

.section-content p {
    margin-bottom: var(--cb-space-sm);
}

/* Forces Grid */
.forces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--cb-space-md);
}

.force-card {
    padding: var(--cb-space-md);
    background: var(--cb-bg-elevated);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
    transition: all var(--cb-transition-fast);
}

.force-card:hover {
    border-color: var(--cb-accent-subtle);
}

.force-title {
    font-family: var(--cb-font-display);
    font-weight: 600;
    color: var(--cb-text-primary);
    margin-bottom: var(--cb-space-xs);
}

.force-desc {
    font-size: 0.9375rem;
    color: var(--cb-text-secondary);
}

/* Time Slider */
.time-slider-wrapper {
    margin-bottom: var(--cb-space-lg);
}

.time-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--cb-space-sm);
    font-size: 0.8125rem;
    color: var(--cb-text-muted);
}

.time-slider {
    width: 100%;
    height: 6px;
    background: var(--cb-bg-elevated);
    border-radius: 3px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--cb-accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 12px var(--cb-accent-glow);
    transition: all var(--cb-transition-fast);
}

.time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--cb-accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 12px var(--cb-accent-glow);
}

.time-impact-content {
    padding: var(--cb-space-md);
    background: var(--cb-bg-secondary);
    border-left: 3px solid var(--cb-accent);
    border-radius: 0 var(--cb-radius-md) var(--cb-radius-md) 0;
}

/* Risks Grid */
.risks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--cb-space-md);
}

.risk-card {
    padding: var(--cb-space-md);
    background: var(--cb-bg-elevated);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
}

.risk-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cb-accent-muted);
    margin-bottom: var(--cb-space-xs);
}

.risk-title {
    font-weight: 600;
    color: var(--cb-text-primary);
    margin-bottom: var(--cb-space-xs);
}

.risk-desc {
    font-size: 0.9375rem;
    color: var(--cb-text-secondary);
}

/* Scenarios Grid */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--cb-space-md);
}

.scenario-card {
    padding: var(--cb-space-md);
    background: var(--cb-bg-elevated);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
    text-align: center;
}

.scenario-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--cb-space-xs);
}

.scenario-optimistic .scenario-label {
    color: #6fca7b;
}

.scenario-balanced .scenario-label {
    color: var(--cb-accent);
}

.scenario-pessimistic .scenario-label {
    color: #ca6f6f;
}

.scenario-title {
    font-family: var(--cb-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cb-text-primary);
    margin-bottom: var(--cb-space-xs);
}

.scenario-desc {
    font-size: 0.875rem;
    color: var(--cb-text-secondary);
}

/* Next Steps */
.next-steps {
    display: flex;
    flex-direction: column;
    gap: var(--cb-space-sm);
}

.next-item {
    display: flex;
    align-items: flex-start;
    gap: var(--cb-space-sm);
    padding: var(--cb-space-md);
    background: var(--cb-bg-secondary);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
    cursor: pointer;
    transition: all var(--cb-transition-fast);
}

.next-item:hover {
    border-color: var(--cb-accent-subtle);
    background: var(--cb-bg-elevated);
}

.next-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cb-accent-subtle);
    color: var(--cb-accent);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.next-text {
    color: var(--cb-text-secondary);
    font-size: 0.9375rem;
}

/* -------------------- Bottom Search Bar -------------------- */
.clarity-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    padding: var(--cb-space-sm) var(--cb-space-lg);
    background: rgba(10, 22, 40, 0.85);
    backdrop-filter: blur(24px);
    border-top: 1px solid var(--cb-border);
}

.clarity-bottom-bar.hidden {
    display: none;
}

.clarity-bottom-input-wrapper {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.clarity-bottom-input {
    width: 100%;
    padding: var(--cb-space-sm) var(--cb-space-lg);
    padding-right: 3.5rem;
    padding-left: 3.5rem;
    font-family: var(--cb-font-body);
    font-size: 1rem;
    font-weight: 400;
    color: var(--cb-text-primary);
    background: var(--cb-bg-elevated);
    border: 1px solid var(--cb-border-light);
    border-radius: var(--cb-radius-xl);
    outline: none;
    transition: all var(--cb-transition-base);
}

.clarity-bottom-input::placeholder {
    color: var(--cb-text-muted);
}

.clarity-bottom-input:focus {
    border-color: var(--cb-accent-muted);
    box-shadow: 0 0 0 4px var(--cb-accent-subtle);
}

.clarity-bottom-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cb-accent);
    border: none;
    border-radius: var(--cb-radius-md);
    color: var(--cb-bg-primary);
    cursor: pointer;
    transition: all var(--cb-transition-fast);
}

.clarity-bottom-submit:hover {
    background: var(--cb-accent-muted);
    transform: translateY(-50%) scale(1.05);
}

/* Web toggle in bottom bar reuses .clarity-web-toggle styles */

/* -------------------- Footer -------------------- */
.clarity-footer {
    padding: var(--cb-space-lg);
    text-align: center;
    border-top: 1px solid var(--cb-border);
}

.clarity-footer p {
    font-size: 0.8125rem;
    color: var(--cb-text-muted);
}

/* -------------------- Responsive -------------------- */
@media (max-width: 768px) {
    .clarity-header {
        padding: var(--cb-space-sm) var(--cb-space-md);
    }

    .clarity-nav-links {
        gap: var(--cb-space-md);
    }

    .clarity-main {
        padding: var(--cb-space-2xl) var(--cb-space-md);
    }

    .clarity-conversation {
        padding-left: var(--cb-space-md);
        padding-right: var(--cb-space-md);
    }

    .qa-answer {
        padding-left: 0;
    }

    .risks-grid,
    .scenarios-grid {
        grid-template-columns: 1fr;
    }

    .time-labels {
        font-size: 0.6875rem;
    }

    .clarity-bottom-bar {
        padding: var(--cb-space-xs) var(--cb-space-sm);
    }

    .history-sidebar {
        width: 100%;
        max-width: 100vw;
    }
}

/* -------------------- Utility Classes -------------------- */
.hidden {
    display: none !important;
}

/* Loading state */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.8;
}

/* Loading Spinner */
.cb-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--cb-accent);
    animation: cb-spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes cb-spin {
    to {
        transform: rotate(360deg);
    }
}

.cb-processing {
    opacity: 0.7;
    pointer-events: none;
    filter: grayscale(0.2);
    transition: all var(--cb-transition-slow);
}

/* Error Toast */
.cb-error-toast {
    position: fixed;
    bottom: calc(80px + var(--cb-space-lg));
    left: 50%;
    transform: translateX(-50%);
    background: #ca6f6f;
    color: white;
    padding: var(--cb-space-sm) var(--cb-space-md);
    border-radius: var(--cb-radius-md);
    font-size: 0.9375rem;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: cb-slideUp 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.cb-error-toast.fade-out {
    opacity: 0;
    transform: translate(-50%, 20px);
    transition: all 0.5s ease;
}

@keyframes cb-slideUp {
    from {
        transform: translate(-50%, 30px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Placeholder fade animation */
.placeholder-fade {
    animation: placeholderFade 0.2s ease;
}

@keyframes placeholderFade {
    0% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}


/* ═══════════════════════════════════════════════
   MARKET PULSE SECTION
   Scrolls below the Clarity Box hero.
   Matches Clarity Box dark aesthetic exactly.
═══════════════════════════════════════════════ */

/* ---------- Section Container ---------- */
.mp-section {
    background: var(--cb-bg-primary);
    padding: 6rem var(--cb-space-lg) 8rem;
    position: relative;
    overflow: hidden;
    /* Subtle top separator */
    border-top: 1px solid var(--cb-border);
}

/* Ambient glow behind section */
.mp-section::before {
    content: '';
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(ellipse at center, rgba(228, 228, 231, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.mp-inner {
    max-width: 880px;
    margin: 0 auto;
    /* Fade-in when intersected */
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.mp-inner.mp-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Header ---------- */
.mp-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.mp-header-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1rem;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--cb-border);
    border-radius: 20px;
}

.mp-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
    animation: mpPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes mpPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.mp-label-text {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #4ade80;
}

.mp-title {
    font-family: var(--cb-font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--cb-text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.mp-subtitle {
    font-size: 1rem;
    color: var(--cb-text-muted);
    font-weight: 300;
}

/* ---------- Category Selector (Segmented Control) ---------- */
.mp-category-selector {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--cb-bg-secondary);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-xl);
    margin: 0 auto 2.5rem;
    display: flex;
    justify-content: center;
    width: fit-content;
}

.mp-cat {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-text-muted);
    background: transparent;
    border: none;
    border-radius: calc(var(--cb-radius-xl) - 4px);
    cursor: pointer;
    transition: all var(--cb-transition-base);
    letter-spacing: 0.01em;
    font-family: var(--cb-font-body);
}

.mp-cat:hover {
    color: var(--cb-text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.mp-cat.active {
    color: var(--cb-text-primary);
    background: var(--cb-bg-elevated);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---------- Asset Chip Grid ---------- */
.mp-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    min-height: 160px;
}

/* Individual floating chip */
.mp-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 14px 20px;
    background: var(--cb-bg-secondary);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-xl);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    min-width: 96px;
    transition: all var(--cb-transition-base);
    position: relative;
    animation: mpFloat 6s ease-in-out infinite;
    animation-delay: var(--mp-delay, 0s);
    will-change: transform;
}

@keyframes mpFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.mp-chip:hover {
    transform: translateY(-6px) !important;
    background: var(--cb-bg-card);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3),
                0 0 16px rgba(255, 255, 255, 0.04);
    animation-play-state: paused;
}

.mp-chip-symbol {
    font-family: var(--cb-font-display);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cb-text-primary);
    letter-spacing: 0.02em;
}

.mp-chip-price {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--cb-text-secondary);
    font-variant-numeric: tabular-nums;
}

.mp-chip-change {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
    padding: 1px 5px;
}

.mp-chip-change.mp-up {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.mp-chip-change.mp-down {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.mp-chip-change.mp-neutral {
    color: var(--cb-text-muted);
    background: rgba(255, 255, 255, 0.05);
}

/* Skeleton loading chips */
.mp-skeleton-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

.mp-chip--skeleton {
    min-width: 96px;
    height: 82px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 75%
    );
    background-size: 200% 100%;
    animation: mpShimmer 1.6s ease-in-out infinite, mpFloat 6s ease-in-out infinite;
    border-radius: var(--cb-radius-xl);
    cursor: default;
}

@keyframes mpShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Stagger skeleton animations */
.mp-chip--skeleton:nth-child(1) { animation-delay: 0s, 0s; }
.mp-chip--skeleton:nth-child(2) { animation-delay: 0.1s, 0.4s; }
.mp-chip--skeleton:nth-child(3) { animation-delay: 0.2s, 0.8s; }
.mp-chip--skeleton:nth-child(4) { animation-delay: 0.3s, 1.2s; }
.mp-chip--skeleton:nth-child(5) { animation-delay: 0.4s, 1.6s; }
.mp-chip--skeleton:nth-child(6) { animation-delay: 0.5s, 2.0s; }
.mp-chip--skeleton:nth-child(7) { animation-delay: 0.6s, 0.2s; }
.mp-chip--skeleton:nth-child(8) { animation-delay: 0.7s, 0.6s; }
.mp-chip--skeleton:nth-child(9) { animation-delay: 0.8s, 1.0s; }

/* ---------- Footer Link ---------- */
.mp-footer-link {
    text-align: center;
    margin-top: 2.5rem;
}

.mp-explore-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-text-muted);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: all var(--cb-transition-fast);
    padding: 4px 0;
    border-bottom: 1px solid transparent;
}

.mp-explore-link:hover {
    color: var(--cb-text-secondary);
    border-bottom-color: var(--cb-border-light);
}

.mp-explore-link svg {
    transition: transform var(--cb-transition-fast);
}

.mp-explore-link:hover svg {
    transform: translateX(3px);
}

/* ---------- Error state ---------- */
.mp-error {
    width: 100%;
    text-align: center;
    color: var(--cb-text-muted);
    font-size: 0.9rem;
    padding: 2rem 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .mp-section {
        padding: 4rem var(--cb-space-sm) 5rem;
    }

    .mp-chip {
        min-width: 80px;
        padding: 12px 14px;
    }

    .mp-cat {
        padding: 0.4rem 0.9rem;
        font-size: 0.8125rem;
    }
}