/* MathIceGame - Kompletní styling */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow-x: hidden;
}

/* ========== SCREENS ========== */
.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: block;
    opacity: 1;
}

/* ========== MENU SCREEN ========== */
#menuScreen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.menu-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.menu-container h1 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.menu-container .subtitle {
    color: #666;
    margin-bottom: 30px;
}

.difficulty-selection {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.difficulty-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.difficulty-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.difficulty-btn .diff-title {
    font-size: 1.5rem;
}

.difficulty-btn .diff-desc {
    font-size: 0.9rem;
    opacity: 0.9;
}

.difficulty-btn[data-difficulty="easy"] {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
}

.difficulty-btn[data-difficulty="medium"] {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #333;
}

.difficulty-btn[data-difficulty="hard"] {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.high-scores-preview {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.high-scores-preview h3 {
    color: #667eea;
    margin-bottom: 15px;
}

#highScoresList {
    max-height: 200px;
    overflow-y: auto;
}

.score-item {
    display: grid;
    grid-template-columns: 30px 1fr 80px 50px;
    gap: 10px;
    padding: 10px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
}

.score-item.top-score {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: white;
    font-weight: bold;
}

.score-item .rank {
    font-weight: bold;
    color: #667eea;
}

.score-item.top-score .rank {
    color: #ffd700;
}

.score-item .name {
    text-align: left;
}

.score-item .points {
    font-weight: bold;
    text-align: right;
}

.score-item .level {
    text-align: center;
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* ========== GAME SCREEN ========== */
#gameScreen {
    flex-direction: column;
    padding-top: 55px;
}

#gameScreen.active {
    display: flex;
}

/* Status Bar - FIXED aby byl vždy nahoře */
.status-bar {
    background: rgba(255,255,255,0.98);
    padding: 12px 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 55px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-item.center {
    justify-content: center;
}

.status-item.right {
    justify-content: flex-end;
}

.status-label {
    font-weight: bold;
    color: #666;
    font-size: 0.9rem;
}

#lives {
    display: flex;
    gap: 5px;
}

.heart {
    font-size: 1.5rem;
    transition: transform 0.3s;
}

.heart.lost {
    transform: scale(0.5);
    opacity: 0.3;
}

#levelDisplay {
    font-size: 1.8rem;
    font-weight: 900;
    color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0 10px;
}

#scoreDisplay {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

/* Game Area - už bez padding-top, je na #gameScreen */
#gameArea {
    flex: 1;
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.game-row {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 12px 15px;
    display: grid;
    grid-template-columns: auto 140px 1fr;
    gap: 15px;
    align-items: center;
    transition: all 0.3s ease;
    opacity: 0.6;
    position: relative;
    min-height: 60px;
}

.game-row.active {
    opacity: 1;
    background: rgba(132, 250, 176, 0.3);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
    transform: scale(1.02);
}

.game-row.completed {
    opacity: 0.5;
    background: rgba(200,200,200,0.3);
}

.player-icon {
    font-size: 2rem;
    position: absolute;
    right: -50px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.row-question {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    min-width: 140px;
    margin-right: 20px;
}

.row-question .num {
    color: #667eea;
}

.row-question .op {
    color: #764ba2;
    font-size: 1.1rem;
}

.row-question .eq {
    color: #999;
}

.row-answers {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-left: 100px;
}

.answer-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.answer-btn:disabled {
    background: #ddd;
    color: #999;
    cursor: not-allowed;
}

.answer-btn:not(:disabled):hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.answer-btn:not(:disabled):active {
    transform: scale(0.95);
}

/* Feedback */
.feedback {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 1.2rem;
    animation: fadeInOut 0.8s ease;
}

.feedback.correct {
    color: #28a745;
}

.feedback.wrong {
    color: #dc3545;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-50%) scale(0.5); }
    50% { opacity: 1; transform: translateY(-50%) scale(1.2); }
    100% { opacity: 0; transform: translateY(-50%) scale(0.8); }
}

/* Flash animations */
.flash-green {
    animation: flashGreen 0.6s ease;
}

.flash-red {
    animation: flashRed 0.6s ease;
}

@keyframes flashGreen {
    0%, 100% { background: rgba(255,255,255,0.95); }
    50% { background: rgba(40, 167, 69, 0.3); }
}

@keyframes flashRed {
    0%, 100% { background: rgba(255,255,255,0.95); }
    50% { background: rgba(220, 53, 69, 0.3); }
}

/* Level Up Overlay */
.level-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.level-up-content {
    background: white;
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    animation: scaleIn 0.5s ease;
}

.level-up-content h2 {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 10px;
}

.level-up-content p {
    font-size: 1.3rem;
    color: #666;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ========== END SCREEN ========== */
#endScreen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.end-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.end-container h1 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.final-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    gap: 20px;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    flex: 1;
}

.stat-box .label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-box .value {
    font-size: 2rem;
    font-weight: bold;
    margin-top: 5px;
}

.end-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.end-buttons button {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.end-buttons button:hover {
    transform: translateY(-2px);
}

#playAgainBtn {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #333;
}

#mainMenuBtn {
    background: #6c757d;
    color: white;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .status-bar {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
    }
    
    .status-item, .status-item.center, .status-item.right {
        justify-content: center;
    }
    
    #gameArea {
        padding: 55px 15px 20px 15px;
    }
    
    .game-row {
        grid-template-columns: auto 110px 1fr;
        gap: 10px;
        padding: 10px;
    }
    
    .row-question {
        font-size: 1.1rem;
        min-width: 110px;
        margin-right: 10px;
    }
    
    .row-answers {
        margin-left: 50px;
    }
    
    .player-icon {
        right: -40px;
        font-size: 1.5rem;
    }
    
    .answer-btn {
        padding: 10px 15px;
        font-size: 1rem;
        min-width: 50px;
    }
    
    .menu-container, .end-container {
        padding: 30px 20px;
    }
    
    .menu-container h1, .end-container h1 {
        font-size: 2rem;
    }
}

@media (max-width: 400px) {
    .row-answers {
        flex-direction: column;
    }
    
    .answer-btn {
        width: 100%;
    }
}
