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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1d2021;
    min-height: 100vh;
    color: #ebdbb2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

header h1 {
    color: #fabd2f;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 0.5rem;
    margin: 0;
}

.language-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #32302f;
    border: 2px solid #928374;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ebdbb2;
    font-weight: 600;
}

.language-btn:hover {
    background: #458588;
    border-color: #83a598;
    transform: translateY(-50%) translateY(-2px);
}

#current-flag {
    font-size: 1.2rem;
}

#current-lang {
    font-size: 0.9rem;
}

.screen {
    display: none;
    background: #282828;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-height: 500px;
    border: 1px solid #32302f;
}

.screen.active {
    display: block;
}

.table-selection h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #ebdbb2;
    font-size: 1.8rem;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.table-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #32302f;
    border: 2px solid #928374;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ebdbb2;
    font-weight: 600;
    text-align: center;
    aspect-ratio: 1;
    min-height: 80px;
}

.table-option:hover {
    background: #458588;
    border-color: #83a598;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(69, 133, 136, 0.3);
}

.table-option.selected {
    background: #b8bb26;
    border-color: #98971a;
    color: #1d2021;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 187, 38, 0.4);
}

.table-option.selected:hover {
    background: #98971a;
    border-color: #79740e;
}


.best-results {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #32302f;
    border-radius: 10px;
    border: 1px solid #928374;
    text-align: center;
}

.best-results h3 {
    color: #fabd2f;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.table-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.table-result {
    background: #282828;
    border-radius: 8px;
    border: 1px solid #928374;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.table-result:hover {
    transform: translateY(-2px);
    border-color: #83a598;
}

.table-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fabd2f;
    margin-bottom: 0.8rem;
}

.table-stats {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.table-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.stat-label {
    color: #a89984;
}

.stat-value {
    color: #ebdbb2;
    font-weight: 600;
}

.no-data {
    color: #928374;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.master-quiz-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #32302f;
    border-radius: 10px;
    border: 1px solid #928374;
    text-align: center;
}

.master-quiz-section h3 {
    color: #fabd2f;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.master-score-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.master-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.master-stat-label {
    color: #a89984;
    font-size: 0.9rem;
    font-weight: 500;
}

.master-stat-value {
    color: #ebdbb2;
    font-size: 1.5rem;
    font-weight: bold;
}

.game-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn.primary {
    background: #458588;
    color: #ebdbb2;
    border: 1px solid #83a598;
}

.btn.primary:hover {
    background: #83a598;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(69, 133, 136, 0.4);
}

.btn.secondary {
    background: #928374;
    color: #ebdbb2;
    border: 1px solid #a89984;
}

.btn.secondary:hover {
    background: #a89984;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(146, 131, 116, 0.4);
}

.btn.danger {
    background: #cc241d;
    color: #ebdbb2;
    border: 1px solid #fb4934;
}

.btn.danger:hover {
    background: #fb4934;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(204, 36, 29, 0.4);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #32302f;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid #928374;
}

.game-info, .game-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.game-info span, .game-stats span {
    font-weight: 600;
    color: #ebdbb2;
}

.question-area {
    text-align: center;
    margin-bottom: 2rem;
}

.question {
    margin-bottom: 2rem;
}

.question span {
    font-size: 3rem;
    font-weight: bold;
    color: #fabd2f;
    display: block;
    margin-bottom: 1rem;
}

#answer-input {
    font-size: 2rem;
    padding: 1rem;
    border: 3px solid #928374;
    border-radius: 10px;
    text-align: center;
    width: 200px;
    margin-bottom: 2rem;
    transition: border-color 0.3s ease;
    background: #32302f;
    color: #ebdbb2;
}

#answer-input:focus {
    outline: none;
    border-color: #83a598;
    box-shadow: 0 0 0 3px rgba(131, 165, 152, 0.2);
}

.question-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.feedback {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 8px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback.success {
    background: #32302f;
    color: #b8bb26;
    border: 2px solid #98971a;
}

.feedback.error {
    background: #32302f;
    color: #fb4934;
    border: 2px solid #cc241d;
}

.feedback.warning {
    background: #32302f;
    color: #fabd2f;
    border: 2px solid #d79921;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-stat {
    text-align: center;
    padding: 1.5rem;
    background: #32302f;
    border-radius: 10px;
    border-left: 4px solid #458588;
    border: 1px solid #928374;
}

.result-stat h3 {
    color: #a89984;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-stat span {
    font-size: 2rem;
    font-weight: bold;
    color: #ebdbb2;
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.progress-controls {
    margin-bottom: 2rem;
    text-align: center;
}

.progress-controls select {
    padding: 0.5rem 1rem;
    border: 2px solid #928374;
    border-radius: 8px;
    font-size: 1rem;
    background: #32302f;
    color: #ebdbb2;
}

.chart-container {
    margin-bottom: 2rem;
    height: 400px;
    position: relative;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: #32302f;
    border-radius: 10px;
    border-top: 4px solid #458588;
    border: 1px solid #928374;
}

.stat-card h4 {
    color: #a89984;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card span {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ebdbb2;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .language-btn {
        position: static;
        transform: none;
    }

    .language-btn:hover {
        transform: translateY(-2px);
    }
    
    .screen {
        padding: 1rem;
    }
    
    .table-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .question span {
        font-size: 2rem;
    }
    
    #answer-input {
        font-size: 1.5rem;
        width: 100%;
        max-width: 300px;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    .game-info, .game-stats {
        justify-content: center;
    }
    
    .results-summary {
        grid-template-columns: 1fr;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }

    .table-results {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .question-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .results-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .game-options {
        flex-direction: column;
        align-items: center;
    }
    
    .table-results {
        grid-template-columns: 1fr;
    }

    .table-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.screen h2 {
    text-align: center;
    color: #ebdbb2;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

#quit-game {
    margin-top: 2rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}


.chart-container canvas {
    max-height: 400px;
}

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

.screen.active {
    animation: fadeIn 0.3s ease-out;
}

.feedback {
    transition: all 0.3s ease;
}

.table-option {
    position: relative;
    overflow: hidden;
}

.table-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.table-option:hover::before {
    left: 100%;
}

/* Countdown Screen Styles */
.countdown-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 500px;
    text-align: center;
    animation: countdownFadeIn 0.5s ease-out;
}

.countdown-title {
    margin-bottom: 3rem;
}

.countdown-title h2 {
    color: #fabd2f;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.table-display {
    background: linear-gradient(135deg, #458588, #83a598);
    padding: 1.5rem 3rem;
    border-radius: 20px;
    border: 3px solid #83a598;
    box-shadow: 0 10px 30px rgba(69, 133, 136, 0.3);
    animation: tableDisplayPulse 2s ease-in-out infinite;
}

.table-display span {
    font-size: 2rem;
    font-weight: bold;
    color: #ebdbb2;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.countdown-circle {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #32302f, #282828);
    border: 8px solid #928374;
    border-radius: 50%;
    box-shadow: 
        0 0 30px rgba(146, 131, 116, 0.3),
        inset 0 0 30px rgba(0,0,0,0.3);
    animation: countdownCirclePulse 1s ease-in-out infinite;
}

.countdown-number {
    font-size: 6rem;
    font-weight: bold;
    color: #fabd2f;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    animation: countdownNumberScale 1s ease-in-out infinite;
}

.countdown-message {
    font-size: 1.5rem;
    color: #a89984;
    margin-top: 1rem;
    animation: countdownMessageFade 2s ease-in-out infinite;
}

/* Countdown Animations */
@keyframes countdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes tableDisplayPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(69, 133, 136, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 40px rgba(69, 133, 136, 0.5);
    }
}

@keyframes countdownCirclePulse {
    0%, 100% {
        border-color: #928374;
        box-shadow: 
            0 0 30px rgba(146, 131, 116, 0.3),
            inset 0 0 30px rgba(0,0,0,0.3);
    }
    50% {
        border-color: #fabd2f;
        box-shadow: 
            0 0 50px rgba(250, 189, 47, 0.5),
            inset 0 0 30px rgba(0,0,0,0.3);
    }
}

@keyframes countdownNumberScale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #b8bb26;
    }
}

@keyframes countdownMessageFade {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

@keyframes countdownExit {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(1.2);
    }
}

.countdown-container.exiting {
    animation: countdownExit 0.3s ease-in;
}

/* Responsive design for countdown */
@media (max-width: 768px) {
    .countdown-title h2 {
        font-size: 2rem;
    }
    
    .table-display {
        padding: 1rem 2rem;
    }
    
    .table-display span {
        font-size: 1.5rem;
    }
    
    .countdown-circle {
        width: 150px;
        height: 150px;
        border-width: 6px;
    }
    
    .countdown-number {
        font-size: 4rem;
    }
    
    .countdown-message {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .countdown-title h2 {
        font-size: 1.5rem;
    }
    
    .table-display span {
        font-size: 1.2rem;
    }
    
    .countdown-circle {
        width: 120px;
        height: 120px;
        border-width: 4px;
    }
    
    .countdown-number {
        font-size: 3rem;
    }
}