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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Card styles */
.card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.quiz-card {
    min-height: 400px;
}

.results-card {
    padding: 50px;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 10px;
    text-align: center;
}

h2 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 30px;
    line-height: 1.4;
}

h3 {
    font-size: 1.2rem;
    color: #667eea;
    margin-bottom: 15px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* Form styles */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Button styles */
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Quiz header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-info {
    font-size: 1rem;
    color: #555;
}

.username-display strong {
    color: #667eea;
}

.question-counter {
    font-size: 1rem;
    font-weight: 600;
    color: #764ba2;
}

/* Question content */
#questionContent {
    margin-bottom: 20px;
}

#mediaContent {
    margin: 20px 0;
    text-align: center;
}

#questionImage {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin: 20px 0;
}

#questionAudio {
    width: 100%;
    max-width: 400px;
    margin: 20px 0;
}

/* Answers container */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-btn {
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
}

.answer-btn:hover:not(:disabled) {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(4px);
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.answer-btn.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Waiting message */
.waiting-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Participants list */
.participants {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.participants ul {
    list-style: none;
}

.participants li {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.participants li:last-child {
    border-bottom: none;
}

.participants li.answered {
    color: #4caf50;
    font-weight: 600;
}

/* Results styles */
.results-container {
    margin: 30px 0;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #f8f9ff;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.result-item.winner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-color: #ffd700;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
    transform: scale(1.02);
}

.result-item.winner .result-username::before {
    content: "👑 ";
}

.result-username {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.result-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.result-item.winner .result-score {
    color: #764ba2;
}

.results-actions {
    margin-top: 30px;
    text-align: center;
}

/* Error message */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #c62828;
}

/* Responsive design */
@media (max-width: 600px) {
    .card {
        padding: 25px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .result-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Tab styles */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Session created styles */
.success-message {
    text-align: center;
    padding: 20px;
}

.session-id-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
    border: 2px solid #667eea;
}

.session-id-display code {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.btn-secondary {
    padding: 8px 16px;
    background: #764ba2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    width: auto;
}

.btn-secondary:hover {
    background: #5e3a82;
}

.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Character images - 4 corners */
.character-top-left,
.character-top-right,
.character-bottom-left,
.character-bottom-right {
    position: fixed;
    width: 180px;
    height: auto;
    z-index: 10;
    pointer-events: none;
}

.character-top-left {
    top: 20px;
    left: 20px;
}

.character-top-right {
    top: 20px;
    right: 20px;
}

.character-bottom-left {
    bottom: 20px;
    left: 20px;
}

.character-bottom-right {
    bottom: 20px;
    right: 20px;
}

@media (max-width: 1200px) {
    .character-top-left,
    .character-top-right,
    .character-bottom-left,
    .character-bottom-right {
        width: 130px;
    }
}

@media (max-width: 768px) {
    .character-top-left,
    .character-top-right,
    .character-bottom-left,
    .character-bottom-right {
        width: 90px;
    }
    
    .character-top-left,
    .character-bottom-left {
        left: 10px;
    }
    
    .character-top-right,
    .character-bottom-right {
        right: 10px;
    }
    
    .character-top-left,
    .character-top-right {
        top: 10px;
    }
    
    .character-bottom-left,
    .character-bottom-right {
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    .character-top-left,
    .character-top-right,
    .character-bottom-left,
    .character-bottom-right {
        display: none;
    }
}
