/* Updated CSS Stylesheet for Estaba Vocabulary Adventure - Premium Soft Theme */

:root {
    --game-primary: #8b5cf6;
    --game-secondary: #a78bfa;
    --game-accent: #ffb300;
    --game-success: #10b981;
    --game-danger: #ef4444;
    --game-dark: #1e293b;
    --game-light: #f8fafc;
    
    /* Gentle, soft pastel gradients */
    --bg-gradient: linear-gradient(135deg, #f0f7ff 0%, #eef2ff 50%, #f5f3ff 100%);
    --card-gradient: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    
    --game-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.12);
    --game-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Base Font Override to 'Assistant' and 'Rubik' */
body, .game-container, .btn-play, .trivia-btn, .match-card, .drag-item {
    font-family: 'Assistant', 'Rubik', sans-serif !important;
}

/* Game Main Container - Soft, light and premium styling */
.game-container {
    background: var(--bg-gradient);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--game-shadow);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
    z-index: 2;
}

/* Ambient Drifting Bubbles (Gentle Background Animation) */
.ambient-bubbles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.ambient-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
    animation: driftBubble 25s linear infinite;
    pointer-events: none;
}

.bubble-1 { width: 300px; height: 300px; left: -100px; top: 10%; animation-duration: 30s; }
.bubble-2 { width: 400px; height: 400px; right: -150px; bottom: 5%; animation-duration: 45s; }
.bubble-3 { width: 250px; height: 250px; left: 40%; top: 50%; animation-duration: 35s; background: radial-gradient(circle, rgba(16, 185, 129, 0.04) 0%, transparent 70%); }

@keyframes driftBubble {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Gentle floating animation for Title */
.gentle-pulse {
    animation: floatTitle 3s ease-in-out infinite;
}

@keyframes floatTitle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Header Game Stats UI */
.game-stats-bar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 12px 28px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    position: relative;
    z-index: 5;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #334155;
}

.stat-item i {
    font-size: 1.3rem;
}

.stat-item.hearts i {
    color: var(--game-danger);
    animation: pulseHeart 1.5s infinite;
}

.stat-item.coins i {
    color: var(--game-accent);
    animation: spinCoin 3s linear infinite;
}

.stat-item.score i {
    color: #0284c7;
}

.stat-item.music-toggle {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.5);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--game-transition);
}

.stat-item.music-toggle:hover {
    background: #eef2ff;
    transform: scale(1.05);
}

.stat-item.music-toggle i {
    color: var(--game-primary);
}

@keyframes pulseHeart {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes spinCoin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* Adventure Progress Map (Duolingo Style - Meadow Pastel) */
.adventure-map {
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    border-radius: 20px;
    padding: 50px 40px;
    position: relative;
    min-height: 550px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    gap: 50px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 0 25px rgba(139, 92, 246, 0.05);
    z-index: 3;
}

.map-svg-connector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.map-node-path {
    stroke: var(--game-secondary);
    stroke-width: 6;
    stroke-dasharray: 12 8;
    fill: none;
    opacity: 0.5;
}

.map-node {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: white;
    border: 6px solid #cbd5e1;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    z-index: 5;
    transition: var(--game-transition);
    color: #64748b;
}

.map-node:hover {
    transform: scale(1.15) translateY(-5px);
}

.map-node.unlocked {
    background: linear-gradient(135deg, var(--game-primary), var(--game-secondary));
    border-color: white;
    color: white;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}

.map-node.active-node {
    background: linear-gradient(135deg, var(--game-accent), #f97316);
    border-color: white;
    color: white;
    box-shadow: 0 8px 20px rgba(251, 146, 60, 0.4);
    animation: bounceActiveNode 2s infinite;
}

.map-node.active-node::after {
    content: 'שחקו כאן!';
    position: absolute;
    top: -30px;
    background: var(--game-accent);
    color: #1e293b;
    padding: 3px 12px;
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(251, 146, 60, 0.2);
    animation: floatText 1.5s ease-in-out infinite;
}

.map-node.completed {
    background: var(--game-success);
    border-color: white;
    color: white;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.map-node.locked {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.map-node i {
    font-size: 1.6rem;
}

.map-node-title {
    position: absolute;
    bottom: -32px;
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    color: #475569;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(5px);
    padding: 2px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.03);
}

@keyframes bounceActiveNode {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.04); }
}

@keyframes floatText {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Screens / Game Modes Panels */
.game-screen {
    display: none;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 4;
}

.game-screen.active {
    display: block;
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Mode 1: Matching Card Styles (Gentle Pastel Glass) */
.matching-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 15px;
    margin-top: 25px;
}

.match-card {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(139, 92, 246, 0.1);
    border-radius: 16px;
    padding: 20px 10px;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    user-select: none;
    transition: var(--game-transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 85px;
    color: #475569;
}

.match-card:hover {
    border-color: var(--game-primary);
    background: rgba(139, 92, 246, 0.08);
    transform: translateY(-2px);
    color: var(--game-primary);
}

.match-card.selected {
    border-color: var(--game-secondary);
    background: rgba(168, 85, 247, 0.12);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
    color: var(--game-dark);
}

.match-card.matched {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: var(--game-success) !important;
    color: var(--game-success) !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    animation: popSuccess 0.4s ease-out;
}

/* Mode 2: Trivia Towers */
.trivia-timer-wrapper {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 25px;
}

.trivia-timer-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--game-secondary), var(--game-primary));
    transition: width 0.1s linear;
}

.trivia-timer-bar.critical {
    background: var(--game-danger);
    animation: pulseCritical 0.5s infinite;
}

@keyframes pulseCritical {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.trivia-question-box {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.7);
    margin-bottom: 25px;
}

.trivia-question {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--game-dark);
}

.trivia-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (max-width: 576px) {
    .trivia-choices {
        grid-template-columns: 1fr;
    }
}

.trivia-btn {
    background: rgba(255, 255, 255, 0.75);
    border: 2px solid rgba(139, 92, 246, 0.1);
    border-radius: 16px;
    padding: 18px 24px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: var(--game-transition);
    text-align: right;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trivia-btn:hover {
    border-color: var(--game-primary);
    background: rgba(139, 92, 246, 0.05);
    transform: translateY(-2px);
    color: var(--game-primary);
}

.trivia-btn.correct {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: var(--game-success) !important;
    color: #065f46 !important;
}

.trivia-btn.wrong {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: var(--game-danger) !important;
    color: #991b1b !important;
}

/* Mode 3: Completion Cave */
.completion-sentence-box {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    line-height: 2.5;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 30px;
    color: #334155;
}

.sentence-slot {
    display: inline-flex;
    min-width: 130px;
    height: 42px;
    border-bottom: 3px dashed var(--game-primary);
    margin: 0 10px;
    vertical-align: middle;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 6px;
    transition: var(--game-transition);
    font-weight: 700;
    cursor: pointer;
}

.sentence-slot.dragover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--game-secondary);
}

.drag-pool {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.7);
}

.drag-item {
    background: white;
    border: 2px solid rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    padding: 8px 22px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 5px rgba(139, 92, 246, 0.03);
    transition: var(--game-transition);
    color: #475569;
}

.drag-item:hover {
    border-color: var(--game-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(139, 92, 246, 0.1);
    color: var(--game-primary);
}

.drag-item.selected {
    border-color: var(--game-secondary);
    background: rgba(168, 85, 247, 0.05);
}

/* Mode 4: Memory Grid */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 650px;
    margin: 25px auto;
}

@media (max-width: 480px) {
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.memory-card {
    height: 100px;
    perspective: 1000px;
    cursor: pointer;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.03);
    border-radius: 16px;
}

.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front, .memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: 2px solid rgba(139, 92, 246, 0.1);
    font-weight: 700;
    padding: 10px;
}

.memory-card-front {
    background: linear-gradient(135deg, var(--game-secondary), var(--game-primary));
    color: white;
    border-color: white;
}

.memory-card-front i {
    font-size: 1.8rem;
}

.memory-card-back {
    background: white;
    color: #475569;
    transform: rotateY(180deg);
    font-size: 0.95rem;
}

.memory-card.matched-card .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card.matched-card .memory-card-back {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--game-success);
    color: var(--game-success);
}

/* Mode 5: Boss Fight Arena (Gentle Dark Sky Theme) */
.boss-arena {
    background: linear-gradient(180deg, #1e1b4b 0%, #111827 100%);
    border-radius: 24px;
    padding: 30px;
    color: white;
    text-align: center;
    position: relative;
    border: 1px solid #312e81;
    overflow: hidden;
}

.boss-character-wrapper {
    position: relative;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.boss-image {
    width: 120px;
    height: 120px;
    font-size: 6.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bossHover 4s ease-in-out infinite;
    z-index: 2;
    transition: all 0.2s ease;
}

.boss-image.hit {
    animation: bossHitShake 0.4s ease;
    filter: brightness(2) drop-shadow(0 0 15px var(--game-danger));
    transform: scale(0.9);
}

.boss-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 1;
    animation: glowPulse 2s ease-in-out infinite;
}

.boss-health-bar-container {
    max-width: 400px;
    margin: 10px auto 30px auto;
}

.boss-health-bar {
    width: 100%;
    height: 14px;
    background: #1e1b4b;
    border-radius: 10px;
    border: 1px solid #4338ca;
    overflow: hidden;
}

.boss-health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f87171);
    transition: width 0.3s ease;
}

.boss-question-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.1);
}

.boss-choice-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 700;
    transition: var(--game-transition);
}

.boss-choice-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--game-secondary);
}

@keyframes bossHover {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes bossHitShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

@keyframes glowPulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* Success Pop Keyframe */
@keyframes popSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* Screen Shake (For errors) */
.shake {
    animation: shakeScreen 0.5s ease;
}

@keyframes shakeScreen {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-8px); }
    30%, 60%, 90% { transform: translateX(8px); }
}

/* Confetti Particles Container */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: particleFall 1s ease-out forwards;
}

@keyframes particleFall {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--x), var(--y)) scale(0.3); opacity: 0; }
}

/* Shop panel styling */
.shop-item-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px 15px;
    text-align: center;
    transition: var(--game-transition);
}

.shop-item-card:hover {
    border-color: var(--game-secondary);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(139, 92, 246, 0.05);
}

.shop-item-card i {
    font-size: 2.2rem;
    margin-bottom: 12px;
}
