/* ========================================
   כוכב הכפל - עיצוב כללי
   ======================================== */

/* איפוס ובסיס */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    direction: rtl;
}

/* ========================================
   מסכים
   ======================================== */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   מסך פתיחה
   ======================================== */
.home-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.game-title {
    font-size: 2.8em;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    margin-bottom: 5px;
    animation: titleBounce 2s ease infinite;
}

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

.game-subtitle {
    font-size: 1.3em;
    color: rgba(255,255,255,0.9);
    margin-bottom: 5px;
}

.total-stars-display {
    font-size: 1.1em;
    color: #FFD700;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    background: rgba(255,255,255,0.1);
    padding: 6px 20px;
    border-radius: 20px;
    display: inline-block;
}

.character-home {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

/* ========================================
   כפתורים
   ======================================== */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 40px;
    border: none;
    border-radius: 20px;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    width: 280px;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.btn-icon {
    font-size: 1.4em;
}

.btn-practice {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #1a5c3a;
}

.btn-time {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #8b3a50;
}

.btn-stars {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    color: #5a3d7a;
}

.btn-mix {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #7a4a2a;
    margin-top: 20px;
    width: 250px;
}

.btn-retry {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #1a5c3a;
}

.btn-next-level {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #7a4a2a;
}

.btn-home {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    color: #5a3d7a;
}

.btn-back {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    color: white;
    padding: 8px 20px;
    border-radius: 15px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-back:hover {
    background: rgba(255,255,255,0.3);
}

/* ========================================
   מסך בחירת לוח כפל
   ======================================== */
.screen-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
}

.screen-header h2 {
    color: white;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.select-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-width: 500px;
    width: 100%;
    margin-bottom: 10px;
}

.select-btn {
    background: rgba(255,255,255,0.9);
    border: 3px solid transparent;
    border-radius: 15px;
    padding: 15px;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #5a3d7a;
    font-family: inherit;
}

.select-btn:hover {
    transform: scale(1.1);
    border-color: #FFD700;
    box-shadow: 0 4px 15px rgba(255,215,0,0.4);
}

/* ========================================
   מסך שלבים - מסע הכוכבים
   ======================================== */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 550px;
    width: 100%;
}

.level-btn {
    background: rgba(255,255,255,0.9);
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 15px 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #5a3d7a;
    text-align: center;
    font-family: inherit;
    position: relative;
}

.level-btn:hover:not(.level-locked) {
    transform: scale(1.08);
    border-color: #FFD700;
}

.level-locked {
    background: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.5);
    cursor: not-allowed;
}

.level-stars {
    display: block;
    font-size: 0.8em;
    margin-top: 4px;
}

.level-number {
    display: block;
    font-size: 1.3em;
}

/* ========================================
   מסך משחק
   ======================================== */
.game-header {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.game-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-display {
    background: rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 20px;
    color: #FFD700;
    font-size: 1.2em;
    font-weight: bold;
    white-space: nowrap;
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #43e97b, #38f9d7);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.timer-display {
    background: rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 20px;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    white-space: nowrap;
}

.timer-display.timer-warning {
    background: rgba(255,59,48,0.5);
    animation: timerPulse 0.5s ease infinite;
}

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

.streak-display {
    color: #FFD700;
    font-size: 1.1em;
    font-weight: bold;
    min-height: 24px;
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 500px;
}

.character-game {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========================================
   שאלה ותשובות
   ======================================== */
.question-area {
    background: rgba(255,255,255,0.15);
    border-radius: 25px;
    padding: 25px 40px;
    margin: 10px 0;
    backdrop-filter: blur(10px);
}

.question-text {
    font-size: 3em;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    direction: ltr;
}

.num {
    background: rgba(255,255,255,0.2);
    padding: 5px 20px;
    border-radius: 15px;
    min-width: 70px;
    text-align: center;
}

.operator {
    color: #FFD700;
}

.equals {
    color: #FFD700;
}

.answer-mark {
    background: rgba(255,215,0,0.3);
    padding: 5px 25px;
    border-radius: 15px;
    color: #FFD700;
    animation: questionPulse 1.5s ease infinite;
}

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

.answers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 400px;
}

.answer-btn {
    background: rgba(255,255,255,0.9);
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 20px;
    font-size: 1.8em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #5a3d7a;
    font-family: inherit;
}

.answer-btn:hover {
    transform: scale(1.05);
    border-color: #a18cd1;
    box-shadow: 0 4px 15px rgba(161,140,209,0.4);
}

.answer-btn.correct {
    background: #43e97b;
    color: white;
    border-color: #2ecc71;
    animation: correctBounce 0.5s ease;
}

.answer-btn.wrong {
    background: #ff6b6b;
    color: white;
    border-color: #e74c3c;
    animation: wrongShake 0.5s ease;
}

.answer-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

@keyframes correctBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.15); }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

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

/* ========================================
   בועת דיבור
   ======================================== */
.speech-bubble {
    background: white;
    border-radius: 20px;
    padding: 12px 20px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 220px;
    font-size: 1.1em;
    color: #333;
    text-align: center;
    animation: bubbleAppear 0.3s ease;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border: 10px solid transparent;
    border-left-color: white;
}

.speech-bubble-small {
    font-size: 0.9em;
    padding: 8px 14px;
    max-width: 180px;
}

@keyframes bubbleAppear {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ========================================
   מסך סיכום
   ======================================== */
.summary-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.summary-container h2 {
    color: #FFD700;
    font-size: 2em;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.character-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-icon {
    font-size: 2em;
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    color: rgba(255,255,255,0.8);
    font-size: 0.95em;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    color: white;
    font-size: 2em;
    font-weight: bold;
    display: block;
}

.summary-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.summary-buttons .btn {
    width: auto;
    padding: 14px 30px;
    font-size: 1.1em;
}

/* ========================================
   מסך כניסה
   ======================================== */
.welcome-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.welcome-section {
    margin: 20px 0;
}

.welcome-label {
    display: block;
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.name-input {
    width: 280px;
    padding: 14px 20px;
    border: 3px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    background: rgba(255,255,255,0.9);
    font-size: 1.3em;
    font-family: inherit;
    text-align: center;
    color: #5a3d7a;
    outline: none;
    transition: all 0.3s ease;
    direction: rtl;
}

.name-input:focus {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255,215,0,0.4);
    transform: scale(1.02);
}

.name-input::placeholder {
    color: #b8a0d0;
}

.mascot-grid-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 380px;
    margin: 0 auto;
}

.mascot-card {
    background: rgba(255,255,255,0.15);
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mascot-card:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

.mascot-card-selected {
    border-color: #FFD700;
    background: rgba(255,215,0,0.2);
    box-shadow: 0 0 20px rgba(255,215,0,0.4);
    transform: scale(1.05);
}

.mascot-card-preview {
    font-size: 3em;
    margin-bottom: 4px;
}

.mascot-card-name {
    color: white;
    font-size: 1em;
    font-weight: bold;
}

.btn-start-game {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #1a5c3a;
    margin-top: 20px;
    width: 280px;
    font-size: 1.3em;
}

.btn-settings {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
    padding: 8px 20px;
    border-radius: 15px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-top: 10px;
}

.btn-settings:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.5);
}

/* ========================================
   רספונסיבי
   ======================================== */
@media (max-width: 600px) {
    .game-title {
        font-size: 2em;
    }

    .question-text {
        font-size: 2.2em;
    }

    .num {
        min-width: 50px;
        padding: 5px 12px;
    }

    .question-area {
        padding: 18px 25px;
    }

    .answer-btn {
        padding: 15px;
        font-size: 1.5em;
    }

    .btn {
        width: 240px;
        padding: 14px 30px;
        font-size: 1.1em;
    }

    .select-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }

    .select-btn {
        padding: 10px;
        font-size: 1.2em;
    }

    .levels-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }

    .speech-bubble {
        max-width: 180px;
        font-size: 0.95em;
    }
}

@media (max-width: 400px) {
    .select-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .levels-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .question-text {
        font-size: 1.8em;
        gap: 8px;
    }

    .answers-grid {
        gap: 10px;
    }
}
