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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a3e 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.splash-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 2s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.title {
    font-size: 2.5em;
    margin-bottom: 30px;
    font-weight: bold;
}

.auth-form {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 30px 0;
}

.auth-form label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    border: 2px solid rgba(100, 200, 255, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-bottom: 20px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: #64c8ff;
}

.btn-start, .btn-primary, .btn-secondary, .btn-finish {
    padding: 12px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #64c8ff 0%, #4a90e2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(100, 200, 255, 0.4);
}

.btn-start:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 200, 255, 0.6);
}

.btn-secondary {
    background: #666;
}

.btn-secondary:hover {
    background: #777;
}

.btn-finish {
    background: #ee5a6f;
}

.btn-finish:hover {
    background: #ff6b6b;
}

.game-info {
    margin-top: 30px;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
}

.game-info ul {
    list-style: none;
    padding: 10px 0;
}

.game-info li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Game Screen */
.game-screen {
    padding: 20px;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-info, .game-stats {
    display: flex;
    gap: 20px;
    font-size: 1.1em;
}

.level-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 15px;
    min-height: 500px;
}

.level-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #64c8ff;
}

.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}

.question {
    font-size: 1.5em;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 30px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

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

.answer-btn {
    padding: 20px;
    font-size: 1.1em;
    border: 2px solid rgba(100, 200, 255, 0.5);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.answer-btn:hover {
    background: rgba(100, 200, 255, 0.3);
}

.answer-btn.correct {
    background: rgba(76, 175, 80, 0.5);
    border-color: #4caf50;
}

.answer-btn.wrong {
    background: rgba(244, 67, 54, 0.5);
    border-color: #f44336;
}

.quiz-progress {
    text-align: center;
    font-size: 1.2em;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

#gameCanvas {
    display: block;
    margin: 20px auto;
    border: 2px solid rgba(100, 200, 255, 0.5);
    border-radius: 10px;
    background: #000;
}

.controls-hint {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.puzzle-hint {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.puzzle-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.puzzle-pieces-area {
    position: relative;
    width: 800px;
    height: 400px;
    border: 3px solid rgba(100, 200, 255, 0.5);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    overflow: hidden;
}

.puzzle-pieces-area h3 {
    margin: 0 0 10px 0;
    text-align: center;
    color: #64c8ff;
    font-size: 1.2em;
}

.puzzle-board {
    position: relative;
    width: 400px;
    height: 300px;
    border: 3px solid rgba(100, 200, 255, 0.5);
    border-radius: 10px;
    background: transparent;
    padding: 0;
    overflow: hidden;
}

.puzzle-board h3 {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    text-align: center;
    color: #64c8ff;
    font-size: 1.2em;
    z-index: 100;
    pointer-events: none;
    background: rgba(10, 14, 39, 0.8);
    padding: 5px 15px;
    border-radius: 5px;
}

.puzzle-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('puzzle.png');
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
    border-radius: 7px;
}

.puzzle-piece {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 2px solid rgba(100, 200, 255, 0.5);
    border-radius: 8px;
    cursor: move;
    transition: transform 0.3s ease, left 0.2s ease, top 0.2s ease;
    user-select: none;
    background-repeat: no-repeat;
    z-index: 10;
}

.puzzle-piece:hover {
    box-shadow: 0 5px 15px rgba(100, 200, 255, 0.5);
}

.puzzle-piece.dragging {
    opacity: 0.5;
}

.puzzle-piece.in-place {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.puzzle-piece.placed {
    cursor: default;
}

.puzzle-piece.rotation-error {
    border-color: #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.6);
}

.puzzle-piece.snapping {
    animation: snapAnimation 0.3s ease-out;
    z-index: 1000;
}

@keyframes snapAnimation {
    0% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

.puzzle-piece.in-place {
    border-color: #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    }
    50% {
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.9);
    }
}

.puzzle-board.puzzle-complete {
    animation: boardComplete 0.5s ease-out;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.8);
}

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

.confetti-piece {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(600px) rotate(720deg);
        opacity: 0;
    }
}

.puzzle-completion-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(56, 142, 60, 0.95));
    color: white;
    padding: 30px 60px;
    border-radius: 15px;
    font-size: 2.5em;
    font-weight: bold;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.5s ease-out;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.puzzle-completion-message.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.rating-screen {
    padding: 20px;
}

.results-container {
    max-width: 900px;
    margin: 0 auto;
}

.current-player-result {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.current-player-result h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #64c8ff;
    font-size: 2em;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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

.stat-label {
    font-weight: bold;
}

.stat-value {
    color: #64c8ff;
    font-size: 1.2em;
}

.rating-table {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rating-table h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #64c8ff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    background: rgba(100, 200, 255, 0.2);
    font-weight: bold;
    color: #64c8ff;
}

tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.action-buttons button {
    min-width: 150px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s;
}

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

.bounce {
    animation: bounce 0.5s;
}

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

.fade-in {
    animation: fadeIn 0.5s;
}


