/* 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;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 1.8rem;
    color: #667eea;
    margin: 0;
}

.online-count, .room-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f4ff;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    color: #667eea;
}

.sound-toggle {
    background: #667eea;
    border: none;
    color: white;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 8px;
}

.sound-toggle:hover {
    background: #764ba2;
    transform: scale(1.1);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Action bar */
.action-bar {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

/* Main content */
main {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

.state-container {
    animation: fadeIn 0.3s ease-in;
}

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

/* Timer bar */
.timer-bar {
    background: #e5e7eb;
    height: 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    overflow: hidden;
    position: relative;
}

.timer-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 1s linear;
    border-radius: 20px;
}

.timer-fill.reveal {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Question card */
.question-card {
    margin-bottom: 30px;
}

.category {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.question {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 30px;
    line-height: 1.4;
}

/* Options */
.options {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.option-btn {
    background: white;
    border: 3px solid #e5e7eb;
    padding: 20px;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-weight: 500;
    color: #374151;
}

.option-btn:hover:not(:disabled) {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.option-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.option-btn.correct {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.option-btn.wrong {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.answer-stats {
    text-align: center;
    color: #6b7280;
    font-size: 0.95rem;
    margin-top: 15px;
}

/* Stats */
.stats {
    margin-top: 30px;
}

.stats h3 {
    font-size: 1.3rem;
    color: #1f2937;
    margin-bottom: 20px;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 3px solid;
}

.stat-item.correct {
    border-color: #10b981;
}

.stat-item.wrong {
    border-color: #ef4444;
}

.stat-item.neutral {
    border-color: #6b7280;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-item.correct .stat-number {
    color: #10b981;
}

.stat-item.wrong .stat-number {
    color: #ef4444;
}

.stat-item.neutral .stat-number {
    color: #6b7280;
}

.stat-label {
    font-size: 0.9rem;
    color: #6b7280;
}

/* Live answers list (during question phase) */
.live-answers {
    margin-top: 30px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.live-answers h3 {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-answer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
    border: 2px solid #e5e7eb;
    transition: all 0.3s;
}

.live-answer-item.waiting {
    opacity: 0.6;
}

.live-answer-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.live-answer-choice {
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 500;
    background: #f0f4ff;
    padding: 4px 12px;
    border-radius: 12px;
}

.live-answer-item.waiting .live-answer-choice {
    color: #9ca3af;
    background: #f3f4f6;
}

/* Answers list */
.answers-list {
    margin-top: 30px;
}

.answers-list h3 {
    font-size: 1.2rem;
    color: #1f2937;
    margin-bottom: 15px;
}

.answer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid;
}

.answer-item.correct {
    background: #d1fae5;
    border-color: #10b981;
}

.answer-item.wrong {
    background: #fee2e2;
    border-color: #ef4444;
}

.answer-item.neutral {
    background: #f3f4f6;
    border-color: #6b7280;
}

.answer-name {
    font-weight: 600;
    color: #1f2937;
}

.answer-choice {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    display: block;
    width: 100%;
    margin-top: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Cards */
.card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 20px;
}

.card ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.card ul li {
    margin-bottom: 8px;
    color: #4b5563;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

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

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6b7280;
    font-size: 0.85rem;
}

/* Messages */
.error-message {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid #dc2626;
}

.success-message {
    background: #d1fae5;
    color: #059669;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid #059669;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.3s ease-out;
}

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

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #1f2937;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 30px;
}

.qr-container {
    text-align: center;
    margin-bottom: 20px;
}

.qr-container img {
    max-width: 200px;
    border-radius: 8px;
}

.copy-container {
    display: flex;
    gap: 10px;
}

.copy-container input {
    flex: 1;
}

/* Members list */
.members-list {
    margin: 20px 0;
}

.members-list h3 {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 10px;
}

.member-item {
    background: #f9fafb;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid #667eea;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #6b7280;
    font-size: 1.1rem;
}

/* Utility */
.text-center {
    text-align: center;
}

/* Admin panel */
.admin-panel {
    max-width: 600px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 15px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    main {
        padding: 20px;
    }

    .question {
        font-size: 1.4rem;
    }

    .option-btn {
        padding: 15px;
        font-size: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-content {
        margin: 10px;
    }

    .modal-body {
        padding: 20px;
    }

    .copy-container {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.2rem;
    }

    .question {
        font-size: 1.2rem;
    }

    .option-btn {
        font-size: 0.95rem;
    }
}
