* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    overflow: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Welcome Screen */
.welcome-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 25px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid #4f46e5;
}

.star-icon {
    font-size: 80px;
    animation: twinkle 2s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

.main-title {
    font-size: 2.5rem;
    color: #fbbf24;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    color: #e0e7ff;
    margin-bottom: 25px;
}

.instructions-box {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid #4f46e5;
}

.instructions-title {
    font-size: 1.6rem;
    color: #fbbf24;
    margin-bottom: 15px;
    font-weight: 700;
}

.instructions-list {
    list-style: none;
    margin-bottom: 20px;
}

.instructions-list li {
    font-size: 1rem;
    color: #e0e7ff;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon {
    font-size: 1.5rem;
}

.info-box {
    background: rgba(79, 70, 229, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #6366f1;
}

.info-box h3 {
    color: #a5b4fc;
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.info-box p {
    color: #e0e7ff;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.galaxy-info {
    background: rgba(99, 102, 241, 0.3);
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.galaxy-info p {
    margin: 0;
    font-weight: 600;
}

.scoring-info {
    background: rgba(251, 191, 36, 0.1);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #fbbf24;
}

.scoring-info h3 {
    color: #fbbf24;
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.score-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-item-info {
    background: rgba(30, 41, 59, 0.6);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #e0e7ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-item-info.penalty {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
}

.score-item-info span {
    font-weight: 700;
    color: #fbbf24;
}

.score-item-info.penalty span {
    color: #fca5a5;
}

.btn-start {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    padding: 18px 50px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
    transition: all 0.3s ease;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.7);
}

/* Game Screen */
.game-wrapper {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.stat-box {
    background: linear-gradient(135deg, #1e293b, #334155);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    flex: 1;
    text-align: center;
    border: 1px solid #4f46e5;
}

.stat-label {
    font-size: 0.9rem;
    color: #a5b4fc;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    color: #fbbf24;
    font-weight: 800;
}

.timer-box .stat-value {
    color: #fbbf24;
}

.constellation-info {
    background: linear-gradient(135deg, #1e293b, #334155);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: center;
    border: 2px solid #4f46e5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.constellation-name {
    font-size: 2rem;
    color: #fbbf24;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.constellation-hint {
    font-size: 1.1rem;
    color: #e0e7ff;
    margin-bottom: 12px;
}

.progress-info {
    font-size: 1.2rem;
    color: #a5b4fc;
    font-weight: 600;
}

.progress-info span:last-child {
    color: #fbbf24;
    font-weight: 800;
}

.star-canvas {
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0f172a 100%);
    height: 550px;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    border: 3px solid #4f46e5;
    margin-bottom: 15px;
}

.lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, #fbbf24 0%, #f59e0b 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1e293b;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
}

.star:hover {
    transform: scale(1.3);
    box-shadow: 0 0 30px rgba(251, 191, 36, 1);
}

.star.connected {
    background: radial-gradient(circle, #10b981 0%, #059669 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
}

.star.current {
    animation: pulse 1s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(251, 191, 36, 1);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.star.hint {
    animation: hintPulse 1.5s ease-in-out 3;
}

@keyframes hintPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.8); }
    50% { box-shadow: 0 0 50px rgba(96, 165, 250, 1); transform: scale(1.4); }
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-reset, .btn-hint, .btn-pause {
    background: linear-gradient(135deg, #334155, #475569);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #4f46e5;
}

.btn-reset:hover, .btn-hint:hover, .btn-pause:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(79, 70, 229, 0.5);
}

/* Pause Screen */
.pause-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 25px;
    padding: 50px 40px;
    text-align: center;
    border: 2px solid #4f46e5;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.pause-card h2 {
    font-size: 2.5rem;
    color: #fbbf24;
    margin-bottom: 15px;
}

.pause-card p {
    font-size: 1.3rem;
    color: #e0e7ff;
    margin-bottom: 30px;
}

.pause-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn-resume, .btn-quit {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 15px 35px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-resume {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-resume:hover {
    transform: scale(1.05);
}

.btn-quit {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

.btn-quit:hover {
    transform: scale(1.05);
}

/* Level Complete Screen */
.level-complete-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 25px;
    padding: 40px 35px;
    text-align: center;
    border: 2px solid #fbbf24;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    max-width: 600px;
    margin: 0 auto;
}

.complete-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.complete-title {
    font-size: 2.5rem;
    color: #fbbf24;
    margin-bottom: 20px;
    font-weight: 800;
}

.constellation-fact {
    background: rgba(79, 70, 229, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    font-size: 1.1rem;
    color: #e0e7ff;
    line-height: 1.7;
    border: 1px solid #6366f1;
}

.level-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 25px;
}

.level-stat {
    background: rgba(251, 191, 36, 0.1);
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid #fbbf24;
}

.level-stat span:first-child {
    display: block;
    color: #a5b4fc;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value-large {
    font-size: 2rem;
    color: #fbbf24;
    font-weight: 800;
}

.btn-next-level {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
    transition: all 0.3s ease;
}

.btn-next-level:hover {
    transform: scale(1.05);
}

/* Results Screen */
.results-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 25px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid #4f46e5;
}

.result-icon {
    font-size: 100px;
    margin-bottom: 15px;
    animation: twinkle 2s ease-in-out infinite;
}

.result-title {
    font-size: 3rem;
    color: #fbbf24;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.result-message {
    font-size: 1.2rem;
    color: #e0e7ff;
    margin-bottom: 25px;
}

.final-score-box {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    border: 2px solid #fbbf24;
}

.final-score-label {
    font-size: 1.3rem;
    color: #a5b4fc;
    font-weight: 600;
    margin-bottom: 10px;
}

.final-score {
    font-size: 4rem;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.stats-breakdown {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #4f46e5;
}

.breakdown-title {
    font-size: 1.4rem;
    color: #fbbf24;
    margin-bottom: 15px;
    font-weight: 700;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    color: #e0e7ff;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(165, 180, 252, 0.2);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-highlight {
    font-weight: 700;
    color: #fbbf24;
}

.learning-box {
    background: rgba(79, 70, 229, 0.2);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    text-align: left;
    border: 1px solid #6366f1;
}

.learning-box h3 {
    color: #a5b4fc;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.learning-box p {
    color: #e0e7ff;
    font-size: 1.05rem;
    line-height: 1.7;
}

.results-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-play-again, .btn-exit {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 15px 35px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-play-again {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-play-again:hover {
    transform: scale(1.05);
}

.btn-exit {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

.btn-exit:hover {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2rem;
    }
    
    .star-canvas {
        height: 450px;
    }
    
    .results-buttons, .pause-buttons {
        flex-direction: column;
    }
    
    .btn-play-again, .btn-exit, .btn-resume, .btn-quit {
        width: 100%;
    }
    
    .level-stats {
        flex-direction: column;
    }
}