/* ==============================================================================
   ECOSPACE - STYLESHEET (SUITE DIDATTICA DIGITAL GIOCHI BIBLIOMEET PLAY)
   ============================================================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #0f172a;
    --accent: #10b981; /* Smeraldo/Teal */
    --accent-glow: rgba(16, 185, 129, 0.4);
    
    /* Budget Colors */
    --color-eco: #10b981;
    --color-time: #f59e0b;
    --color-money: #3b82f6;
    --color-joy: #ec4899;
    
    /* Neutral text and borders */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(16, 185, 129, 0.25);
    
    /* Glassmorphism */
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.35);
    
    /* Font sizes */
    --font-mono: 'Roboto Mono', monospace;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: radial-gradient(circle at 50% 50%, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

.font-mono {
    font-family: var(--font-mono);
}

/* Base Glassmorphic Layout Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 var(--glass-shadow);
}

.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 20px;
}

/* Header styling */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.game-header .logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-eco), #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.game-header .header-left,
.game-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.badge {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
}

.challenge-badge {
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.player-badge {
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.env-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.env-item strong {
    color: var(--text-primary);
    text-transform: uppercase;
}

/* Game Board structure */
.game-board {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    flex-grow: 1;
}

/* Sidebar panel */
.game-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

.budget-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.budget-panel h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

.budget-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.budget-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.budget-info .icon {
    font-size: 1.4rem;
    width: 30px;
    text-align: center;
}

.label-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-left: 10px;
}

.label-group .label {
    font-size: 0.95rem;
    font-weight: 500;
}

.label-group .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.budget-info .value {
    font-size: 1.15rem;
    font-weight: 700;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.05);
    height: 8px;
    border-radius: 9999px;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.progress-fill {
    height: 100%;
    border-radius: 9999px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.eco-fill { background: var(--color-eco); box-shadow: 0 0 10px var(--color-eco); }
.time-fill { background: var(--color-time); box-shadow: 0 0 10px var(--color-time); }
.money-fill { background: var(--color-money); box-shadow: 0 0 10px var(--color-money); }
.joy-fill { background: var(--color-joy); box-shadow: 0 0 10px var(--color-joy); }

.stat-panel {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-row strong {
    color: var(--text-primary);
}

.text-accent {
    color: var(--accent) !important;
}

/* Play area & Progress */
.game-play-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.progress-indicator {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-indicator .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.flex-grow {
    flex-grow: 1;
}

.progress-deck-fill {
    background: linear-gradient(90deg, #10b981, #3b82f6);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.progress-indicator .step {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Card deck container */
.card-deck {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.card-header {
    margin-bottom: 20px;
}

.card-category {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.card-title {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.3;
}

.card-context {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.card-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

/* Buttons */
.btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px 20px;
    border-radius: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1px solid var(--border-light);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.option-btn {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.option-a-btn:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.option-b-btn:hover {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.opt-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.option-a-btn:hover .opt-label {
    color: var(--color-eco);
}

.option-b-btn:hover .opt-label {
    color: var(--color-money);
}

.opt-text {
    font-size: 0.95rem;
    font-weight: 600;
}

.primary-btn {
    background: linear-gradient(135deg, var(--color-eco) 0%, #059669 100%);
    border: none;
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.w-full {
    width: 100%;
}

.text-center {
    text-align: center;
}

/* Modals / Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-box {
    width: 100%;
    max-width: 500px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    animation: modal-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.border-accent {
    border-color: var(--accent);
}

.border-glow {
    border-color: var(--accent-glow);
    box-shadow: 0 0 30px var(--accent-glow);
}

.modal-icon {
    font-size: 3rem;
    align-self: center;
}

.modal-box h3 {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
}

.fact-text {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
}

/* Game Over details */
.profile-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border-light);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.profile-badge .label,
.score-card .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.profile-badge strong {
    font-size: 1.25rem;
    color: #6ee7b7;
}

.text-glow {
    text-shadow: 0 0 10px rgba(110, 231, 183, 0.5);
}

.score-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}

.score-card .score-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--color-eco);
    line-height: 1;
    margin: 8px 0;
}

.score-card .score-scale {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.go-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Animations */
@keyframes modal-in {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Responsive Rules */
@media (max-width: 960px) {
    .game-board {
        grid-template-columns: 1fr;
    }
    
    .game-sidebar {
        flex-direction: row;
    }
    
    .budget-panel {
        flex-grow: 1;
    }
    
    .stat-panel {
        width: 200px;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .game-sidebar {
        flex-direction: column;
    }
    
    .stat-panel {
        width: 100%;
    }
    
    .game-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .card-footer {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .game-board {
        display: flex;
        flex-direction: column-reverse;
    }
    /* Nasconde Meteo e Vincolo mantenendo il Timer se presente */
    .game-header .header-right .env-item:not(#room-timer-container) {
        display: none !important;
    }
    /* Forza la griglia 2x2 sulle opzioni */
    #options-container, .card-footer {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        align-items: stretch !important;
    }
}

/* ==============================================================================
   ECOSPACE DYNAMIC WIDGETS & ANIMATIONS (BUDGETS & FEEDBACK)
   ============================================================================== */

.hidden {
    display: none !important;
}

.budget-svg-container {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.02), 0 4px 12px rgba(0,0,0,0.15);
}

.budget-item:hover .budget-svg-container {
    transform: translateY(-2px) scale(1.05);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Specific budget container glow states */
.eco-score-item:hover .budget-svg-container { border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 0 15px rgba(16, 185, 129, 0.25); }
.time-item:hover .budget-svg-container { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 0 15px rgba(245, 158, 11, 0.25); }
.money-item:hover .budget-svg-container { border-color: rgba(59, 130, 246, 0.4); box-shadow: 0 0 15px rgba(59, 130, 246, 0.25); }
.joy-item:hover .budget-svg-container { border-color: rgba(236, 72, 153, 0.4); box-shadow: 0 0 15px rgba(236, 72, 153, 0.25); }

/* Footprint CSS */
.footprint-path {
    transition: fill 0.5s ease, stroke 0.5s ease;
}
.pollution-spots {
    transition: opacity 0.5s ease;
}
.pollution-spot {
    fill: #475569;
}

/* Hourglass CSS */
.sand-stream {
    stroke-dasharray: 4, 3;
    animation: sand-flow 0.6s infinite linear;
    transition: opacity 0.3s ease;
}
@keyframes sand-flow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -14; }
}
.sand-level {
    transition: y 0.5s ease, height 0.5s ease, fill 0.5s ease;
}

/* Coin stack CSS */
.coin-layer {
    transition: opacity 0.4s ease, transform 0.4s ease, fill 0.4s ease;
}

/* Heart CSS & Keyframes */
@keyframes heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.15); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
    70% { transform: scale(1); }
}
.heart-pulsing {
    transform-origin: center;
    animation: heartbeat 1.5s infinite ease-in-out;
    transition: fill 0.5s ease;
}
.heart-crack {
    transition: opacity 0.5s ease;
}

/* Feedback variations styling */
.choice-variations-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 15px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 12px;
}
.variation-badge {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    text-align: left;
}
.variation-badge > span:first-child {
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 100px;
}
.variation-badge.var-pos {
    background: rgba(16, 185, 129, 0.08) !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
}
.variation-badge.var-neg {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
}
.variation-badge.var-zero {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: var(--border-light) !important;
    color: var(--text-muted) !important;
}
.variation-badge .var-meta {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.3;
}

.pedagogical-alert-box {
    border: 1px solid rgba(245, 158, 11, 0.45);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(10, 14, 23, 0.55) 100%);
    color: #fef08a;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    text-align: center;
    margin-top: 4px;
    margin-bottom: 12px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ==============================================================================
   RESPONSIVE COMPRESSION FOR MODALS & SCENARIOS (SMARTPHONE VERTICAL LIMITS)
   ============================================================================== */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 8px !important;
    }
    .modal-box {
        width: 92% !important;
        max-width: 440px !important;
        padding: 10px 14px !important;
        gap: 6px !important;
        margin: 0 auto;
    }
    .modal-icon {
        font-size: 1.5rem !important;
        margin-bottom: 2px !important;
        margin-top: 2px !important;
    }
    .modal-box h3 {
        font-size: 1.1rem !important;
        margin-top: 2px !important;
        margin-bottom: 4px !important;
    }
    #modal-hero-indicator {
        width: 90px !important;
        height: 90px !important;
        margin: 4px auto !important;
    }
    #explain-text {
        font-size: 0.88rem !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
    }
    #fact-modal .pedagogical-alert-box {
        font-size: 0.78rem !important;
        padding: 4px 8px !important;
        margin-bottom: 6px !important;
        margin-top: 2px !important;
    }
    .choice-variations-box {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
        margin: 4px 0 !important;
        padding: 4px !important;
    }
    .variation-badge {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 4px 10px !important;
        font-size: 0.85rem !important;
        gap: 4px !important;
        border-radius: 20px !important;
        flex: 1 1 auto !important;
        text-align: center !important;
        margin: 0 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
    }
    .variation-badge > span:first-child {
        min-width: 0 !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }
    .variation-badge .var-meta {
        font-size: 0.72rem !important;
        color: rgba(255, 255, 255, 0.8) !important;
        line-height: 1.1 !important;
    }
    /* Dividers and bottom text */
    #fact-modal .modal-divider {
        margin-top: 4px !important;
        padding-top: 4px !important;
        border-top: 1px solid rgba(16, 185, 129, 0.15) !important;
    }
    #fact-modal .modal-box h4 {
        font-size: 0.72rem !important;
        margin-bottom: 2px !important;
    }
    #fact-text {
        font-size: 0.8rem !important;
        line-height: 1.35 !important;
        margin-bottom: 8px !important;
    }
    #btn-close-fact {
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
        border-radius: 6px !important;
    }
}

/* ==============================================================================
   HERO INDICATORS & TRANSITIONS (FEEDBACK MODAL)
   ============================================================================== */
.hero-svg-container {
    perspective: 800px;
}
.hero-svg {
    width: 100%;
    height: 100%;
    display: block;
    transition: filter 1.5s ease, transform 1.5s ease;
}

/* 1. Footprint Hero */
.footprint-hero .footprint-main-path {
    transition: fill 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    fill: #10b981;
}
.footprint-hero .pollution-spots-group circle {
    transition: opacity 1.5s ease, transform 1.5s ease;
    opacity: 0;
    transform: scale(0);
    transform-origin: center;
    fill: #374151;
}

/* State: Contaminating (turns dark grey, spots appear, toxic shake) */
.footprint-hero.contaminating .footprint-main-path {
    fill: #1e293b !important;
}
.footprint-hero.contaminating .pollution-spots-group circle {
    opacity: 0.9 !important;
    transform: scale(1) !important;
}
.footprint-hero.contaminating {
    filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.5));
    animation: shake-toxic 0.5s infinite alternate ease-in-out;
}

/* State: Cleansing (turns bright green, spots disappear, pulses clean) */
.footprint-hero.cleansing .footprint-main-path {
    fill: #10b981 !important;
}
.footprint-hero.cleansing .pollution-spots-group circle {
    opacity: 0 !important;
    transform: scale(0) !important;
}
.footprint-hero.cleansing {
    filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.7));
    animation: pulse-clean 1.8s infinite ease-in-out;
}

/* Init States */
.footprint-hero.contaminating-init .footprint-main-path { fill: #10b981; }
.footprint-hero.contaminating-init .pollution-spots-group circle { opacity: 0; transform: scale(0); }
.footprint-hero.cleansing-init .footprint-main-path { fill: #1e293b; }
.footprint-hero.cleansing-init .pollution-spots-group circle { opacity: 0.9; transform: scale(1); }

@keyframes shake-toxic {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(1px, 2px) rotate(1.5deg); }
}
@keyframes pulse-clean {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* 2. Heart Hero */
.heart-hero .heart-main-path {
    transition: fill 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    fill: #ec4899;
}
.heart-hero .heart-crack-path {
    transition: opacity 1.2s ease, stroke-dashoffset 1.5s ease;
    stroke-dasharray: 80;
    stroke-dashoffset: 0;
    opacity: 0;
}

/* State: Beaming (Heals, crack fades out, heart glows & beats happily) */
.heart-hero.beaming-heart .heart-main-path {
    fill: #ec4899 !important;
}
.heart-hero.beaming-heart .heart-crack-path {
    opacity: 0 !important;
    stroke-dashoffset: 80 !important;
}
.heart-hero.beaming-heart {
    filter: drop-shadow(0 0 20px rgba(236, 72, 153, 0.7));
    animation: heartbeat 1.2s infinite ease-in-out;
}

/* State: Breaking (Damages, crack appears, shakes under stress) */
.heart-hero.breaking-heart .heart-main-path {
    fill: #4b5563 !important;
}
.heart-hero.breaking-heart .heart-crack-path {
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
}
.heart-hero.breaking-heart {
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.4));
    animation: shake-broken 0.15s infinite alternate linear;
}

/* Init States */
.heart-hero.beaming-heart-init .heart-main-path { fill: #4b5563; }
.heart-hero.beaming-heart-init .heart-crack-path { opacity: 1; stroke-dashoffset: 0; }
.heart-hero.breaking-heart-init .heart-main-path { fill: #ec4899; }
.heart-hero.breaking-heart-init .heart-crack-path { opacity: 0; stroke-dashoffset: 80; }

@keyframes shake-broken {
    0% { transform: translate(-1px, -1px) rotate(-1deg); }
    100% { transform: translate(1px, 1px) rotate(1deg); }
}

/* 3. Time Hero */
.time-hero .time-rotate-group {
    transition: transform 1.5s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    transform-origin: center;
}
.time-hero .sand-level-top {
    transition: transform 2s ease;
    fill: #f59e0b;
}
.time-hero .sand-level-bottom {
    transition: transform 2s ease;
    fill: #f59e0b;
}
.time-hero .sand-stream-hero {
    transition: opacity 0.5s ease;
}

/* State: Draining (sand drops) */
.time-hero.time-draining .sand-level-top {
    transform: scaleY(0) !important;
}
.time-hero.time-draining .sand-level-bottom {
    transform: scaleY(1) !important;
}
.time-hero.time-draining .sand-stream-hero {
    opacity: 1 !important;
}
.time-hero.time-draining {
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.4));
}

/* State: Gaining (hourglass spins / flips) */
.time-hero.time-gaining .time-rotate-group {
    transform: rotate(180deg) !important;
}
.time-hero.time-gaining .sand-stream-hero {
    opacity: 0 !important;
}
.time-hero.time-gaining {
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.6));
}

/* Init States */
.time-hero.time-draining-init .sand-level-top { transform: scaleY(1); }
.time-hero.time-draining-init .sand-level-bottom { transform: scaleY(0); }
.time-hero.time-draining-init .sand-stream-hero { opacity: 0; }
.time-hero.time-gaining-init .time-rotate-group { transform: rotate(0deg); }

/* 4. Money Hero */
.money-hero .hero-coin-falling {
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1.2), opacity 1.2s ease;
    opacity: 0;
}
.money-hero .money-broken-group {
    transition: opacity 0.5s ease;
}
.money-hero .broken-left, .money-hero .broken-right {
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1.2);
    transform-origin: 50% 50%;
}

/* State: Shining (Coin falls & lands) */
.money-hero.shining-coins .hero-coin-falling {
    transform: translateY(52px) !important;
    opacity: 1 !important;
}
.money-hero.shining-coins {
    filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.6));
    animation: shine-bounce 1s ease-out;
}

/* State: Breaking (Gold coin splits) */
.money-hero.breaking-coin .money-normal-stack {
    opacity: 0 !important;
}
.money-hero.breaking-coin .money-broken-group {
    opacity: 1 !important;
}
.money-hero.breaking-coin .broken-left {
    transform: translate(-10px, 5px) rotate(-15deg) !important;
}
.money-hero.breaking-coin .broken-right {
    transform: translate(10px, 5px) rotate(15deg) !important;
}

/* Init States */
.money-hero.shining-coins-init .hero-coin-falling { transform: translateY(0); opacity: 0; }
.money-hero.breaking-coin-init .money-normal-stack { opacity: 1; }
.money-hero.breaking-coin-init .money-broken-group { opacity: 0; }
.money-hero.breaking-coin-init .broken-left { transform: translate(0) rotate(0); }
.money-hero.breaking-coin-init .broken-right { transform: translate(0) rotate(0); }

@keyframes shine-bounce {
    0%, 100% { transform: scale(1); }
    70% { transform: scale(1.08); }
}

/* ==============================================================================
   RESPONSIVE COMPRESSION FOR DESKTOP WITH LOW HEIGHT (LAPTOPS <= 1080p)
   ============================================================================== */
@media (min-width: 769px) and (max-height: 900px) {
    #fact-modal .modal-box {
        padding: 16px 24px !important;
        gap: 10px !important;
    }
    #fact-modal .modal-icon {
        font-size: 2.2rem !important;
        margin-bottom: 2px !important;
        margin-top: 2px !important;
    }
    #fact-modal h3 {
        font-size: 1.25rem !important;
        margin-top: 4px !important;
        margin-bottom: 4px !important;
    }
    #fact-modal #modal-hero-indicator {
        width: 100px !important;
        height: 100px !important;
        margin: 5px auto !important;
    }
    #explain-text {
        font-size: 0.95rem !important;
        margin-bottom: 10px !important;
        line-height: 1.4 !important;
    }
    #fact-modal .pedagogical-alert-box {
        font-size: 0.82rem !important;
        padding: 4px 10px !important;
        margin-bottom: 8px !important;
        margin-top: 2px !important;
    }
    #fact-modal .choice-variations-box {
        margin-bottom: 10px !important;
        padding: 8px 12px !important;
        gap: 6px !important;
    }
    #fact-modal .variation-badge {
        padding: 6px 12px !important;
        font-size: 0.82rem !important;
    }
    #fact-modal .modal-divider {
        padding-top: 8px !important;
        margin-top: 8px !important;
    }
    #fact-modal h4 {
        margin-bottom: 4px !important;
    }
    #fact-text {
        font-size: 0.88rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }
    #btn-close-fact {
        padding: 10px 16px !important;
        font-size: 0.95rem !important;
    }
}



