/* =========================================
   MindSpace V5 - Premium Stylesheet
   Rich Dark Mode + Vibrant Glassmorphism
   Full Mobile Responsive
   ========================================= */

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-glow: rgba(124, 58, 237, 0.6);
    --accent: #06b6d4;
    --accent-light: #67e8f9;
    --bg-dark: #05050f;
    --bg-surface: rgba(255, 255, 255, 0.03);
    --bg-card: rgba(20, 20, 35, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.25);
    --text: #f8fafc;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-muted: rgba(255, 255, 255, 0.45);
    --input-bg: rgba(255, 255, 255, 0.05);
    --danger: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;
    --font: 'Outfit', sans-serif;
    --radius: 20px;
    --radius-sm: 12px;
    --radius-lg: 28px;
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.6), 0 0 20px var(--primary-glow);
}

/* Theme Overrides */
body.theme-calm {
    --primary: #06b6d4;
    --primary-light: #67e8f9;
    --primary-glow: rgba(6, 182, 212, 0.4);
}

body.theme-happy {
    --primary: #f59e0b;
    --primary-light: #fbbf24;
    --primary-glow: rgba(245, 158, 11, 0.4);
}

body.theme-sad {
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-glow: rgba(139, 92, 246, 0.4);
}

body.theme-anxious {
    --primary: #10b981;
    --primary-light: #34d399;
    --primary-glow: rgba(16, 185, 129, 0.4);
}

.light-theme {
    --bg-dark: #f8fafc;
    --bg-surface: rgba(0, 0, 0, 0.02);
    --bg-card: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-hover: rgba(0, 0, 0, 0.15);
    --text: #0f172a;
    --text-secondary: rgba(0, 0, 0, 0.6);
    --text-muted: rgba(0, 0, 0, 0.4);
    --input-bg: rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.6s ease, color 0.6s ease;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- Utility Classes ---- */
.hidden {
    display: none !important;
}

.mt-2 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1.25rem;
}

.p-4 {
    padding: 1.25rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-primary {
    color: var(--primary);
}

.text-center {
    text-align: center;
}

/* ---- Keyframes ---- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-18px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

@keyframes blobMove1 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

@keyframes blobMove2 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-40px, 30px) scale(1.15);
    }

    66% {
        transform: translate(30px, -30px) scale(0.85);
    }
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes rotateOrb {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulseDanger {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    }

    70% {
        box-shadow: 0 0 0 16px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.15;
    }

    50% {
        opacity: 0.9;
    }
}

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 20px var(--primary-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--primary-glow), 0 0 60px rgba(124, 58, 237, 0.15);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-up {
    animation: slideUp 0.5s ease forwards;
}

@keyframes gaugePopBounce {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 15px var(--warning));
    }

    60% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 transparent);
    }
}

.gauge-pop {
    animation: gaugePopBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Scroll Reveal Classes */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Background ---- */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    will-change: transform;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: var(--primary);
    top: -120px;
    left: -120px;
    animation: blobMove1 22s infinite;
}

.blob-2 {
    width: 380px;
    height: 380px;
    background: var(--accent);
    bottom: -80px;
    right: -80px;
    animation: blobMove2 28s infinite;
}

.blob-3 {
    width: 280px;
    height: 280px;
    background: #ec4899;
    top: 45%;
    left: 45%;
    animation: blobMove1 35s infinite reverse;
    opacity: 0.25;
}

/* ---- Loading Screen ---- */
.screen {
    position: relative;
}

.screen.active {
    display: flex;
}

#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s;
}

.logo-container {
    text-align: center;
    animation: fadeIn 1s ease;
}

.logo-icon {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.logo-text {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-light), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.loader {
    width: 44px;
    height: 44px;
    border: 3px solid var(--glass-border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-top: 2rem;
}

/* ==================================================
   HEADER
   ================================================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.5rem;
    background: rgba(10, 10, 26, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h2 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.header-icon {
    font-size: 1.4rem;
    color: var(--primary);
    cursor: pointer;
    transition: transform 0.3s;
}

.header-icon:hover {
    transform: rotate(15deg) scale(1.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-badge {
    font-size: 0.65rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 3px 10px;
    border-radius: 14px;
    margin-left: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.xp-display,
.resilience-display {
    background: var(--bg-card);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid var(--glass-border);
    white-space: nowrap;
}

.streak-counter {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.25s;
}

.icon-btn:hover {
    background: var(--bg-card);
    transform: scale(1.1);
}

/* ==================================================
   VIEWS + LAYOUT
   ================================================== */
.view {
    padding: 1.5rem;
    max-width: 780px;
    margin: 0 auto;
}

.view.hidden {
    display: none;
}

/* ==================================================
   CARDS - The hero of glassmorphism
   ================================================== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.6rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, border-color 0.4s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: skewX(-25deg);
    transition: left 0.6s ease;
}

.card:hover::before {
    left: 200%;
}

.card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-hover);
    transform: translateY(-6px);
}

.card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

/* ==================================================
   WELCOME SECTION
   ================================================== */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.welcome-section h1 {
    font-size: 1.9rem;
    font-weight: 300;
    letter-spacing: -0.5px;
}

.welcome-section p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ==================================================
   MOOD BUTTONS
   ================================================== */
.quick-mood {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}

.mood-btn {
    font-size: 2.2rem;
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-btn:hover {
    transform: scale(1.25) translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 30px var(--primary-glow);
}

/* ==================================================
   BUTTONS (all types)
   ================================================== */
.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.secondary-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.glass-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    border-color: var(--primary);
}

/* ==================================================
   RISK GAUGE
   ================================================== */
.risk-gauge-card {
    text-align: center;
    animation: glowPulse 4s ease infinite;
}

.gauge-container {
    max-width: 240px;
    margin: 0 auto;
}

.gauge-svg {
    width: 100%;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: -8px;
    padding: 0 10px;
}

.gauge-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 0.6rem;
}

#gauge-needle {
    transition: transform 1.8s cubic-bezier(0.2, 0.8, 0.3, 1);
}

#gauge-arc {
    transition: stroke-dasharray 1.8s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* ==================================================
   RESILIENCE SCORE
   ================================================== */
.resilience-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    overflow: hidden;
}

.resilience-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
    border-radius: 10px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.resilience-info {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

/* ==================================================
   HEATMAP CALENDAR
   ================================================== */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
}

.heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

.heatmap-cell:hover {
    transform: scale(1.4);
    z-index: 3;
}

.heatmap-cell.level-0 {
    background: rgba(255, 255, 255, 0.04);
}

.heatmap-cell.level-1 {
    background: rgba(124, 58, 237, 0.2);
}

.heatmap-cell.level-2 {
    background: rgba(124, 58, 237, 0.4);
}

.heatmap-cell.level-3 {
    background: rgba(124, 58, 237, 0.65);
    box-shadow: 0 0 4px rgba(124, 58, 237, 0.3);
}

.heatmap-cell.level-4 {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.heatmap-legend .heatmap-cell {
    width: 14px;
    height: 14px;
    aspect-ratio: auto;
}

/* ==================================================
   HERO ASSESSMENT CARD
   ================================================== */
.hero-assessment {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(6, 182, 212, 0.1));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.hero-assessment:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px var(--primary-glow);
    border-color: var(--primary);
}

.hero-content h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.hero-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hero-icon {
    font-size: 2.8rem;
    color: var(--primary);
    opacity: 0.5;
    flex-shrink: 0;
}

/* ==================================================
   GOAL CARD
   ================================================== */
.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-header h3 {
    margin: 0;
}

input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==================================================
   TRIGGER INPUT
   ================================================== */
.trigger-input-row {
    display: flex;
    gap: 10px;
}

.trigger-input-row input {
    flex: 1;
}

#trigger-insights {
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--glass-border);
}

#trigger-list {
    margin-left: 0;
    color: var(--text-secondary);
    line-height: 2;
    list-style: none;
    padding: 0;
}

#trigger-list li {
    padding: 4px 0;
}

#trigger-list li::before {
    content: "→ ";
    color: var(--primary);
    font-weight: 600;
}

/* ==================================================
   HABIT BUILDER
   ================================================== */
.habit-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.habit-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    border: 1px solid transparent;
}

.habit-label:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--glass-border);
}

.habit-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: 4px;
}

/* ==================================================
   MODE CARDS
   ================================================== */
.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 1rem;
}

.mode-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.4rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mode-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.card-icon {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
}

.cbt-icon {
    color: #8b5cf6;
}

.anxiety-icon {
    color: #06b6d4;
}

.depression-icon {
    color: #ec4899;
}

.journal-icon {
    color: #f59e0b;
}

.mode-card h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.mode-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================================================
   TOOLKIT
   ================================================== */
.toolkit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.toolkit-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.toolkit-card i {
    font-size: 1.4rem;
    color: var(--primary-light);
}

.toolkit-card span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.toolkit-card:hover {
    background: rgba(124, 58, 237, 0.15);
    transform: translateY(-3px);
    border-color: var(--primary);
}

.toolkit-card.emergency-tool {
    border-color: rgba(239, 68, 68, 0.25);
}

.toolkit-card.emergency-tool:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--danger);
}

/* ==================================================
   CAROUSEL
   ================================================== */
.carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.carousel-track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 0.5rem 0;
    flex: 1;
    scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.wellness-card {
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.2rem;
    transition: all 0.3s;
    flex-shrink: 0;
}

.wellness-card:hover {
    transform: scale(1.04);
    border-color: var(--primary);
}

.wellness-card i {
    font-size: 1.4rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
    display: block;
}

.wellness-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.wellness-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.carousel-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.carousel-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* ==================================================
   STORIES
   ================================================== */
.stories-grid {
    display: grid;
    gap: 1rem;
}

.story-card {
    display: flex;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
}

.story-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
}

.story-image {
    width: 65px;
    height: 65px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    color: white;
    flex-shrink: 0;
}

.gradient-normal {
    background: linear-gradient(135deg, #10b981, #06b6d4);
}

.story-content h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.story-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================================================
   SOUND THERAPY
   ================================================== */
.sound-controls {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.sound-btn {
    font-size: 1.6rem !important;
    width: 58px;
    height: 58px;
    border-radius: 50% !important;
    background: var(--input-bg) !important;
    border: 2px solid var(--glass-border) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted) !important;
    transition: all 0.35s !important;
}

.sound-btn:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.sound-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
    color: white !important;
    border-color: transparent !important;
    box-shadow: 0 0 25px var(--primary-glow);
    transform: scale(1.12);
}

.sound-volume {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--input-bg);
    padding: 0.7rem 1rem;
    border-radius: 30px;
}

#volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    background: var(--glass-border);
    border-radius: 5px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 8px var(--primary-glow);
}

/* ==================================================
   SESSION VIEW
   ================================================== */
.session-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.session-header h2 {
    flex: 1;
    font-size: 1.2rem;
}

.progress-container {
    width: 100%;
    height: 5px;
    background: var(--glass-border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

textarea {
    width: 100%;
    min-height: 110px;
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s;
}

.option-btn:hover {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.12);
    transform: translateX(4px);
}

.option-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.assessment-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.assess-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s;
}

.assess-btn:hover {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.12);
    transform: translateX(5px);
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
}

/* ==================================================
   BREATHING ORB
   ================================================== */
.breathing-circle {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
    transition: transform 4s ease-in-out, box-shadow 4s ease-in-out;
}

.orb-3d {
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5), var(--primary) 50%, rgba(0, 0, 0, 0.5));
    box-shadow: 0 0 50px var(--primary-glow), inset 0 0 30px rgba(0, 0, 0, 0.35);
    border: none;
    position: relative;
    overflow: hidden;
}

.orb-3d span {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 2;
    position: relative;
}

.orb-3d::after {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 45%);
    animation: rotateOrb 12s linear infinite;
    pointer-events: none;
}

.breathing-circle.inhale {
    transform: scale(1.5);
    box-shadow: 0 0 80px var(--primary-glow);
}

.breathing-circle.hold {
    transform: scale(1.5);
    box-shadow: 0 0 60px rgba(6, 182, 212, 0.4);
}

.breathing-circle.exhale {
    transform: scale(1);
    box-shadow: 0 0 30px var(--primary-glow);
}

.breathing-controls {
    text-align: center;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================================================
   RESULTS BARS
   ================================================== */
.severity-section {
    margin-bottom: 1.4rem;
}

.severity-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.severity-label {
    font-weight: 700;
    font-size: 0.8rem;
    padding: 3px 12px;
    border-radius: 20px;
}

.label-normal {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.label-mild {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
}

.label-moderate {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.label-severe {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.label-extreme {
    background: rgba(220, 38, 38, 0.2);
    color: #dc2626;
}

.bar-container {
    position: relative;
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: visible;
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gradient-normal {
    background: linear-gradient(90deg, #10b981, #34d399);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.gradient-mild {
    background: linear-gradient(90deg, #06b6d4, #67e8f9);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.gradient-moderate {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.gradient-severe {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.gradient-extreme {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.bar-emoji {
    position: absolute;
    top: -22px;
    font-size: 1.2rem;
    transition: left 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    left: 0;
}

/* Plan List */
.plan-list {
    list-style: none;
    padding: 0;
}

.plan-list li {
    padding: 12px 14px;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.plan-list li:hover {
    transform: translateX(5px);
    border-color: var(--glass-border);
}

.plan-list li i {
    color: var(--primary);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.border-danger {
    border: 1px solid var(--danger) !important;
}

/* Accordion */
.accordion-item {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 0.95rem;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.accordion-header i:last-child {
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.accordion-item.active .accordion-header i:last-child {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s;
    padding: 0 14px;
}

.accordion-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.accordion-item.active .accordion-content {
    max-height: 250px;
    padding: 0 14px 14px;
}

/* ==================================================
   FLOATING PANIC BUTTON
   ================================================== */
.floating-panic-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: 40px;
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.45);
    z-index: 100;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulseDanger 2s infinite;
}

.floating-panic-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.55);
}

/* ==================================================
   PANIC IMMERSIVE SCREEN
   ================================================== */
.panic-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #1a1a3e 0%, #050510 100%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.panic-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.panic-star {
    position: absolute;
    width: 2.5px;
    height: 2.5px;
    background: white;
    border-radius: 50%;
    animation: twinkle var(--dur) ease-in-out infinite;
}

.panic-content {
    position: relative;
    z-index: 1;
    max-width: 500px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.panic-title {
    font-size: 2.2rem;
    color: #fff;
    font-weight: 300;
    text-shadow: 0 0 40px rgba(124, 58, 237, 0.6);
    line-height: 1.3;
}

.panic-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
}

.panic-orb-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.panic-orb-main {
    width: 150px;
    height: 150px;
}

.panic-steps {
    text-align: left;
    width: 100%;
}

.grounding-step {
    padding: 9px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.6s ease;
    border-left: 3px solid transparent;
}

.grounding-step.active-step {
    background: rgba(124, 58, 237, 0.15);
    color: #fff;
    border-left-color: var(--primary);
}

/* ==================================================
   MODALS
   ================================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.35s ease;
    position: relative;
}

.modal-lg {
    max-width: 820px;
}

.close-modal {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 5;
    padding: 4px;
}

.close-modal:hover {
    color: var(--text);
    transform: scale(1.15);
}

.close-story-btn {
    position: absolute;
    top: 14px;
    right: 14px;
}

.emergency-contacts {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.emergency-contacts li {
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.95rem;
}

.emergency-contacts a {
    color: var(--primary);
    text-decoration: none;
}

.emergency-contacts a:hover {
    text-decoration: underline;
}

/* Analytics Modal */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.2rem;
}

.analytics-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.analytics-card canvas {
    max-height: 200px;
}

.pattern-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(6, 182, 212, 0.05));
}

.analytics-insight-bar {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.2rem;
    text-align: center;
}

.analytics-insight-bar h3 {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Story Modal */
.story-content-modal {
    max-width: 620px;
}

.prose {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text-secondary);
}

.prose p {
    margin-bottom: 1rem;
}

.prose strong {
    color: var(--text);
}

.prose h3 {
    color: var(--text);
    margin: 1.5rem 0 0.5rem;
    font-size: 1.1rem;
}

.prose hr {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 1.5rem 0;
}

/* ==================================================
   TOAST
   ================================================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    box-shadow: 0 10px 35px var(--primary-glow);
    font-size: 0.95rem;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Section Title */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
}

/* ==================================================
   RESPONSIVE - TABLET
   ================================================== */
@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .modes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .welcome-section h1 {
        font-size: 1.5rem;
    }

    .welcome-section {
        flex-direction: column;
    }

    header {
        padding: 0.7rem 1rem;
    }

    .header-left h2 {
        font-size: 1.1rem;
    }

    .view {
        padding: 1.2rem;
    }

    .card {
        padding: 1.2rem;
    }

    .hero-content h2 {
        font-size: 1.1rem;
    }

    .hero-icon {
        font-size: 2rem;
    }

    .floating-panic-btn span {
        display: none;
    }

    .floating-panic-btn {
        padding: 16px;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        justify-content: center;
    }

    .heatmap-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .panic-title {
        font-size: 1.8rem;
    }

    .panic-orb-main {
        width: 130px;
        height: 130px;
    }

    .grounding-step {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }

    .modal-lg {
        max-width: 95%;
    }
}

/* ==================================================
   RESPONSIVE - MOBILE
   ================================================== */
@media (max-width: 480px) {
    .modes-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem;
    }

    .toolkit-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .header-right {
        gap: 6px;
    }

    .xp-display {
        font-size: 0.7rem;
        padding: 3px 7px;
    }

    .resilience-display {
        display: none;
    }

    .streak-counter {
        font-size: 0.8rem;
    }

    .level-badge {
        font-size: 0.55rem;
        padding: 2px 6px;
    }

    .view {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
        border-radius: 14px;
    }

    .welcome-section h1 {
        font-size: 1.35rem;
    }

    .quick-mood {
        gap: 10px;
    }

    .mood-btn {
        width: 48px;
        height: 48px;
        font-size: 1.8rem;
    }

    .mode-card {
        padding: 1rem;
    }

    .mode-card h3 {
        font-size: 0.9rem;
    }

    .card-icon {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .hero-assessment {
        flex-direction: column;
        text-align: center;
    }

    .hero-icon {
        display: none;
    }

    .gauge-container {
        max-width: 200px;
    }

    .heatmap-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 3px;
    }

    .sound-btn {
        width: 48px;
        height: 48px;
        font-size: 1.3rem !important;
    }

    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .wellness-card {
        min-width: 170px;
        padding: 1rem;
    }

    .panic-title {
        font-size: 1.5rem;
    }

    .panic-content {
        padding: 1rem;
    }

    .panic-orb-wrap {
        height: 160px;
    }

    .panic-orb-main {
        width: 110px;
        height: 110px;
    }

    .breathing-circle {
        width: 140px;
        height: 140px;
    }

    .question-text {
        font-size: 1.05rem;
    }

    .assess-btn {
        font-size: 0.85rem;
        padding: 12px;
    }

    .section-title {
        font-size: 0.8rem;
    }

    .story-card {
        flex-direction: column;
    }

    .story-image {
        width: 100%;
        height: 50px;
        border-radius: var(--radius-sm);
    }

    .toast {
        font-size: 0.85rem;
        padding: 12px 20px;
    }

    .trigger-input-row {
        flex-direction: column;
    }

    .trigger-input-row .primary-btn {
        width: 100%;
    }
}

/* ==================================================
   RESPONSIVE - VERY SMALL
   ================================================== */
@media (max-width: 360px) {
    .modes-grid {
        grid-template-columns: 1fr;
    }

    .header-left h2 {
        font-size: 0.95rem;
    }

    .xp-display {
        display: none;
    }

    .mood-btn {
        width: 42px;
        height: 42px;
        font-size: 1.6rem;
    }

    .welcome-section h1 {
        font-size: 1.2rem;
    }
}