@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;700;900&display=swap');

* {
    box-sizing: border-box;
}

/* --- Breathing Mode Overlay --- */
.breathing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 50000;
    /* Top of everything except mascot */
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.breathing-overlay.active {
    display: flex;
    opacity: 1;
}

.breathing-circle {
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
    margin-bottom: 40px;
    transform: scale(1);
}

.breathing-text {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 10px;
    min-height: 2em;
}

.breathing-subtext {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 40px;
}

/* Animations */
@keyframes inhale {
    0% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.2);
    }

    100% {
        transform: scale(2.5);
        background: rgba(100, 200, 255, 0.5);
        box-shadow: 0 0 60px rgba(100, 200, 255, 0.3);
    }
}

@keyframes hold {
    0% {
        transform: scale(2.5);
        background: rgba(100, 200, 255, 0.5);
    }

    50% {
        transform: scale(2.6);
    }

    /* Gentle pulse */
    100% {
        transform: scale(2.5);
        background: rgba(100, 200, 255, 0.5);
    }
}

@keyframes exhale {
    0% {
        transform: scale(2.5);
        background: rgba(100, 200, 255, 0.5);
    }

    100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Base Variables */
:root {
    --primary: #00d2ff;
    --primary-dark: #3a7bd5;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --dark: #2c3e50;
    --gray: #636e72;
    /* Darker gray for better legibility */
    --light: #f4f4f9;
    --white: #ffffff;
    --text: #1a1a1a;
    --card-bg: rgba(255, 255, 255, 0.35);
    --success: #2ecc71;
    --good: #00e676;
    /* Added for timer */
    --glass: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
    --bg-gradient: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --safe-top: env(safe-area-inset-top, 0px);

    /* 🎨 Premium Spacing & Radius */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --radius-sm: 12px;
    --radius-md: 24px;
    --radius-lg: 32px;

    /* 💎 Refined Glass */
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    --blur-strength: 20px;
}

/* DARK MODE VARIABLES */
[data-theme="dark"] {
    --primary: #00d2ff;
    --primary-dark: #3a7bd5;
    --danger: #ff5e57;
    --danger-dark: #ff3b2f;
    --dark: #f5f6fa;
    --gray: #a4b0be;
    --light: #1e272e;
    --white: #2f3542;
    --text: #e1e2e6;
    --card-bg: rgba(20, 26, 31, 0.65);
    --success: #7bed9f;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --bg-gradient: linear-gradient(135deg, #0f1418 0%, #1e272e 100%);

    /* 💎 Dark Mode Glass */
    --glass-bg: rgba(15, 24, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 15px 45px rgba(0, 0, 0, 0.4);
}

html {
    /* height: 100%; Removed - can conflict with scrolling */
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Outfit', sans-serif;
    text-align: center;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    padding: 0;
    margin: 0;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
    /* This stays to prevent micro-oscillations */
    opacity: 1;
    /* Forced to 1 to fix blank screen */
    transition: opacity 0.3s ease-in-out;
    line-height: 1.6;
    /* Increased for readability */
}

/* 📏 Golden Ratio Typography */
h1 {
    font-size: 2.8rem;
    /* Bumped from 2.5rem */
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.04em;
    color: var(--primary-dark);
    text-shadow: 0 2px 10px rgba(58, 123, 213, 0.15);
    /* Subtle depth */
}

h2 {
    font-size: 1.6rem;
    /* ~25px */
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.2rem;
    /* ~19px */
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

p,
span,
div {
    font-size: 1rem;
    /* Base 16px */
}

small,
.small-text {
    font-size: 0.875rem;
    /* 14px */
}

.card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(30px);
    /* Increased blur */
    backdrop-filter: blur(30px);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    /* Stronger shadow */
    margin-bottom: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
    /* More visible border */
    max-width: 100%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    /* Smooth transition for hover effects if added later */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* TABLET & LANDSCAPE OPTIMIZATIONS */
@media (min-width: 768px) {
    .card {
        max-width: 800px;
        padding: 40px;
    }

    .stat-card-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    body {
        padding: 10px;
    }

    .card {
        max-width: 95%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
        align-items: flex-start;
        justify-content: center;
    }

    h1 {
        width: 100%;
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .timer-shell {
        width: 180px !important;
        height: 180px !important;
    }

    .stat-box,
    .stat-card-grid,
    .evo-plan-card,
    .reward-card {
        flex: 1;
        min-width: 300px;
    }
}



/* NEW: Dark Mode Toggle */
.theme-toggle {
    position: fixed;
    top: calc(20px + var(--safe-top));
    left: 20px;
    z-index: 10001;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-size: 1.2rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn {
    width: 100%;
    padding: 0;
    /* Clear padding */
    height: 56px;
    /* 👆 48px min + extra for prominence */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: white;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.95);
}

.btn-good {
    background: linear-gradient(135deg, #27ae60, #2980b9);
    /* Deeper colors for better contrast */
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-smoke {
    background: linear-gradient(135deg, var(--danger), #e67e22);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.2);
}

.btn-neutral {
    background: var(--dark);
    color: var(--white);
    border: 1px solid var(--glass-border);
}

.btn-danger-soft {
    background: transparent;
    color: #ff5e57;
    border: 1px solid #ff5e57;
    font-size: 0.8rem;
    padding: 10px;
}

.btn-undo {
    background: transparent;
    color: var(--gray);
    text-decoration: underline;
    font-size: 0.85rem;
    padding: 5px;
}

.hidden {
    display: none;
}

/* Timer Circular UI */
.timer-shell {
    position: relative;
    width: 320px;
    /* Increased from 220px to fit 5.5rem text */
    height: 320px;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    /* Ensure no clipping */
}

.timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-track {
    fill: none;
    stroke: rgba(0, 0, 0, 0.05);
    stroke-width: 10;
}

.timer-bar-circle {
    fill: none;
    stroke: url(#grad1);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    /* Corrected: was row */
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Game Close Button Style */
.game-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    padding: 5px;
    cursor: pointer;
    color: var(--text);
    /* Safe default */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

[data-theme="dark"] .game-close-btn {
    color: #fff;
}

.game-close-btn:active {
    transform: scale(0.9);
}

#timer,
#analysis-timer-display {
    font-size: 4.2rem;
    /* Adjusted from 5.5rem to fit screen */
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    letter-spacing: -1px;
    filter: drop-shadow(0 4px 15px rgba(0, 210, 255, 0.3));
    /* Premium Glow */
    line-height: 1.2;
    padding: 5px 10px 10px 10px;
    /* Space for shadow and to prevent clipping */
}

select {
    padding: 15px;
    font-size: 1rem;
    margin-bottom: 15px;
    width: 100%;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    background: white;
    font-weight: 700;
    appearance: none;
}

.input-field {
    width: 100%;
    box-sizing: border-box;
    padding: 0 16px;
    height: 52px;
    /* 👆 Min 48px */
    line-height: normal;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    /* Lighter glass */
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 500;
    transition: 0.3s;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}


.input-field:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.2);
}

[data-theme='dark'] .input-field:focus {
    background: rgba(255, 255, 255, 0.1);
}

.stat-box b {
    color: var(--primary-dark);
    font-size: 1.1rem;
}

/* Advanced Dynamic Charts */
.chart-container-v2 {
    position: relative;
    padding: 20px 0;
}

.chart-bar-v2 {
    background: linear-gradient(to top, var(--primary-dark), var(--primary));
    border-radius: 8px 8px 0 0;
    position: relative;
    transition: height 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 12px;
}

.chart-bar-v2::before {
    content: attr(data-val);
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--primary-dark);
    opacity: 1;
}


.chart-labels-v2 {
    display: flex;
    justify-content: space-around;
    width: 100%;
    font-size: 0.65rem;
    color: var(--primary-dark);
    font-weight: 800;
    margin-top: 10px;
    text-transform: uppercase;
}

.axis-marker {
    position: absolute;
    bottom: -15px;
    font-size: 0.55rem;
    color: var(--gray);
    font-weight: 900;
    transform: translateX(-50%);
}

.axis-y-label {
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-size: 0.5rem;
    color: var(--gray);
    font-weight: 900;
    white-space: nowrap;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.heatmap-cell {
    height: 40px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gray);
    transition: 0.5s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    cursor: default;
}

.heatmap-cell.hot {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #d63031;
    box-shadow: 0 4px 10px rgba(255, 154, 158, 0.3);
    animation: pulse-glow 2s infinite;
    border: none;
}

.heatmap-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: bold;
    text-transform: uppercase;
}

/* Achievement Progress Bars */
.ach-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.ach-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.ach-progress-text {
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 2px;
    text-align: right;
    display: block;
}

.galeria-badge.locked {
    filter: grayscale(1);
    opacity: 0.7;
}

.galeria-badge.unlocked {
    background: var(--glass);
    border: 1px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.galeria-badge.unlocked .badge-icon {
    transform: scale(1.1);
}

.heatmap-legend span {
    flex: 1;
    text-align: center;
    padding: 5px;
    border-radius: 8px;
    background: var(--glass);
    margin: 0 2px;
}

.heatmap-info {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 15px;
    text-align: left;
}

@keyframes pulse-glow {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.8;
    }
}

.btn-disabled-sleep {
    filter: grayscale(100%) !important;
    opacity: 0.5 !important;
    cursor: not-allowed;
}

.evo-svg {
    width: 100%;
    height: 150px;
    overflow: visible;
}

.path-baseline {
    stroke: #ff9f43;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 4;
    opacity: 0.6;
}

.path-ideal {
    stroke: var(--gray);
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 6;
    opacity: 0.4;
}

.path-real {
    stroke: var(--primary-dark);
    stroke-width: 4;
    fill: url(#area-grad);
    stroke-linecap: round;
    transition: 1s;
}

.chart-legend-v2 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
    /* Reduced from 20px to tighten layout */
    font-size: 0.65rem;
    font-weight: 800;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

/* Achievements System */
.medals-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    cursor: pointer;
}

.medal-icon {
    width: 45px;
    height: 45px;
    background: var(--glass);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    filter: grayscale(1);
    opacity: 0.3;
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--glass-border);
    position: relative;
}

.medal-icon.active {
    filter: grayscale(0);
    opacity: 1;
    transform: scale(1.1);
    background: white;
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.medal-icon::after {
    content: attr(data-label);
    position: absolute;
    bottom: -22px;
    font-size: 0.5rem;
    font-weight: 900;
    color: var(--gray);
    white-space: nowrap;
    opacity: 1;
    text-transform: uppercase;
    width: 100%;
    text-align: center;
    pointer-events: none;
}

.medal-icon.active::after {
    color: var(--primary-dark);
}

.medal-desc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 15px;
    text-align: left;
}

.medal-desc-icon {
    font-size: 1.8rem;
    min-width: 40px;
}

.medal-desc-text h4 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--primary-dark);
}

.medal-desc-text p {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: #555;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 20px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--white);
    color: var(--text);
    padding: 25px;
    border-radius: var(--radius-md);
    width: 95%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay .card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--blur-strength));
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.modal-overlay.active {
    display: flex !important;
}

#breath-circle {
    width: 120px;
    height: 120px;
    background: var(--primary);
    border-radius: 50%;
    margin: 30px auto;
    transition: 4s ease-in-out;
    opacity: 0.6;
    border: 5px solid white;
    box-shadow: 0 0 30px var(--primary);
}

.milestone-card {
    background: var(--glass);
    padding: 12px;
    border-radius: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    border: 1px solid var(--glass-border);
}

.milestone-icon {
    font-size: 1.4rem;
}

.quote-card {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 20px;
    border-radius: 25px;
    margin: 20px 0;
    font-style: italic;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 210, 255, 0.2);
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Mascote Vidu Styles */
/* Mascote Vidu Styles - NOW FLOATING */
#vidu-container {
    position: fixed;
    top: calc(20px + var(--safe-top));
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: fit-content;
    max-width: 350px;
    /* Widened from 300px */
    z-index: 10000;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s;
}

#vidu-container.dragging {
    cursor: grabbing;
    transition: none;
}

#vidu-container.hidden-vidu {
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5);
}

.vidu-mascot {
    width: 70px;
    height: 70px;
    /* Scale down by 20% (approx 56px) but keep coordinate system for accessories */
    /* Margin negative to reduce empty layout space around scaled element */
    margin: -7px;
    filter: drop-shadow(0 4px 12px rgba(255, 152, 0, 0.5)) drop-shadow(0 0 20px rgba(255, 87, 34, 0.3));
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: floatingVidu 4s ease-in-out infinite;
}

#vidu-eye-l,
#vidu-eye-r {
    animation: blinkVidu 5s infinite;
    transform-origin: center;
}

@keyframes floatingVidu {

    0%,
    100% {
        transform: translateY(0) scale(0.8);
    }

    50% {
        transform: translateY(-8px) scale(0.8);
    }
}

@keyframes blinkVidu {

    0%,
    90%,
    100% {
        transform: scaleY(1);
    }

    95% {
        transform: scaleY(0.1);
    }
}

.vidu-bubble {
    background: rgba(255, 255, 255, 0.65);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    padding: 12px 18px;
    border-radius: 20px;
    border-bottom-left-radius: 2px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    text-align: left;
    flex: 1;
    min-width: 220px;
    /* Ensure it's not too narrow */
    border: 1px solid rgba(255, 255, 255, 0.4);
    animation: popIn 0.5s ease;
}

/* --- VIDU ANIMATIONS --- */
@keyframes viduFloat {
    0%, 100% { transform: translateY(0) translateZ(0); }
    50% { transform: translateY(-5px) translateZ(0); }
}

@keyframes viduBlink {

    0%,
    96%,
    100% {
        opacity: 1;
        transform: scaleY(1);
    }

    98% {
        opacity: 0.8;
        transform: scaleY(0.1);
    }
}

@keyframes viduShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px) rotate(-5deg);
    }

    75% {
        transform: translateX(5px) rotate(5deg);
    }
}

@keyframes viduBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* VIDU STORE STYLES */
.store-modal {
    text-align: center;
}

.store-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s;
}

.store-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-store-buy {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
    width: 100%;
}

.btn-store-buy.disabled {
    background: var(--gray);
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-store-use {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
    width: 100%;
}

.btn-store-equipped {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.9;
    font-size: 0.8rem;
    width: 100%;
    transition: filter 0.2s, transform 0.1s;
}

.btn-store-equipped:hover {
    filter: brightness(1.2);
}

.btn-store-equipped:active {
    transform: scale(0.98);
}

/* Store Toggle Button */
.store-toggle {
    position: fixed;
    top: calc(70px + var(--safe-top));
    right: 20px;
    z-index: 10001;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-size: 1.2rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

@keyframes viduPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.vidu-container {
    position: relative;
    /* transition: all 0.3s ease; */
}

.vidu-mascot {
    transition: transform 0.3s ease;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    filter: drop-shadow(0 0 10px rgba(255, 152, 0, 0.4));
    -webkit-filter: drop-shadow(0 0 10px rgba(255, 152, 0, 0.4));
}

/* Animation Classes */
.vidu-float {
    animation: viduFloat 3s ease-in-out infinite;
}

.vidu-shake {
    animation: viduShake 0.5s ease-in-out;
}

.vidu-bounce {
    animation: viduBounce 0.5s ease-in-out;
}

.vidu-pulse {
    animation: viduPulse 2s infinite;
}

/* Face Blinking */
.vidu-mascot img.vidu-face {
    transform-origin: center;
}

.vidu-blink {
    animation: viduBlink 4s infinite;
}

[data-theme='dark'] .vidu-bubble {
    background: rgba(30, 30, 40, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.vidu-bubble::after {
    content: '';
    position: absolute;
    left: -10px;
    bottom: 0;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-right: 15px solid var(--white);
    border-bottom: 0 solid transparent;
}

.vidu-widget-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    min-width: 120px;
}

.vidu-widget-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 210, 255, 0.2);
    transition: 0.2s;
}

.vidu-widget-btn:active {
    transform: scale(0.9);
}

.vidu-widget-timer {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary-dark);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.vidu-pulse {
    animation: viduPulse 2s infinite ease-in-out;
}

@keyframes viduPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* NEW: Sleep Mode & Rewards UI */
.btn-sleep {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
}

.btn-sleep.active {
    background: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
}

/* Sleep Stats Visibility */
.sleep-stats-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text);
    opacity: 0.9;
    padding: 0 15px;
    margin-top: -5px;
    gap: 2px;
}

.sleep-stats-display span {
    font-weight: 600;
}

[data-theme='dark'] .sleep-stats-display {
    color: var(--gray);
}

.btn-sleep-edit {
    background: none;
    border: none;
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 0.75rem;
    padding: 8px 15px;
    text-decoration: underline;
    cursor: pointer;
    transition: 0.2s;
}

.btn-sleep-edit:active {
    transform: scale(0.95);
}

.reward-card {
    background: var(--glass);
    padding: 15px;
    border-radius: 25px;
    margin-top: 15px;
    text-align: left;
    border: 1px solid var(--glass-border);
    color: var(--text);
    /* FIXED COLOR */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    box-sizing: border-box;
}

.reward-progress-bg {
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    margin: 10px 0;
    overflow: hidden;
}

[data-theme='dark'] .reward-progress-bg {
    background: rgba(255, 255, 255, 0.1);
}

.reward-progress-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: 1s;
}

.trigger-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.trigger-item {
    padding: 12px;
    background: var(--glass);
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: 0.2s;
}

.trigger-item:active {
    transform: scale(0.95);
}

/* NEW: Refactoring inline styles */
.card-privacy {
    max-width: 450px;
    text-align: left;
    max-height: 80vh;
    overflow-y: auto;
}

.card-setup {
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
    width: 90%;
}

.btn-import {
    padding: 12px;
    font-size: 0.85rem;
    margin-top: 10px;
    border-radius: 18px;
}

.privacy-box {
    display: flex;
    align-items: center;
    margin: 15px 0;
    text-align: left;
}

.privacy-check {
    width: 20px;
    height: 20px;
}

.privacy-label {
    margin-left: 10px;
    font-size: 0.8rem;
}

.analysis-btn-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-smoke-main {
    margin: 0;
    flex: 2;
}

.btn-undo-small {
    margin: 0;
    flex: 1;
    background: rgba(44, 62, 80, 0.1);
    /* Darker translucent for light theme */
    color: var(--dark);
    /* High contrast text */
    border: 1px solid rgba(44, 62, 80, 0.2);
    font-size: 0.9rem;
    padding: 10px;
    font-weight: 700;
}

[data-theme='dark'] .btn-undo-small {
    background: rgba(255, 255, 255, 0.1);
    /* Lighter translucent for dark theme */
    color: var(--text);
    /* High contrast text */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.linear-chart-box {
    width: 100%;
    margin-top: 20px;
    padding: 10px 10px 25px 25px;
    /* ADJUSTED PADDING */
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    display: none;
    position: relative;
    overflow: hidden;
    /* PROTECT AGAINST OVERFLOW */
}

.linear-chart-title {
    font-size: 0.8rem;
    color: var(--primary-dark);
    text-align: left;
    font-weight: 900;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}

.linear-chart-svg {
    width: 100%;
    height: 60px;
    overflow: visible;
}

.chart-multi-day {
    display: flex;
    height: 120px;
    align-items: flex-end;
    justify-content: space-around;
    margin: 30px 0 10px;
    border-bottom: 2px solid var(--glass-border);
    padding: 0 5px;
    /* ADDED INTERNAL PADDING */
}

.btn-export-small {
    padding: 12px;
    font-size: 0.85rem;
    margin-top: 10px;
    border-radius: 15px;
}

.medals-row-container {
    cursor: pointer;
    z-index: 100;
}

.sos-btn {
    font-size: 0.8rem;
    margin-top: 20px;
    border-radius: 15px;
}

#screen-setup,
#screen-analysis,
#screen-wean {
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

#screen-wean>* {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.evo-plan-card {
    background: var(--glass);
    padding: 20px 20px 15px 20px;
    /* Reduced bottom padding */
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    margin-top: 20px;
    margin-bottom: 5px;
    /* Pull the next card closer */
    max-width: 100%;
    overflow: hidden;
    /* Prevents chart leakage */
    box-sizing: border-box;
}

.evo-plan-title {
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.small-blueprint {
    padding: 10px !important;
    border: 1px solid rgba(0, 210, 255, 0.1) !important;
}

.small-blueprint .analysis-metric-label {
    font-size: 0.55rem;
    margin-bottom: 2px;
}

.small-blueprint .analysis-metric-val {
    font-size: 0.8rem;
}

.highlight-metric {
    color: var(--success) !important;
    font-family: 'Courier New', Courier, monospace;
}

/* --- PREMIUM UI UPGRADES --- */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.btn-pulse-glow {
    position: relative;
    overflow: visible;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-pulse-glow::before {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    bottom: -4px;
    left: -4px;
    background: inherit;
    border-radius: inherit;
    z-index: -1;
    opacity: 0.6;
    filter: blur(12px);
    animation: pulseGlow 2s ease-in-out infinite alternate;
}

.btn-pulse-glow:active {
    transform: scale(0.95);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

@keyframes pulseGlow {
    0% {
        opacity: 0.5;
        filter: blur(8px);
        transform: scale(0.98);
    }

    100% {
        opacity: 0.8;
        filter: blur(15px);
        transform: scale(1.02);
    }
}

.analysis-metric-card {
    /* REMOVED: conflicting background to keep original colors
    background: rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    */
    border-radius: 20px;
    padding: 18px 10px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Add a subtle highlight layer without overriding base color */
.analysis-metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    opacity: 0.5;
}

.analysis-metric-card:hover,
.analysis-metric-card:active {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1);
}

[data-theme='dark'] .analysis-metric-card::after {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
}

[data-theme='dark'] .analysis-metric-card:hover {
    filter: brightness(1.2);
}

/* -------------------------- */

.mini-load-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
    overflow: hidden;
    margin: 4px 0;
}

.mini-load-bar-fill {
    height: 100%;
    background: var(--warning);
    width: 0%;
    transition: width 1s ease;
}

.analysis-status-report {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--gray);
    text-align: left;
}

[data-theme='dark'] .analysis-status-report {
    background: rgba(255, 255, 255, 0.02);
}

.status-dot-pulse {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(0, 210, 255, 0.4);
    animation: pulsedot 2s infinite;
}

@keyframes pulsedot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(0, 210, 255, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 210, 255, 0);
    }
}

.analysis-prognosis-box {
    background: rgba(0, 210, 255, 0.05);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.analysis-prognosis-box h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prognosis-wean-info {
    background: rgba(0, 0, 0, 0.03);
    border-left: 3px solid var(--primary);
    padding: 10px;
    font-size: 0.8rem;
    color: var(--text);
    border-radius: 4px;
}

[data-theme='dark'] .prognosis-wean-info {
    background: rgba(255, 255, 255, 0.05);
}

.evo-labels-row {
    position: relative;
    margin-top: -10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
}

.btn-export-main {
    padding: 12px;
    font-size: 0.85rem;
    margin-top: 20px;
    border-radius: 15px;
}

.reward-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reward-price-text {
    font-weight: 900;
    color: var(--success);
    font-size: 0.9rem;
}

.reward-msg-small {
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 700;
}

.sleep-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-sleep-inner {
    margin: 0;
    flex: 1;
    font-size: 0.9rem;
}

.btn-relapse-inner {
    margin: 0;
    flex: 1;
    font-size: 0.9rem;
    background: #636e72;
}

.modal-card-panic {
    max-width: 400px;
    text-align: center;
}

.panic-timer-text {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    margin: 10px 0;
}

.breath-instruction-text {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.panic-finish-box {
    display: none;
    margin-top: 20px;
}

.modal-card-triggers {
    max-width: 400px;
}

.milestone-container {
    margin-top: 20px;
    text-align: left;
}

.milestone-title {
    font-size: 0.7rem;
    color: var(--gray);
}

.profile-card {
    background: var(--glass);
    padding: 15px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

/* NEW: Analysis Stat Cards */
.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 310px) {
    .stat-card-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        /* Stack only on extremely tiny early-era screens */
    }
}

.stat-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 20px;
    text-align: left;
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card span {
    font-size: 0.65rem;
    font-weight: 900;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card b {
    display: block;
    font-size: 1.2rem;
    color: var(--primary-dark);
    margin-top: 5px;
}

.chart-labels-v2 {
    display: flex;
    justify-content: space-around;
    width: 80%;
    margin: -10px auto 20px;
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 900;
}

/* Inventory Styles */
.rewards-inventory-row {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 5px;
    margin-bottom: 10px;
    /* Esconder scrollbar mas permitir scroll */
    scrollbar-width: none;
}

.rewards-inventory-row::-webkit-scrollbar {
    display: none;
}

.achievement-badge {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #d35400;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* NEW: Reward Gallery Styles */
.reward-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.reward-card-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    /* Glass soft */
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 10px;
    position: relative;
    transition: 0.3s;
    overflow: hidden;
}

.reward-card-item.locked {
    filter: grayscale(100%);
    opacity: 0.6;
}

.reward-card-item.unlocked {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid var(--success);
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.1);
}

.reward-icon-box {
    font-size: 1.8rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    margin-right: 12px;
}

.reward-info-box {
    flex: 1;
    text-align: left;
}

.reward-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.reward-cost {
    font-size: 0.8rem;
    color: var(--primary-dark);
    opacity: 0.8;
}

.reward-badge-conquered {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--success);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Barra de Saldo Global */
.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass);
    padding: 10px 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--glass-border);
}

.wallet-label {
    font-size: 0.8rem;
    color: var(--gray);
    font-weight: 700;
}

.wallet-value {
    font-size: 1.1rem;
    color: var(--success);
    font-weight: 800;
}

/* ========== COMMUNITY CHAT STYLES ========== */
.community-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 1000;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.community-fab:active {
    transform: scale(0.95);
}

/* HEALTH TIMELINE CSS */
.health-timeline {
    position: relative;
    padding: 20px 0 20px 20px;
    border-left: 3px solid rgba(0, 0, 0, 0.1);
    margin-left: 10px;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 20px;
    opacity: 0.5;
    transition: 0.3s;
}

.timeline-item.completed {
    opacity: 1;
}

.timeline-item.active {
    opacity: 1;
    transform: scale(1.02);
}

.timeline-dot {
    position: absolute;
    left: -29px;
    top: 0;
    width: 16px;
    height: 16px;
    background: var(--gray);
    border: 3px solid var(--bg);
    border-radius: 50%;
    z-index: 2;
}

.timeline-item.completed .timeline-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

.timeline-item.active .timeline-dot {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    animation: pulse-dot 2s infinite;
}

.timeline-time {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 5px;
    display: block;
}

.timeline-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text);
}

.timeline-desc {
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.4;
}

@keyframes pulse-dot {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

.community-fab .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 800;
}

.modal-community {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
    padding: 20px;
}

.modal-community-content {
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 500px;
    height: 90vh;
    /* Taller */
    max-height: 90vh;
    border-radius: 25px 25px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}

.modal-overlay .card {
    background: var(--glass-bg) !important;
    -webkit-backdrop-filter: blur(var(--blur-strength)) !important;
    backdrop-filter: blur(var(--blur-strength)) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-community-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-community-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--dark);
}

.modal-community-close {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    font-size: 1.2rem;
    color: var(--dark);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.modal-community-close:active {
    transform: scale(0.9);
}

.community-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
}

.community-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: 0.3s;
    border-bottom: 3px solid transparent;
}

.community-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.community-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Changed to 0 so lists handle padding */
    display: none;
    overflow: hidden;
    height: 100%;
    /* Ensure it takes full available height */
    /* Prevent nested scrolling */
}

.community-content.active {
    display: flex;
    /* Ensure flex is applied when active */
    flex-direction: column;
    flex: 1;
}

/* ========== COMMUNITY CHAT & MURAL REDESIGN ========== */

.chat-messages-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Tighter gap for better grouping */
    overflow-y: auto;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
}

.chat-message-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 85%;
    align-self: flex-start;
    margin-bottom: 4px;
}

.chat-message-wrapper.is-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message-wrapper.is-consecutive {
    margin-top: -6px;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 2px;
    /* Slight lift */
    border: 2px solid white;
    /* Keyline */
}

.chat-message {
    background: white;
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
}

.chat-message-wrapper.is-mine .chat-message {
    background: var(--primary);
    /* Keep primary for consistency */
    color: white;
    border-radius: 18px 18px 4px 18px;
    /* Tail bottom-right */
    box-shadow: 0 2px 5px rgba(var(--primary-rgb), 0.3);
}

.chat-message::before {
    display: none !important;
    content: none !important;
    border: none !important;
}

.chat-message {
    border-left: none !important;
}

.chat-message-wrapper.is-consecutive .chat-message {
    border-radius: 18px !important;
}

.chat-message-header {
    margin-bottom: 4px;
}

.chat-message-author {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.is-mine .chat-message-author {
    color: rgba(255, 255, 255, 0.9);
}

.chat-message-text {
    font-size: 0.92rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    gap: 15px;
}

.chat-message-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    opacity: 0.7;
}

.is-mine .chat-message-info {
    color: rgba(255, 255, 255, 0.8);
}

.chat-message-time {
    white-space: nowrap;
}

/* Actions Dropdown */
.more-actions-dropdown {
    position: relative;
}


/* Dark Mode Chat Overrides */
[data-theme="dark"] .chat-message-wrapper:not(.is-mine) .chat-message {
    background: #1e272e;
    color: #ecf0f1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .chat-message-author {
    color: var(--primary);
}

[data-theme="dark"] .chat-message-info {
    color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .is-mine .chat-message {
    background: var(--primary-dark);
    color: white;
}

[data-theme="dark"] .msg-menu-content {
    background: #2c3e50;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .msg-menu-content button {
    color: #ecf0f1;
}

[data-theme="dark"] .msg-menu-content button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Dark Mode Mural Overrides */
[data-theme="dark"] .mural-card {
    background: #1e272e;
    color: #ecf0f1;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .mural-card-text {
    color: #bdc3c7;
}

[data-theme="dark"] .mural-card-author {
    color: var(--primary);
}

[data-theme="dark"] .mural-quote-icon {
    color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .mural-card-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}


.msg-menu-content {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 5px;
    z-index: 100;
    min-width: 140px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.is-mine .msg-menu-content {
    left: 0;
    right: auto;
}

.msg-menu-content.active {
    display: block;
    animation: slideUp 0.2s ease;
}

.msg-menu-content button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    color: #333;
}

.msg-menu-content button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.action-btn-small {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.5;
    font-size: 1.1rem;
}

.chat-message:hover .action-btn-small {
    opacity: 1;
}

/* Mural Cards */
.mural-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-left: 4px solid var(--primary);
}

.mural-card.is-mine {
    border-left-color: var(--success);
}

.mural-card-body {
    position: relative;
}

.mural-quote-icon {
    position: absolute;
    top: -10px;
    left: -5px;
    font-size: 2rem;
    opacity: 0.1;
    font-family: serif;
}

.mural-card-text {
    font-size: 1rem;
    line-height: 1.5;
    font-style: italic;
    color: #333;
}

.mural-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.mural-card-author {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.7;
}

.mural-card-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mural-like-btn {
    background: rgba(255, 71, 87, 0.05);
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mural-like-btn.liked {
    background: rgba(255, 71, 87, 0.15);
}

@keyframes slideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.translate-btn {
    background: none;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 8px;
    opacity: 0.6;
    transition: 0.2s;
}

.translate-btn:hover {
    opacity: 1;
    background: var(--glass);
}

.translate-btn:disabled {
    cursor: wait;
    opacity: 0.4;
}

.translation-text {
    font-size: 0.85rem;
    color: var(--primary-dark);
    background: rgba(102, 126, 234, 0.08);
    padding: 8px 10px;
    border-radius: 8px;
    margin-top: 6px;
    border-left: 3px solid var(--primary);
    font-style: italic;
}

.translation-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.7;
}

.chat-input-row,
.mural-input-row {
    padding: 10px 15px;
    background: var(--card-bg);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 10;
    flex-shrink: 0;
    /* Prevent input from shrinking/moving */
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    font-size: 0.9rem;
    background: var(--glass);
    color: var(--text);
}

.chat-send-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
}

/* Mural Posts */
.mural-posts-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    /* -webkit-overflow-scrolling: touch; */
}

.mural-post {
    background: var(--glass);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    transition: 0.3s;
}

.mural-post.is-mine {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.mural-post-text {
    font-size: 1rem;
    color: var(--text);
    font-style: italic;
    margin-bottom: 10px;
}

.mural-post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mural-post-author {
    font-size: 0.75rem;
    color: var(--gray);
}

.mural-like-btn {
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mural-like-btn.liked {
    color: #e74c3c;
}

.mural-input-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--glass-border);
}

.mural-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    font-size: 0.9rem;
    background: var(--glass);
    color: var(--text);
}

.mural-post-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
}

.community-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.community-empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.community-user-name {
    font-size: 0.8rem;
    color: var(--gray);
    text-align: center;
    padding: 10px;
    background: var(--glass);
    border-radius: 10px;
    margin-bottom: 10px;
}

/* Emoji Picker Styles */
.emoji-picker-container {
    position: relative;
    display: inline-block;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
}

.emoji-btn:hover {
    background: var(--glass);
}

.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 10px;
    display: none;
    flex-wrap: wrap;
    gap: 5px;
    width: 220px;
    max-height: 150px;
    overflow-y: auto;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.emoji-picker.active {
    display: flex;
}

.emoji-picker span {
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    transition: 0.2s;
}

.emoji-picker span:hover {
    background: var(--glass);
    transform: scale(1.2);
}

.chat-input-row,
.mural-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========== MODERATION STYLES ========== */
.community-user-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--glass);
    border-radius: 10px;
    margin-bottom: 10px;
}

.edit-name-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: 0.2s;
}

.edit-name-btn:hover {
    background: var(--glass-border);
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-btn {
    background: none;
    border: none;
    font-size: 0.5rem;
    color: var(--gray);
    cursor: pointer;
    padding: 2px 5px;
    opacity: 0.5;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    border-radius: 5px;
}

.report-btn-icon {
    font-size: 0.9rem;
}

.report-btn-text {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-btn:hover {
    opacity: 1;
    color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

/* Report Confirmation Modal */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3500;
}

.report-modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    text-align: center;
}

.report-modal-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.report-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

.report-modal-author {
    color: var(--primary);
    font-weight: 600;
}

.report-modal-warning {
    font-size: 0.8rem;
    color: var(--gray);
    margin: 15px 0;
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 10px;
}

.report-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.report-modal-btns button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}

.report-cancel-btn {
    background: var(--glass);
    color: var(--text);
}

.report-confirm-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.banned-alert {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 15px;
}

.banned-alert-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.profanity-warning-toast {
    background: rgba(255, 121, 121, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    position: absolute;
    bottom: 70px;
    /* Above the input row */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s ease;
}

.edit-name-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.edit-name-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    text-align: center;
}

.edit-name-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    font-size: 1rem;
    background: var(--glass);
    color: var(--text);
    margin: 15px 0;
}

.edit-name-btns {
    display: flex;
    gap: 10px;
}

.edit-name-btns button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
}

.edit-name-save {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.edit-name-cancel {
    background: var(--glass);
    color: var(--text);
}

.report-count {
    font-size: 0.7rem;
    color: var(--danger);
    margin-left: 3px;
}

.badge-tu {
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 5px;
    font-weight: 800;
    text-transform: uppercase;
}

/* Settings Toggle Button */
.settings-toggle {
    position: absolute;
    top: calc(15px + var(--safe-top));
    right: 15px;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 9999;
    opacity: 0.8;
    transition: transform 0.3s;
}

.settings-toggle:hover {
    transform: rotate(90deg);
    opacity: 1;
}

/* Android Style Slider Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

/* Extended Utilities */
.cursor-pointer {
    cursor: pointer;
}

.opacity-90 {
    opacity: 0.9;
}

.opacity-80 {
    opacity: 0.8;
}

.opacity-50 {
    opacity: 0.5;
}

.font-600 {
    font-weight: 600;
}

.font-700 {
    font-weight: 700;
}

.font-800 {
    font-weight: 800;
}

.underline {
    text-decoration: underline;
}

.relative {
    position: relative;
}

.absolute-top-right {
    position: absolute;
    top: 0;
    right: 0;
}

.text-right {
    text-align: right;
}

.text-xs-mono {
    font-family: monospace;
    font-size: 0.6rem;
}

.text-sm-mono {
    font-family: monospace;
    font-size: 0.75rem;
}

.text-xs {
    font-size: 0.7rem;
}

.text-sm {
    font-size: 0.8rem;
}

.mb-5 {
    margin-bottom: 5px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-12 {
    margin-bottom: 12px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-5 {
    margin-top: 5px;
}

.mt-10 {
    margin-top: 10px;
}

.p-10 {
    padding: 10px;
}

.p-15 {
    padding: 15px;
}

.flex-2 {
    flex: 2;
}

.justify-between {
    justify-content: space-between;
}

.color-primary {
    color: var(--primary);
}

.color-danger {
    color: var(--danger);
}

.color-gray {
    color: #636e72;
    /* Even darker gray for perfect accessibility */
}

.bg-glass {
    background: rgba(255, 255, 255, 0.2);
}

.backdrop-blur-10 {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.border-radius-20 {
    border-radius: 20px;
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bg-white-15 {
    background: rgba(255, 255, 255, 0.15);
}

.text-xl {
    font-size: 1.2rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.text-4xl {
    font-size: 4rem;
}

.shadow-text-sm {
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

/* Achievements System */
.medals-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    cursor: pointer;
}

.medal-icon {
    width: 45px;
    height: 45px;
    background: var(--glass);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    filter: grayscale(1);
    opacity: 0.3;
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--glass-border);
    position: relative;
}

.medal-icon.active {
    filter: grayscale(0);
    opacity: 1;
    transform: scale(1.1);
    background: white;
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.medal-icon::after {
    content: attr(data-label);
    position: absolute;
    bottom: -22px;
    font-size: 0.5rem;
    font-weight: 900;
    color: var(--gray);
    white-space: nowrap;
    opacity: 1;
    text-transform: uppercase;
    width: 100%;
    text-align: center;
    pointer-events: none;
}

.medal-icon.active::after {
    color: var(--primary-dark);
}

.medal-desc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 15px;
    text-align: left;
}

.medal-desc-icon {
    font-size: 1.8rem;
    min-width: 40px;
}

.medal-desc-text h4 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--primary-dark);
}

.medal-desc-text p {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: #555;
}

/* FIX: Force Modals to stack vertically even in landscape */
.modal-overlay .card {
    display: block !important;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-card {
    display: block !important;
}

/* LANDSCAPE RESPONSIVENESS */
@media screen and (orientation: landscape) and (max-height: 500px) {
    body {
        padding: 5px;
    }

    h1 {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }

    .card {
        padding: 10px;
        margin-top: 5px;
    }

    .timer-shell {
        width: 120px;
        height: 120px;
        margin: 5px auto;
    }

    #timer {
        font-size: 1.2rem;
    }

    #vidu-container {
        transform: scale(0.7);
        bottom: 10px;
        right: 10px;
    }

    .vidu-bubble {
        max-width: 150px;
        font-size: 0.7rem;
    }

    .evo-plan-card {
        padding: 10px;
    }

    #evoChart {
        height: 100px !important;
    }

    .medals-row {
        margin-bottom: 10px;
        gap: 5px;
    }

    .medal-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .medal-icon::after {
        font-size: 0.4rem;
        bottom: -15px;
    }

    .stat-box {
        margin-top: 10px;
        padding: 5px;
    }

    .stat-card-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 5px;
        margin-top: 10px;
    }

    .stat-card {
        padding: 8px;
    }

    .stat-card b {
        font-size: 0.9rem;
    }

    .btn {
        padding: 10px;
        font-size: 0.9rem;
    }

    /* Modals need to be more compact */
    .modal-overlay .card {
        max-width: 95%;
        padding: 10px;
    }
}

/* ==== REFACTORED UTILITIES ==== */
.settings-input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    color: #333;
    /* Forcing high contrast */
}

[data-theme='dark'] .settings-input {
    background: rgba(30, 39, 46, 0.95);
    color: #f1f2f6;
}

.privacy-box {
    margin-top: 20px;
    text-align: left;
    font-size: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--glass);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    line-height: 1.4;
}

.privacy-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    margin-top: 2px;
    cursor: pointer;
}

.modal-base-card {
    max-width: 400px;
    text-align: center;
}

.health-bar-item {
    background: var(--glass);
    padding: 10px;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
}

.health-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.health-progress-fill {
    height: 100%;
    transition: width 1s ease;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.03);
    padding: 15px;
    border-radius: 15px;
}

/* TOGGLE SWITCH STYLES */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--success);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--success);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* ==== GAMIFICATION STYLES ==== */

/* XP Toast Notification */
.xp-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(0, 210, 255, 0.4);
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 8px;
}

.xp-toast.show {
    transform: translateX(0);
}

.xp-toast-amount {
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.xp-toast-reason {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* XP Progress Bar */
/* ========== TOP INTERFACE SYSTEM ========== */
.main-top-interface {
    position: fixed;
    top: calc(10px + var(--safe-top));
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10001;
    pointer-events: none;
    gap: 12px;
    padding-bottom: 5px;
}

.main-top-interface>* {
    pointer-events: auto;
}

.app-content-wrapper {
    padding-top: 140px;
    /* Safe clearance for badge + xp + menu */
    flex-grow: 1;
    width: 100%;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0 10px;
}

.support-header-badge {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 4px 10px;
    display: flex;
    flex-direction: row;
    /* Horizontal for compactness */
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: unset;
    cursor: pointer;
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s;
    height: 32px;
    /* Much shorter */
    flex-shrink: 0;
    color: var(--text);
}

.support-header-badge:hover {
    transform: scale(1.05);
}

#support-rank-icon {
    font-size: 1rem;
    line-height: 1;
}

#support-rank-name {
    font-size: 0.55rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text);
}

.xp-bar-container {
    flex: 1;
    max-width: 200px;
    /* Slightly narrower */
    margin: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    height: 18px;
    /* Shorter bar */
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

[data-theme="dark"] .xp-bar-container {
    background: rgba(255, 255, 255, 0.1);
}

.xp-bar-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.8s ease, background 0.5s ease;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

#xp-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 900;
    font-size: 0.75rem;
    color: #fff;
    /* White text for contrast on primary colors */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    z-index: 2;
}

/* Achievement Badge Animation */
@keyframes achievementPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.achievement-unlocked {
    animation: achievementPulse 0.6s ease-in-out 3;
}

/* Streak Fire Animation */
@keyframes streakFire {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

.streak-active {
    animation: streakFire 1s ease-in-out infinite;
}

/* ==== RANKING/LEADERBOARD STYLES ==== */

.ranking-modal {
    max-width: 400px;
    width: 90%;
}

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 15px 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--glass);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.leaderboard-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.leaderboard-item.is-me {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: bold;
}

.rank-position {
    font-size: 1.2rem;
    min-width: 30px;
    text-align: center;
}

.rank-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-tier {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: #333;
}

.rank-xp {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

.leaderboard-item.is-me .rank-xp {
    color: white;
}

.rank-streak {
    font-size: 0.75rem;
}

/* Side Menu Horizontal (replaces Side Menu Left) */
.side-menu-left {
    position: relative;
    margin: 10px auto 40px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    /* Force single row if possible */
    justify-content: center;
    gap: 4px;
    /* Even tighter gap */
    z-index: 10000;
    width: 100%;
    max-width: 100%;
    /* No more hardcoded 450px if screen is smaller */
    padding: 0 10px;
    box-sizing: border-box;
    min-width: 0 !important;
    /* Safety for flex shrinking */
}

.side-menu-btn {
    width: 40px;
    /* Reduced from 44px to fit even better */
    height: 40px;
    /* Reduced from 44px */
    border-radius: 12px;
    border: none;
    background: var(--glass);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    color: white;
    font-size: 16px;
    /* Reduced from 18px */
    /* Smaller icon */
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: visible;
}

.side-menu-btn:hover {
    transform: scale(1.1) translateY(-3px);
    background: var(--primary-light);
    border-color: var(--primary);
}

.side-menu-btn.btn-ranking {
    background: linear-gradient(135deg, #ffd700 0%, #ff9500 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.side-menu-btn.btn-community {
    background: var(--primary);
}

.side-menu-btn.btn-challenges {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
}

/* Redefine ranking positioning for inside menu */
.side-menu-btn.btn-ranking {
    position: relative;
    bottom: auto;
    right: auto;
}

.ranking-trophy {
    font-size: 1.5rem;
    /* Reduced from 1.8rem */
    line-height: 1;
    margin-top: -5px;
}

.ranking-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -10%);
    font-size: 0.8rem;
    font-weight: 900;
    color: #5d4037;
    /* Dark brown for contrast on gold */
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.ranking-stars {
    position: absolute;
    top: -12px;
    /* Adjusted from -15px */
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
}

.star-icon {
    font-size: 0.9rem;
    text-shadow: 0 0 5px #fff;
    animation: starTwinkle 1.5s ease-in-out infinite;
}

@keyframes starTwinkle {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
        filter: brightness(1);
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
        filter: brightness(1.5) drop-shadow(0 0 5px gold);
    }
}

.star-icon:nth-child(2) {
    animation-delay: 0.2s;
}

.star-icon:nth-child(3) {
    animation-delay: 0.4s;
}

.btn-ranking:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.btn-close-modal {
    margin-top: 10px;
    padding: 10px 30px;
}

/* ==== ACHIEVEMENTS GALLERY STYLES ==== */

.galeria-modal {
    /* Inherits from .modal-content */
}

.galeria-stats {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 15px;
}

.galeria-container {
    text-align: left;
}

.galeria-category {
    margin-bottom: 20px;
}

.galeria-cat-title {
    font-size: 0.9rem;
    color: #2c3e50;
    /* Darker title for better contrast on glass */
    margin-bottom: 10px;
    padding-left: 5px;
    border-left: 3px solid var(--primary);
}

.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.galeria-badge {
    background: var(--glass);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.galeria-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.galeria-badge.unlocked {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2) 0%, rgba(0, 210, 255, 0.2) 100%);
    border: 2px solid var(--success);
}

.galeria-badge.locked {
    opacity: 0.9;
    /* Near full opacity for text clarity */
    filter: grayscale(100%) contrast(0.8);
    background: rgba(0, 0, 0, 0.08);
    border: 1px dashed var(--gray);
}

.galeria-badge.locked .badge-name {
    color: var(--dark);
    /* High contrast for title */
}

.galeria-badge.locked .badge-desc {
    color: var(--gray);
    /* Softer but legible for description */
}

.badge-icon {
    font-size: 1.8rem;
}

.badge-name {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.1;
}

.badge-xp {
    font-size: 0.65rem;
    color: var(--primary);
    font-weight: bold;
}

.badge-desc {
    font-size: 0.65rem;
    color: var(--gray);
    font-style: italic;
    margin-top: 2px;
    line-height: 1.2;
}

.galeria-badge.locked .badge-xp {
    color: var(--gray);
}

/* ==== CHAT LIKES STYLES ==== */

.chat-msg-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.like-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 3px 8px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.like-btn:hover {
    background: rgba(255, 100, 100, 0.1);
}

.like-btn.liked {
    animation: likeHeart 0.3s ease;
}

.like-count {
    font-size: 0.75rem;
    color: var(--gray);
}

.like-btn.liked .like-count {
    color: #ff6b6b;
}

.like-count-static {
    font-size: 0.75rem;
    color: #ff6b6b;
}

@keyframes likeHeart {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* ==== HOURLY CELEBRATION TOAST ==== */

.hourly-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
}

.hourly-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hourly-toast-icon {
    font-size: 1.6rem;
    animation: bounceIcon 0.5s ease;
}

.hourly-toast-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hourly-toast-text strong {
    font-size: 0.95rem;
}

.hourly-toast-text span {
    font-size: 0.8rem;
    opacity: 0.9;
}

@keyframes bounceIcon {

    0%,
    100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.2) rotate(-10deg);
    }

    50% {
        transform: scale(1.1) rotate(10deg);
    }

    75% {
        transform: scale(1.15) rotate(-5deg);
    }
}

/* ==== CHAT VISUAL IMPROVEMENTS ==== */

.chat-message {
    background: var(--glass);
    border-radius: 16px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary);
    transition: transform 0.2s;
}

.chat-message:hover {
    transform: translateX(3px);
}

.chat-message.is-mine {
    border-left-color: var(--success);
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1) 0%, var(--glass) 100%);
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.chat-message-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-message-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text);
    word-break: break-word;
}

.chat-message-time {
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 6px;
    text-align: right;
}

.badge-tu {
    background: var(--success);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* ==== LANGUAGE SELECTOR ==== */
.lang-selector {
    display: flex;
    gap: 8px;
}

.lang-btn {
    padding: 6px 12px;
    border: 2px solid var(--glass-border);
    background: var(--glass);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    color: var(--text);
}

/* ==== INVITE SYSTEM ==== */
@keyframes blink-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
        transform: scale(1.1);
        background-color: #ff6b6b;
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
        transform: scale(1);
    }
}

.blink-active {
    animation: blink-animation 1.5s infinite;
}

.invite-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 5px;
    transition: transform 0.2s;
    opacity: 0.8;
}

.invite-btn:hover {
    transform: scale(1.2);
    opacity: 1;
}

.invite-card {
    background: linear-gradient(135deg, rgba(255, 159, 67, 0.2), rgba(255, 107, 107, 0.2));
    border: 2px solid #ff9f43;
    padding: 10px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.invite-actions {
    display: flex;
    gap: 8px;
}

.btn-accept {
    background: var(--success);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-reject {
    background: var(--danger);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.lang-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}



.lang-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 210, 255, 0.3);
}

/* Analysis Timer */
.analysis-timer-container {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.analysis-timer-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 1px;
}

.analysis-timer-display {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--text);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
}

/* Analysis Dashboard Styles */
.analysis-card {
    background:
        linear-gradient(rgba(30, 60, 114, 0.05) 0%, rgba(42, 82, 152, 0.05) 100%),
        radial-gradient(circle at 2px 2px, rgba(0, 210, 255, 0.05) 1px, transparent 0);
    background-size: 100% 100%, 20px 20px;
    border: 1px dashed var(--primary);
    position: relative;
    overflow: hidden;
}

.analysis-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, transparent 50%, rgba(0, 210, 255, 0.02) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 0;
}

.analysis-header {
    margin-bottom: 20px;
}

.analysis-header h2 {
    color: var(--primary-dark);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.analysis-header p {
    font-size: 0.85rem;
    color: var(--gray);
}

.analysis-progress-container {
    margin: 25px 0;
    text-align: left;
}

.analysis-progress-bar {
    height: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
    border: 1px solid var(--glass-border);
}

[data-theme='dark'] .analysis-progress-bar {
    background: rgba(255, 255, 255, 0.05);
}

.analysis-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    width: 0%;
    transition: width 1s ease-out;
    box-shadow: 0 0 10px var(--primary);
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.analysis-metric-card {
    background: var(--glass);
    padding: 15px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.analysis-metric-card i {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 5px;
}

.analysis-metric-val {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--primary-dark);
    display: block;
}

.analysis-metric-label {
    font-size: 0.65rem;
    color: var(--gray);
    text-transform: uppercase;
    font-weight: 800;
}

.analysis-vidu-insight {
    background: var(--primary-dark);
    color: white;
    padding: 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    position: relative;
    text-align: left;
    box-shadow: 0 5px 15px rgba(58, 123, 213, 0.2);
}

.analysis-vidu-insight b {
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}


.freedom-card {
    transition: all 0.5s ease;
}

/* TRIGGER MODAL STYLES */
.triggers-modal {
    background: var(--glass) !important;
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    max-width: 90%;
    width: 400px;
    color: var(--text);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.triggers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 5px;
}

.trigger-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: 0.2s;
}

.trigger-btn:active {
    transform: scale(0.95);
    background: var(--primary);
    color: white;
}

.trigger-icon {
    font-size: 2rem;
}

.trigger-label {
    font-size: 0.85rem;
    font-weight: 700;
}

[data-theme='dark'] .trigger-btn {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--gray);
}

/* Utility Classes for Cleanup */
.w-full {
    width: 100%;
}

.flex-gap-10 {
    display: flex;
    gap: 10px;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.input-std {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-family: inherit;
}

[data-theme='dark'] .input-std {
    background: rgba(30, 39, 46, 0.95);
    color: #f1f2f6;
}

.label-block {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.text-note {
    margin-top: 15px;
    font-size: 0.65rem;
    color: var(--gray);
    opacity: 0.8;
}

.text-note-sm {
    font-size: 0.7rem;
    color: var(--primary);
}

.z-modal {
    z-index: 20000;
}

.z-modal-top {
    z-index: 25000;
}

.font-bold-lg {
    font-weight: 700;
    font-size: 1rem;
}

.mt-5 {
    margin-top: 5px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-5 {
    margin-bottom: 5px;
}

.mt-15 {
    margin-top: 15px;
}

.m-0 {
    margin: 0;
}

.text-left {
    text-align: left;
}

.flex-center-gap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-primary {
    color: var(--primary);
}

.cursor-pointer {
    cursor: pointer;
}

.community-card {
    max-width: 500px;
    padding: 0;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.community-header-title {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.community-user-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.banned-alert {
    display: none;
    background: #ff4757;
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.flex-1 {
    flex: 1;
}

.p-15 {
    padding: 15px;
}

.btn-sm-glass {
    margin-top: 8px;
    font-size: 0.7rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.scroll-box-std {
    max-height: 60vh;
    overflow-y: auto;
    text-align: left;
    padding: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--dark);
}

.footer-info-small {
    font-size: 0.7rem;
    color: var(--primary-dark);
    margin-top: 8px;
    display: none;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 5px;
}

/* ==========================================
   ZOO REWARD SYSTEM STYLES
   ========================================== */
.zoo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.zoo-enclosure {
    background: var(--card-bg);
    border-radius: 30px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

.zoo-enclosure:active {
    transform: scale(0.96);
}

.zoo-enclosure.affordable {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.3);
    animation: affordGlow 2s ease-in-out infinite;
}

@keyframes affordGlow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
    }
}

.zoo-animal svg {
    width: 85%;
    height: 85%;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: animalIdle 3s ease-in-out infinite;
}

@keyframes animalIdle {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-5px) rotate(2deg);
    }
}

/* Zoo Specific Animations from old style.css */
@keyframes clickHop {

    0%,
    100% {
        transform: translateY(0);
    }

    20% {
        transform: translateY(-25px);
    }

    40% {
        transform: translateY(0);
    }

    60% {
        transform: translateY(-12px);
    }
}

@keyframes clickWaddle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-20deg) translateX(-5px);
    }

    75% {
        transform: rotate(20deg) translateX(5px);
    }
}

@keyframes clickSway {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-15deg);
    }

    75% {
        transform: rotate(15deg);
    }
}

@keyframes clickRoll {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes clickRoar {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

@keyframes clickHowl {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-20px) scale(1.1);
    }
}

@keyframes clickStomp {

    0%,
    100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.2, 0.8);
    }

    75% {
        transform: scale(0.8, 1.2);
    }
}

@keyframes clickPounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-30px) scale(1.2, 0.8);
    }
}

@keyframes clickStretch {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.4);
    }
}

@keyframes clickFly {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-30px);
    }

    75% {
        transform: translateY(-15px);
    }
}

.anim-hop {
    animation: clickHop 0s;
}

.anim-waddle {
    animation: clickWaddle 0s;
}

.anim-sway {
    animation: clickSway 0s;
}

.anim-roll {
    animation: clickRoll 0s;
}

.anim-roar {
    animation: clickRoar 0s;
}

.anim-howl {
    animation: clickHowl 0s;
}

.anim-stomp {
    animation: clickStomp 0s;
}

.anim-pounce {
    animation: clickPounce 0s;
}

.anim-stretch {
    animation: clickStretch 0s;
}

.anim-fly {
    animation: clickFly 0s;
}

/* The actual classes triggered by JS */
.zoo-clicked.anim-hop svg {
    animation: clickHop 0.6s ease;
}

.zoo-clicked.anim-waddle svg {
    animation: clickWaddle 0.6s ease;
}

.zoo-clicked.anim-sway svg {
    animation: clickSway 0.6s ease;
}

.zoo-clicked.anim-roll svg {
    animation: clickRoll 0.8s ease;
}

.zoo-clicked.anim-roar svg {
    animation: clickRoar 0.6s ease;
}

.zoo-clicked.anim-howl svg {
    animation: clickHowl 0.7s ease;
}

.zoo-clicked.anim-stomp svg {
    animation: clickStomp 0.5s ease;
}

.zoo-clicked.anim-pounce svg {
    animation: clickPounce 0.5s ease;
}

.zoo-clicked.anim-stretch svg {
    animation: clickStretch 0.7s ease;
}

.zoo-clicked.anim-fly svg {
    animation: clickFly 0.8s ease;
}

/* ========== SKIP BUTTON STATES ========== */

/* Pulse glow animation for can-smoke state */
@keyframes skipGlowPulse {

    0%,
    100% {
        box-shadow:
            0 0 6px rgba(0, 210, 160, 0.5),
            0 0 18px rgba(0, 210, 160, 0.25),
            0 0 30px rgba(0, 180, 220, 0.15);
        border-color: rgba(0, 210, 160, 0.6);
    }

    50% {
        box-shadow:
            0 0 10px rgba(0, 180, 220, 0.6),
            0 0 25px rgba(0, 180, 220, 0.35),
            0 0 40px rgba(0, 210, 160, 0.2);
        border-color: rgba(0, 180, 220, 0.7);
    }
}

/* Warm glow animation for active-skip state */
@keyframes skipActiveGlow {

    0%,
    100% {
        box-shadow:
            0 0 8px rgba(245, 183, 50, 0.5),
            0 0 20px rgba(245, 183, 50, 0.25),
            0 0 35px rgba(52, 211, 153, 0.15);
        border-color: rgba(245, 183, 50, 0.5);
    }

    50% {
        box-shadow:
            0 0 12px rgba(52, 211, 153, 0.5),
            0 0 28px rgba(52, 211, 153, 0.3),
            0 0 45px rgba(245, 183, 50, 0.15);
        border-color: rgba(52, 211, 153, 0.6);
    }
}

/* State: Can smoke — clickable, vibrant teal-emerald with breathing glow */
#btn-skip-smoke.skip-cansmoke {
    background: linear-gradient(135deg, #00d2a0, #00b4d8) !important;
    color: white !important;
    border: 2px solid rgba(0, 210, 160, 0.5) !important;
    animation: skipGlowPulse 1s ease-in-out infinite !important;
    transform: scale(1);
    transition: transform 0.2s ease !important;
}

#btn-skip-smoke.skip-cansmoke:active {
    transform: scale(0.95) !important;
}

/* State: Active skip — warm amber-gold with gentle glow */
#btn-skip-smoke.skip-active {
    background: linear-gradient(135deg, #f5b732, #e8a317) !important;
    color: #3d2800 !important;
    border: 2px solid rgba(245, 183, 50, 0.5) !important;
    animation: skipActiveGlow 1s ease-in-out infinite !important;
    letter-spacing: 0.5px;
}

/* State: Waiting — subtle, faded */
#btn-skip-smoke.skip-waiting {
    background: linear-gradient(135deg, #6b7d8e, #8e9eaf) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    opacity: 0.5;
    pointer-events: none;
    box-shadow: none !important;
}

/* ========== PREMIUM UI OVERHAUL ========== */
.modal-community-header {
    padding: 15px 20px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
    border-bottom: none;
}

.community-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--primary-dark);
}

.community-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f2f6;
    border: none;
    color: var(--dark);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.community-close-btn:active {
    transform: scale(0.9);
    background: #e1e2e6;
}

.input-area-container {
    padding: 15px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.02);
}

.emoji-btn {
    font-size: 1.4rem;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: 0.3s;
    border-radius: 50%;
}

.emoji-btn:active {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(0.9);
}

#chat-input,
#mural-input {
    flex: 1;
    background: #f1f2f6;
    border: none;
    padding: 12px 18px;
    border-radius: 25px;
    font-size: 0.95rem;
    color: var(--dark);
    transition: all 0.3s ease;
}

#chat-input:focus,
#mural-input:focus {
    background: white;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    outline: none;
}

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.3);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.send-btn:active {
    transform: scale(0.9) rotate(10deg);
    box-shadow: 0 2px 5px rgba(var(--primary-rgb), 0.2);
}

/* ========== LAYOUT FIXES (FINAL) ========== */
.modal-community-content {
    height: 95vh !important;
    max-height: 95vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: rgba(255, 255, 255, 0.85) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
}

.community-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.chat-messages-list {
    flex: 1 !important;
    overflow-y: auto !important;
    padding-bottom: 20px !important;
    scroll-behavior: auto !important;
}

.input-area-container {
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 50 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    backdrop-filter: blur(15px) !important;
}

.modal-community-header {
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.5) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
}



/* ========== LAYOUT REGRESSION FIX (ROBUST & CORRECTED) ========== */

/* Default state: HIDDEN */
.community-content {
    display: none !important;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    position: relative;
    /* Ensure absolute children are contained */
}

/* Active state: VISIBLE (Flex) */
.community-content.active {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    overflow: hidden !important;
    opacity: 1;
    animation: fadeInTab 0.4s ease-out forwards;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#community-chat.community-content.active,
#community-mural.community-content.active {
    display: flex !important;
}

#mural-posts {
    flex: 1 !important;
    overflow-y: auto !important;
    padding-bottom: 80px !important;
    /* Space for floating input */
    scroll-behavior: smooth;
}

/* Fix class conflict for smooth scroll */
.chat-messages-list {
    flex: 1 !important;
    overflow-y: auto !important;
    padding-bottom: 20px !important;
    scroll-behavior: smooth !important;
}

#chat-messages {
    scroll-behavior: smooth;
    padding-bottom: 80px !important;
    /* Space for floating input */
}


/* Ensure Mural input acts as a floating footer */
#community-mural .input-area-container,
#community-chat .input-area-container {
    flex-shrink: 0 !important;
    position: absolute !important;
    bottom: 20px;
    left: 20px;
    right: 20px;
    width: auto !important;
    /* Let left/right control width */
    background: rgba(255, 255, 255, 0.95) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    padding: 8px 12px !important;
    /* Slightly reduced padding */
    margin-top: 0 !important;
    z-index: 100 !important;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

#chat-input,
#mural-input {
    flex: 1 1 auto !important;
    /* Allow shrinking and growing */
    min-width: 0 !important;
    /* Critical for flex resizing */
    width: 100% !important;
    /* Fallback */
}

.emoji-btn {
    flex-shrink: 0 !important;
}

.send-btn {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    /* Push to end if needed */
}

/* --- CHALLENGES & BUDDIES STYLES --- */
.challenge-group-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    box-shadow: 0 10px 20px rgba(var(--primary-rgb), 0.3);
}

.ranking-item {
    transition: transform 0.2s ease;
}

.ranking-item:hover {
    transform: translateX(5px);
}

.ranking-item.is-me {
    background: rgba(var(--primary-rgb), 0.1) !important;
    border: 1px solid var(--primary) !important;
}

.buddy-invite-card {
    background: white !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}


.buddy-invite-card:active {
    transform: scale(0.98);
}

/* Message Actions (Footer) */
.msg-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    padding: 0 4px;
    transition: opacity 0.2s;
    filter: grayscale(100%);
}

.msg-action-btn:hover {
    opacity: 1;
    filter: none;
    transform: scale(1.1);
}

/* Reuse translate btn style adjustments if needed */
.translate-btn {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.translate-btn:hover {
    opacity: 1;
}

/* Improved Chat Message Styling */
.chat-message {
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    /* Optimized padding */
    margin-bottom: 2px;
    /* reduced from 15 to keep grouped */
    border: none !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    position: relative;
    width: fit-content;
    max-width: 85%;
    /* Restore limit for readability */
    /* Don't stretch */
    animation: slideInMsg 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-message-wrapper {
    display: flex;
    gap: 8px;
    /* Consistent gap */
    align-items: flex-end;
    /* Align avatar with bottom of bubble */
    max-width: 100%;
    /* wrapper takes full width but bubble is constrained */
    margin-bottom: 15px;
    /* Spacing between groups */
    padding-right: 10px;
    /* Safety padding */
}

.chat-message-wrapper.is-consecutive {
    margin-bottom: 2px;
    /* Tighter for consecutive */
    margin-top: 0;
}

.chat-avatar {
    margin-bottom: 0;
    /* Align perfectly with bottom */
    width: 36px;
    /* Slightly larger */
    height: 36px;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.chat-message.is-mine {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
    margin-left: auto;
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
}

.chat-message.is-mine .chat-message-text {
    color: white;
}

.chat-message.is-mine .chat-message-time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-message.is-mine .chat-message-author {
    color: white;
    opacity: 0.9;
}

@keyframes slideInMsg {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mural Card Premium Style */
.mural-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.mural-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--success));
    border-radius: 20px 0 0 20px;
}

.mural-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.mural-card-text {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
    color: var(--dark);
    margin-bottom: 15px;
    font-style: italic;
}

.mural-quote-icon {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 4rem;
    color: var(--primary);
    opacity: 0.1;
    font-family: serif;
    pointer-events: none;
}


/* --- POSITIVE TIMER STYLES (Retry) --- */
.timer-track-positive {
    fill: none;
    stroke: #4CAF50;
    stroke-width: 8;
    opacity: 1;
    display: none;
}

.timer-tick {
    stroke: #ddd;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.tick-red {
    stroke: #ff4444;
    stroke-width: 4;
    filter: drop-shadow(0 0 2px rgba(255, 0, 0, 0.5));
}

.tick-yellow {
    stroke: #ffeb3b;
    stroke-width: 4;
    filter: drop-shadow(0 0 2px rgba(255, 235, 59, 0.5));
}


/* --- POSITIVE TIMER STYLES (Appended Fix) --- */
.timer-track-positive {
    fill: none;
    stroke: #4CAF50;
    stroke-width: 8;
    opacity: 1;
    display: none;
}

.timer-tick {
    stroke: #ddd;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.tick-green {
    stroke: #00e676;
    stroke-width: 4;
    filter: drop-shadow(0 0 2px rgba(0, 230, 118, 0.5));
}

.tick-red {
    stroke: #ff4444;
    stroke-width: 4;
    filter: drop-shadow(0 0 2px rgba(255, 0, 0, 0.5));
}

.tick-yellow {
    stroke: #ffeb3b;
    stroke-width: 4;
    filter: drop-shadow(0 0 2px rgba(255, 235, 59, 0.5));
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    /* Controlled by JS */
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 20px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.modal-content.glass-panel {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 25px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    animation: modalPop 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary, #4CAF50);
    background: rgba(255, 255, 255, 0.1);
}

/* SVG Defs Helper Classes */
.svg-defs-hidden {
    height: 0;
    width: 0;
    position: absolute;
}

.stop-grad-start {
    stop-color: var(--primary);
    stop-opacity: 1;
}

.stop-grad-end {
    stop-color: var(--primary-dark);
    stop-opacity: 1;
}

.stop-area-start {
    stop-color: var(--primary);
    stop-opacity: 0.4;
}

.stop-area-end {
    stop-color: var(--primary);
    stop-opacity: 0;
}

/* VIDU MASCOT ANIMATIONS & LAYOUT */

/* 1. Container & Layout */
#vidu-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    overflow: visible;
}

.vidu-mascot {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(255, 152, 0, 0.5)) drop-shadow(0 0 20px rgba(255, 87, 34, 0.3));
    animation: float 6s ease-in-out infinite;
    z-index: 2;
}

/* 2. Speech Bubble Positioning */
.vidu-bubble {
    position: absolute;
    right: 110px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 10px 14px;
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    font-size: 0.82rem;
    color: var(--dark);
    font-weight: 600;
    white-space: normal;
    word-wrap: break-word;
    max-width: 280px;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1;
}

/* Beak / triangle pointer */
.vidu-bubble::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

/* Beak points RIGHT (toward Vidu on the right) */
.vidu-bubble[data-side="left"]::after {
    right: -16px;
    left: auto;
    border-left-color: white;
    border-right-color: transparent;
}

/* Beak points LEFT (toward Vidu on the left) */
.vidu-bubble[data-side="right"]::after {
    left: -16px;
    right: auto;
    border-right-color: white;
    border-left-color: transparent;
}

/* Show bubble */
#vidu-container:hover .vidu-bubble,
.vidu-bubble.active {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* 3. SVG Animations */
@keyframes flameFlicker {

    0%,
    100% {
        transform: scale(1, 1) rotate(0deg);
    }

    50% {
        transform: scale(1.02, 0.98) rotate(1deg);
    }
}

@keyframes eyeBlink {

    0%,
    90%,
    100% {
        transform: scaleY(1);
    }

    95% {
        transform: scaleY(0.1);
    }
}

/* Target the Group for Body Animation */
#vidu-body-group {
    animation: flameFlicker 3s infinite ease-in-out;
    transform-origin: 50% 90%;
    /* Anchor at bottom */
}

/* Target the Face Group for Blinking */
#vidu-eyes {
    animation: eyeBlink 4s infinite;
    transform-origin: center;
}

/* Legacy overrides if needed */
#vidu-face {
    transition: 0.3s;
}

#vidu-container:active #vidu-face {
    transform: translate(0, 8px) scale(0.95);
}

/* ADDED: Pop-In Animation for Bubble */
@keyframes popIn {
    0% {
        transform: translateY(-40%) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

/* ==============================
   STREAK MODAL (Duolingo-style)
   ============================== */

.streak-modal-card {
    background: #1b2838;
    color: #e8e8e8;
    border-radius: 20px;
    padding: 25px 20px;
    max-width: 400px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: streakModalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes streakModalIn {
    0% {
        transform: scale(0.85) translateY(30px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.streak-modal-card .btn-close-modal {
    color: #8899a6;
    font-size: 1.6rem;
}

/* Tabs */
.streak-modal-tabs {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.streak-tab {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #58cc02;
    padding-bottom: 8px;
    border-bottom: 3px solid #58cc02;
}

/* Hero / Big Number */
.streak-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 10px 0 5px;
}

.streak-hero-number {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(180deg, #ff9600 0%, #ff4b1f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.streak-hero-fire {
    font-size: 3.5rem;
    animation: streakFirePulse 1.5s ease-in-out infinite;
}

@keyframes streakFirePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15) rotate(-5deg);
    }
}

.streak-hero-label {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ff9600;
    margin-bottom: 5px;
}

.streak-record {
    text-align: center;
    font-size: 0.75rem;
    color: #8899a6;
    margin-bottom: 15px;
}

/* Motivation Card */
.streak-motivation-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Calendar Header */
.streak-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.streak-month-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.streak-month-nav {
    display: flex;
    gap: 8px;
}

.streak-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e8e8e8;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.streak-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Stats Row */
.streak-stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.streak-stat-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.streak-stat-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.streak-stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: #ffffff;
}

.streak-stat-label {
    font-size: 0.7rem;
    color: #8899a6;
    margin-top: 2px;
}

/* Calendar Grid */
.streak-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.streak-cal-day-header {
    font-size: 0.7rem;
    font-weight: 700;
    color: #8899a6;
    padding: 4px 0;
    text-transform: uppercase;
}

.streak-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    color: #556677;
    position: relative;
    transition: all 0.2s;
}

.streak-cal-day.active {
    background: linear-gradient(135deg, #ff9600, #ff4b1f);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 75, 31, 0.35);
}

.streak-cal-day.today {
    border: 2px solid #58cc02;
}

.streak-cal-day.today.active {
    border-color: #ffffff;
    box-shadow: 0 2px 12px rgba(255, 150, 0, 0.5);
}

.streak-cal-day.future {
    color: #334455;
}

.streak-cal-day.empty {
    visibility: hidden;
}

/* Fix for FAQ Visibility used in Dark Mode */
.faq-item {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-color);
}

.faq-item strong {
    color: var(--primary);
    display: block;
    margin-bottom: 5px;
}

/* Add new Mascot breathing animation */
.vidu-mascot {
    animation: vidu-breathe 4s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes vidu-breathe {
    0% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(1.03, 0.98) translateY(2px);
    }

    100% {
        transform: scale(1) translateY(0);
    }
}

/* --- SETTINGS TABS --- */
.settings-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: rgba(128, 128, 128, 0.1);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.tab-btn.active {
    background: var(--primary);
    color: white !important;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.settings-section {
    display: none;
    animation: fadeInSettings 0.3s ease;
}

.settings-section.active {
    display: block;
}

@keyframes fadeInSettings {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-row:last-child {
    border-bottom: none;
}

/* Phase 39: Setup Screen UI Refinements */
.setup-label {
    color: var(--text);
    font-weight: 500;
}

[data-theme='dark'] .setup-label {
    color: var(--gray);
}

.setup-title-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-dark);
}

[data-theme='dark'] .setup-title-label {
    color: var(--primary);
}

/* User Request: Make top menu popups transparent like Vidu bubble */
.modal-card,
.community-card,
.modal-content,
.streak-modal-card,
.store-modal,
.challenges-modal,
.ranking-modal {
    background: rgba(255, 255, 255, 0.65) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

[data-theme='dark'] .modal-card,
[data-theme='dark'] .community-card,
[data-theme='dark'] .modal-content,
[data-theme='dark'] .streak-modal-card,
[data-theme='dark'] .store-modal,
[data-theme='dark'] .challenges-modal,
[data-theme='dark'] .ranking-modal {
    background: rgba(30, 30, 40, 0.65) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

/* VIP Badges */
.vip-text-none {
    color: #ff4444;
}

.vip-word {
    color: #4b6584;
    /* A readable grey-blue in light mode */
    font-weight: 800;
}

[data-theme='dark'] .vip-word {
    color: #00d2ff;
    /* Nice bright cyan in dark mode */
}

.vip-border-none {
    border-color: #666;
}

.vip-bg-none {
    background: #666;
}

.vip-text-bronze {
    color: #a05a20;
    text-shadow: 0 0 5px rgba(205, 127, 50, 0.3);
}

.vip-border-bronze {
    border-color: #cd7f32;
}

.vip-bg-bronze {
    background: #cd7f32;
}

[data-theme='dark'] .vip-text-bronze {
    color: #ffcd9e;
    text-shadow: 0 0 5px rgba(205, 127, 50, 0.5);
}

.vip-text-gold {
    color: #b58500;
    text-shadow: 0 0 5px rgba(255, 204, 0, 0.3);
}

.vip-border-gold {
    border-color: #ffcc00;
}

.vip-bg-gold {
    background: #ffcc00;
}

[data-theme='dark'] .vip-text-gold {
    color: #ffe680;
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.8);
}

.vip-text-diamond {
    color: #0070a8;
    text-shadow: 0 0 5px rgba(0, 210, 255, 0.3);
}

.vip-border-diamond {
    border-color: #00d2ff;
}

.vip-bg-diamond {
    background: #00d2ff;
}

[data-theme='dark'] .vip-text-diamond {
    color: #80e6ff;
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.9);
}

.vip-badge-bronze {
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(205, 127, 50, 0.2);
    border: 1px solid #cd7f32;
    color: #a05a20;
    font-size: 0.8em;
    margin-right: 4px;
    text-shadow: 0 0 5px rgba(205, 127, 50, 0.3);
}

[data-theme='dark'] .vip-badge-bronze {
    color: #ffcd9e;
    text-shadow: 0 0 5px rgba(205, 127, 50, 0.5);
}

.vip-badge-gold {
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(255, 204, 0, 0.2);
    border: 1px solid #ffcc00;
    color: #b58500;
    font-size: 0.85em;
    margin-right: 4px;
    text-shadow: 0 0 5px rgba(255, 204, 0, 0.3);
}

[data-theme='dark'] .vip-badge-gold {
    color: #ffe680;
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.8);
}

.vip-badge-diamond {
    padding: 2px 5px;
    border-radius: 4px;
    background: linear-gradient(45deg, rgba(0, 210, 255, 0.2), rgba(58, 123, 213, 0.3));
    border: 1px solid #00d2ff;
    color: #0070a8;
    font-size: 0.9em;
    margin-right: 4px;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
    text-shadow: 0 0 5px rgba(0, 210, 255, 0.3);
    animation: pulseDiamond 2s infinite;
}

[data-theme='dark'] .vip-badge-diamond {
    color: #80e6ff;
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.9);
}

@keyframes pulseDiamond {
    0% {
        box-shadow: 0 0 5px rgba(0, 210, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 15px rgba(0, 210, 255, 0.8);
    }

    100% {
        box-shadow: 0 0 5px rgba(0, 210, 255, 0.4);
    }
}