/* ==================== GLOBAL STYLES ==================== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.5s ease-in;
}

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

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

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

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

/* ==================== CARD STYLES ==================== */
.setup-card,
.results-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
}

.title {
    font-size: 2.5rem;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* ==================== FORM STYLES ==================== */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1rem;
}

.form-group small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 5px;
}

input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ==================== SLIDER STYLES ==================== */
.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 50px;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* ==================== TOPICS GRID ==================== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.topic-checkbox {
    position: relative;
}

.topic-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.topic-checkbox label {
    display: block;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    background: #f9fafb;
}

.topic-checkbox input[type="checkbox"]:checked + label {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.topic-checkbox label:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

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

.btn-success {
    background: var(--success-color);
    color: white;
    flex: 1;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    flex: 1;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

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

.form-actions .btn {
    width: 100%;
}

/* ==================== GAME STYLES ==================== */
.game-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 1.1rem;
}

.round-info,
.team-info {
    font-weight: 600;
    color: var(--text-primary);
}

.team-info strong {
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* ==================== SCOREBOARD ==================== */
.scoreboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.score-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.score-item.active {
    border: 3px solid var(--primary-color);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
    animation: pulse 1.5s infinite;
}

.score-team-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ==================== QUESTION CARD ==================== */
.question-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow);
    position: relative;
}

/* ==================== TIMER ==================== */
.timer-container {
    position: absolute;
    top: -40px;
    right: 30px;
    width: 100px;
    height: 100px;
}

.timer-circle {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-progress.warning {
    stroke: var(--warning-color);
}

.timer-progress.danger {
    stroke: var(--danger-color);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ==================== QUESTION CONTENT ==================== */
.question-label {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 30px;
    min-height: 80px;
}

/* ==================== ANSWER SECTION ==================== */
.answer-section {
    background: #f0fdf4;
    border-left: 4px solid var(--success-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    animation: fadeIn 0.5s ease-in;
}

.answer-label {
    font-size: 1rem;
    color: var(--success-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.answer-text {
    font-size: 1.2rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ==================== GAME ACTIONS ==================== */
.game-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.scoring-buttons {
    display: flex;
    gap: 15px;
    animation: fadeIn 0.5s ease-in;
}

/* ==================== TOPIC BADGE ==================== */
.topic-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
    animation: fadeIn 0.5s ease-in;
}

/* ==================== RESULTS STYLES ==================== */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin: 40px 0;
    min-height: 200px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.podium-block {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px 12px 0 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 120px;
    position: relative;
}

.podium-place:nth-child(1) .podium-block {
    height: 180px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    animation: bounce 1s ease-in-out;
}

.podium-place:nth-child(2) .podium-block {
    height: 140px;
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
}

.podium-place:nth-child(3) .podium-block {
    height: 100px;
    background: linear-gradient(135deg, #fb923c, #f97316);
}

.podium-position {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.podium-info {
    text-align: center;
    margin-top: 10px;
}

.podium-team {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.podium-score {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.scoreboard-final {
    margin: 30px 0;
}

.final-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
}

.final-score-item:first-child {
    background: #fef3c7;
    border-left-color: #f59e0b;
}

.final-team {
    font-weight: 600;
    font-size: 1.1rem;
}

.final-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.results-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.results-actions .btn {
    flex: 1;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .setup-card,
    .results-card {
        padding: 25px;
    }

    .question-card {
        padding: 30px 20px;
    }

    .timer-container {
        position: static;
        margin: 0 auto 20px;
    }

    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .scoreboard {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .podium {
        gap: 10px;
    }

    .podium-block {
        min-width: 90px;
    }

    .results-actions {
        flex-direction: column;
    }

    .topic-badge {
        position: static;
        margin-top: 20px;
        text-align: center;
    }
}
