/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Layout */
.screen {
    display: none;
    min-height: 100vh;
    padding: 1rem;
}

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

.container {
    max-width: 400px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    text-align: center;
}

.game-container {
    width: 100%;
    max-width: 600px;
    padding: 1rem;
}

/* Typography */
h1 {
    color: #667eea;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    font-weight: 300;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    font-weight: 400;
}

h3 {
    color: #555;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Answer Buttons */
.answers-grid {
    display: grid;
    gap: 1rem;
    margin: 2rem 0;
}

/* Default 2x2 grid for wider screens */
@media (min-width: 600px) {
    .answers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 4x1 grid for narrow screens */
@media (max-width: 599px) {
    .answers-grid {
        grid-template-columns: 1fr;
    }
}

.answer-btn {
    padding: 2rem 1rem;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.answer-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.answer-btn:active {
    transform: translateY(0) scale(0.98);
}

.answer-btn.selected {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.answer-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Answer button colors */
.answer-btn.red {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.answer-btn.blue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.answer-btn.yellow {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: #333;
}

.answer-btn.green {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

/* Symbol styles */
.answer-symbol {
    width: 48px;
    height: 48px;
    fill: currentColor;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    object-fit: contain;
}

/* For SVG symbols as images */
.answer-symbol img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.answer-text {
    font-size: 1rem;
    line-height: 1.2;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.answer-text.hidden {
    display: none;
}

/* Question display */
.question-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.question-text {
    font-size: 1.3rem;
    font-weight: 500;
    color: #333;
    flex: 1;
    text-align: left;
    margin-right: 1rem;
}

/* Timer */
.timer-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(#2ecc71 0deg, #2ecc71 0deg, #e74c3c 0deg, #e74c3c 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.1s linear;
}

.timer-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Waiting states */
.waiting-state {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    margin: 2rem 0;
}

.waiting-state p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Feedback */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.feedback-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.feedback-icon {
    font-size: 4rem;
}

.feedback-text {
    font-size: 1.5rem;
    font-weight: 500;
    color: #333;
}

.feedback-score {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

/* Player info */
.player-info {
    margin: 2rem 0;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
}

.player-info p {
    margin-bottom: 0.5rem;
    color: #555;
}

/* Waiting animation */
.waiting-animation {
    margin: 2rem 0;
}

.waiting-text {
    color: #666;
    font-style: italic;
}

/* Results */
.final-score {
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    text-align: center;
}

.score-display {
    font-size: 3rem;
    font-weight: bold;
    margin: 1rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.position-display {
    font-size: 1.5rem;
    margin-top: 1rem;
}

.leaderboard {
    margin: 2rem 0;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
}

.leaderboard-position {
    font-weight: bold;
    color: #667eea;
    margin-right: 1rem;
}

/* Settings */
.settings-button {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
}

.settings-button:hover {
    transform: scale(1.1);
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-panel {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.setting-item {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.setting-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    color: #333;
}

.setting-item input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 20px;
    height: 20px;
}

/* Error messages */
.error-message {
    color: #e74c3c;
    padding: 1rem;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 12px;
    margin-top: 1rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .question-info {
        flex-direction: column;
        gap: 1rem;
    }
    
    .question-text {
        text-align: center;
        margin-right: 0;
    }
    
    .timer-circle {
        width: 60px;
        height: 60px;
    }
    
    .timer-number {
        font-size: 1.2rem;
    }
    
    .answer-btn {
        min-height: 100px;
        padding: 1.5rem 1rem;
    }
    
    .answer-symbol {
        width: 36px;
        height: 36px;
    }
    
    .answer-symbol img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        filter: brightness(0) invert(1) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    }
}

/* Animation for answer selection */
@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(-5px) scale(1.05);
    }
    40% {
        transform: translateY(-8px) scale(1.08);
    }
    80% {
        transform: translateY(-3px) scale(1.03);
    }
}

.answer-btn.bounce {
    animation: bounce 0.6s ease-in-out;
}

/* Pulse animation for waiting */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

.waiting-animation .spinner {
    animation: spin 2s linear infinite, pulse 2s ease-in-out infinite;
}
