/* Glosgruvan - Styling */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #2c1810 0%, #1a0f08 100%);
    color: #fff;
    overflow: hidden;
}

#gameContainer {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.game-header {
    background: linear-gradient(90deg, #8B4513 0%, #A0522D 100%);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.home-btn {
    color: #fff;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.home-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.game-header h1 {
    color: #FFD700;
    font-weight: 900;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.score-display {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #8B4513;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== SPELSTATUS ===== */
#gameStatus {
    background: linear-gradient(90deg, #3C2415 0%, #2C1810 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #8B4513;
}

.word-display {
    display: flex;
    gap: 30px;
    align-items: center;
}

.source-word, .target-word {
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-word label, .target-word label {
    font-weight: 700;
    color: #FFD700;
    min-width: 80px;
}

#sourceWord {
    font-size: 1.4em;
    font-weight: 700;
    color: #fff;
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 8px;
    min-width: 150px;
    text-align: center;
}

.letter-boxes {
    display: flex;
    gap: 4px;
}

.letter-box {
    width: 35px;
    height: 35px;
    border: 2px solid #8B4513;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

.letter-box.filled {
    background: linear-gradient(45deg, #32CD32, #228B22);
    color: #fff;
    border-color: #228B22;
    box-shadow: 0 2px 8px rgba(50, 205, 50, 0.3);
    transform: scale(1.1);
}

.letter-box.active {
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.lesson-progress {
    font-weight: 700;
    color: #FFD700;
}

.time-display {
    font-family: 'Courier New', monospace;
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 4px;
}

/* ===== SPELOMRÅDE ===== */
#gameArea {
    flex: 1;
    position: relative;
    background: linear-gradient(180deg, #1a0f08 0%, #000 100%);
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

.controls-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9em;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.controls span {
    color: #FFD700;
}

/* ===== LÄXMENY ===== */
.lesson-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.menu-content {
    background: linear-gradient(135deg, #3C2415 0%, #2C1810 100%);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.menu-content h2 {
    color: #FFD700;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8em;
}

.lesson-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.lesson-filter label {
    color: #FFD700;
    font-weight: 700;
}

.lesson-filter select {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid #8B4513;
    padding: 8px;
    border-radius: 4px;
    font-family: inherit;
}

.lesson-list {
    max-height: 400px;
    overflow-y: auto;
}

.lesson-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid #8B4513;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lesson-item:hover {
    background: rgba(255,255,255,0.1);
    border-color: #FFD700;
    transform: translateY(-2px);
}

.lesson-item h3 {
    color: #FFD700;
    margin-bottom: 5px;
}

.lesson-info {
    display: flex;
    justify-content: space-between;
    color: #ccc;
    font-size: 0.9em;
}

.close-btn {
    width: 100%;
    background: linear-gradient(45deg, #8B4513, #A0522D);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: linear-gradient(45deg, #A0522D, #CD853F);
    transform: translateY(-2px);
}

/* ===== SPELSLUT ===== */
.game-complete {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-complete.hidden {
    display: none;
}

.complete-content {
    background: linear-gradient(135deg, #3C2415 0%, #2C1810 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.complete-content h2 {
    color: #FFD700;
    font-size: 2.5em;
    margin-bottom: 15px;
}

.final-stats {
    margin: 25px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.1);
    padding: 10px 15px;
    border-radius: 8px;
}

.complete-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 25px;
}

.btn-primary, .btn-secondary {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(45deg, #32CD32, #228B22);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #228B22, #006400);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(45deg, #8B4513, #A0522D);
    color: #fff;
}

.btn-secondary:hover {
    background: linear-gradient(45deg, #A0522D, #CD853F);
    transform: translateY(-2px);
}

/* ===== STARTSKÄRM ===== */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c1810 0%, #1a0f08 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.start-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.start-content h1 {
    color: #FFD700;
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
}

.game-description {
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.6;
    color: #ddd;
}

.how-to-play {
    background: rgba(255,255,255,0.1);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.how-to-play h3 {
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
}

.how-to-play ul {
    list-style: none;
    padding: 0;
}

.how-to-play li {
    margin-bottom: 10px;
    padding-left: 10px;
}

/* Läxval på startsidan */
.lesson-selection {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.lesson-selection h3 {
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
}

.lesson-list-start {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.lesson-item-start {
    background: rgba(255,255,255,0.05);
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.lesson-item-start:hover {
    background: rgba(255,255,255,0.1);
    border-color: #FFD700;
    transform: translateX(5px);
}

.lesson-item-start.selected {
    background: rgba(255,215,0,0.2);
    border-color: #FFD700;
    border-width: 3px;
    box-shadow: 0 0 15px rgba(255,215,0,0.4);
}

.lesson-item-start h4 {
    color: #FFD700;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.lesson-info-small {
    display: flex;
    justify-content: space-between;
    color: #ccc;
    font-size: 0.85em;
}

.no-lessons, .error-message {
    text-align: center;
    padding: 20px;
    color: #ffa500;
}

.start-btn {
    background: linear-gradient(45deg, #32CD32, #228B22);
    color: #fff;
    border: none;
    padding: 20px 40px;
    font-size: 1.5em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.start-btn:disabled {
    background: linear-gradient(45deg, #666, #444);
    cursor: not-allowed;
    opacity: 0.5;
}

.start-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #228B22, #006400);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(50, 205, 50, 0.3);
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    color: #FFD700;
    padding: 20px;
    font-style: italic;
}

/* ===== RESPONSIV ===== */
@media (max-width: 768px) {
    .game-header {
        padding: 8px 15px;
    }
    
    .header-left h1 {
        font-size: 1.2em;
    }
    
    #gameStatus {
        flex-direction: column;
        gap: 15px;
        padding: 10px 15px;
    }
    
    .word-display {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .controls-hint {
        bottom: 5px;
        right: 5px;
        font-size: 0.8em;
    }
    
    .start-content h1 {
        font-size: 2em;
    }
    
    .start-btn {
        font-size: 1.2em;
        padding: 15px 30px;
    }
}

/* Letter boxes for target word */
.letter-boxes {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 5px;
}

.letter-box {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #8B4513;
    border-radius: 4px;
    font-weight: bold;
    color: #FFF;
    transition: all 0.3s ease;
}

.letter-box.completed {
    background: #4ECDC4;
    border-color: #45B7D1;
    color: #000;
    transform: scale(1.1);
}

/* Fix for hidden elements */
.hidden {
    display: none !important;
}