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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: url('background.jpg');
    background-size: cover;
    background-position: right;
    background-repeat: no-repeat;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
}

/* Grey gradient for category selection and finish screens */
body.category-selection-active,
body.final-scores-active,
body.results-stats-active,
body.waiting-active,
body.join-active,
body.impressum-active,
body.genug-gespielt-active {
    background-image: none;
    background: linear-gradient(135deg, #939393 0%, #e0e0e0 100%);
    transition: background 0.3s ease;
}

/* Category-specific gradients for game and results screens */
body.game-active,
body.results-active {
    background-image: none;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 40px);
    justify-content: space-between;
    padding: 20px 0;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.logo-top-center {
    margin-bottom: 0;
}

.logo-bottom-center {
    margin-top: 0;
    opacity: 1;
    visibility: visible;
    background: transparent;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 400px;
    padding: 0 20px;
    pointer-events: auto;
    gap: 15px;
}

.copyright-text {
    color: white;
    font-size: 1em;
}

.impressum-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s ease;
    pointer-events: auto;
}

.impressum-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.leave-game-btn {
    background: transparent;
    border: none;
    color: white;
    text-decoration: none;
    font-size: 1em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
    transition: opacity 0.2s ease;
    pointer-events: auto;
    padding: 0;
    margin-bottom: 8px;
}

.leave-game-btn:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.logo-bottom-center img {
    pointer-events: none;
}

.logo {
    height: 60px;
    width: auto;
    display: block;
}

.logo-wip {
    height: 100px;
    width: auto;
    max-width: 400px;
    display: block;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
    opacity: 1 !important;
    visibility: visible !important;
    object-fit: contain;
}

.container {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    padding: 40px;
    text-align: center;
    flex-shrink: 0;
    margin: 20px 0;
    transition: background 0.3s ease;
}

/* Make container opaque on category selection, game, results, and finish screens */
body.category-selection-active .container,
body.game-active .container,
body.results-active .container,
body.final-scores-active .container,
body.results-stats-active .container,
body.waiting-active .container,
body.join-active .container,
body.impressum-active .container,
body.genug-gespielt-active .container {
    background: white;
}

.screen {
    display: none;
}

.screen.active {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.impressum-content {
    text-align: left;
    line-height: 1.6;
    color: #333;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0 20px;
}

.impressum-content p {
    margin-bottom: 15px;
}

.impressum-content strong {
    color: #000;
    font-weight: 600;
}

#impressumScreen h2 {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 3em;
    margin-bottom: 0;
}

.edition-logo {
    max-width: 100%;
    height: auto;
    margin-bottom: 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.results-question {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 0;
    min-height: 60px;
}

h2 {
    font-size: 2em;
    margin-bottom: 0;
    color: #333;
}

p {
    color: #666;
    margin-bottom: 0;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin: 0;
    transition: all 0.3s ease;
    font-weight: 600;
}

#startScreen .btn,
#joinGameScreen .btn,
.avatar-popup .btn {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.game-stats {
    margin: 15px 0;
}

#submitAnswerBtn,
#nextQuestionBtn {
    width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

.waitingScreenButtons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 0;
}

.waitingScreenButtons .btn {
    width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

@media (min-width: 500px) {
    .waitingScreenButtons {
        flex-direction: row;
    }
    
    .waitingScreenButtons .btn {
        flex: 1;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #D72622 0%, #F04A46 100%);
    color: white;
}

#waitingScreen .btn-primary[id*="NameBtn"] {
    background: linear-gradient(135deg, #24a020 0%, #38ef7d 100%);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

#gameCodeDisplay {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

#gameCode {
    font-size: 2em;
    font-weight: bold;
    color: #24a020;
    letter-spacing: 5px;
    margin: 0;
}

#qrCode {
    padding: 10px;
    background: white;
    border-radius: 10px;
    display: inline-block;
}

.info {
    font-size: 0.9em;
    color: #888;
    margin-top: 0;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin: 0;
    text-align: center;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #24a020;
}

/* Slider Styles */
.slider-container {
    width: 100%;
    margin: 0;
}

.slider-wrapper {
    position: relative;
    width: 100%;
    height: 25px;
    display: flex;
    align-items: center;
}

.slider-fill {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 10px;
    width: 0%;
    background: linear-gradient(90deg, #24a020 0%, #38ef7d 100%);
    border-radius: 5px;
    pointer-events: none;
    z-index: 1;
    transition: width 0.1s ease;
}

.slider-wrapper::before {
    top: 50%;
    transform: translateY(-50%);
    height: 10px;
}

.slider-wrapper input[type="range"] {
    position: relative;
    z-index: 2;
    margin: 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    font-size: 1.1em;
    font-weight: 600;
    position: relative;
}

#sliderMin,
#sliderMax {
    color: #aaa;
}

#sliderValue {
    color: #24a020;
    font-size: 1.5em;
    transition: color 0.3s ease, opacity 0.3s ease;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.slider-container.disabled #sliderValue {
    color: #999;
    opacity: 0.6;
}

.slider-container.disabled #sliderMin,
.slider-container.disabled #sliderMax {
    opacity: 0.6;
}

input[type="range"] {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider-wrapper input[type="range"] {
    background: transparent;
}

.slider-wrapper::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    z-index: 0;
}

input[type="range"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #24a020;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #38ef7d;
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #24a020;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #38ef7d;
    transform: scale(1.1);
}

/* Answer Visualization */
.answer-visualization {
    margin: 0;
    background: transparent;
    display: block;
}

/* Multichoice Options Styles */
.multichoice-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.truefalse-options {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
}

@media (max-width: 600px) {
    .truefalse-options {
        flex-direction: column;
    }
}

.truefalse-option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px 60px;
    border: 3px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.3em;
    font-weight: bold;
    text-align: center;
    flex: 1;
    box-sizing: border-box;
}

.truefalse-option-btn.selected {
    border-color: #24a020;
    background: #e8f5e9;
}

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

.truefalse-option-btn .option-checkmark {
    display: none;
    color: #24a020;
    font-weight: bold;
    font-size: 1.3em;
}

.truefalse-option-btn.selected .option-checkmark {
    display: block;
}

.multichoice-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border: 3px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1em;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    color: #333;
}


.multichoice-option-btn.selected {
    border-color: #24a020;
    background: #e8f5e9;
}

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

.option-label {
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
    color: #333;
}

.option-text {
    flex: 1;
    color: #333;
}

.option-checkmark {
    display: none;
    color: #24a020;
    font-weight: bold;
    font-size: 1.3em;
    margin-left: auto;
    flex-shrink: 0;
}

.multichoice-option-btn.selected .option-checkmark {
    display: block;
}

/* Multichoice Results Visualization */
.multichoice-visualization {
    margin: 0;
    background: transparent;
    display: block;
}

.multichoice-results-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.multichoice-result-option {
    padding: 20px;
    border: 3px solid #ddd;
    border-radius: 10px;
    background: white;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 60px;
}

.multichoice-option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    text-align: left;
    flex: 1;
}

.multichoice-option-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.multichoice-option-label {
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
    color: #333;
}

.multichoice-option-text {
    flex: 1;
    font-size: 1.1em;
    text-align: left;
}

.multichoice-option-avatars {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: flex-end;
    justify-content: flex-start;
    padding-top: 10px;
    width: 100%;
    min-height: 50px;
}

.multichoice-option-avatars .multichoice-avatar-icon:not(:first-child) {
    margin-left: -8px; /* 20% of 40px = 8px overlap */
}

.multichoice-avatar-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 50%;
    border: 3px solid;
    /* Border color and background will be set via inline styles */
}

.visualization-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0;
    font-size: 0.9em;
    color: #aaa;
    font-weight: 600;
}

.answer-line-container {
    position: relative;
    width: 100%;
    height: 40px;
    margin: 0;
}

.answer-line {
    position: relative;
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    margin-top: 0;
    overflow: visible;
}

.correct-answer-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #24a020 0%, #38ef7d 100%);
    border-radius: 6px;
    width: 0%;
    transition: width 2s ease-out;
    z-index: 1;
}

.player-marker {
    position: absolute;
    top: -15px;
    width: 14px;
    height: 42px;
    transform: translateX(-50%);
    border-radius: 7px;
    z-index: 10;
}

.player1-marker {
    background: #667eea;
    border: 4px solid white;
}

.player2-marker {
    background: #f093fb;
    border: 4px solid white;
}


.answers-header {
    font-size: 1.3em;
    font-weight: 600;
    color: #aaa;
    margin-bottom: 0;
    text-align: left !important;
}

.answers-box {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answers-row {
    flex-direction: row;
    flex-wrap: wrap;
}

.answers-row .player-answer-box {
    flex: 1;
    min-width: 0;
}

.answers-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.answers-grid-2x2 .player-answer-box {
    width: 100%;
}

.player-answer-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.answer-avatar-icon {
    flex-shrink: 0;
}

.answer-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    gap: 5px;
    text-align: left;
}

.answer-name {
    font-size: 0.9em;
    opacity: 0.9;
}

.answer-value {
    font-size: 1.3em;
    font-weight: 700;
}

#startGameBtnWaiting,
#backToStartBtnWaiting {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

#joinGameBtn {
    background: #b0b0b0;
    color: #333;
}

#joinGameBtn:hover {
    background: #a0a0a0;
}

@media (min-width: 600px) {
    #startGameBtnWaiting,
    #backToStartBtnWaiting {
        display: inline-block;
        width: calc(50% - 5px);
    }
    
    #startGameBtnWaiting {
        margin-right: 10px;
    }
}

.player-answer-box {
    padding: 15px 20px;
    margin: 0;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 1.1em;
    transition: opacity 0.5s ease-in;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.correct-answer-box {
    background: linear-gradient(135deg, #24a020 0%, #38ef7d 100%) !important;
    font-weight: bold;
    margin-top: 0;
}

.answer-name {
    flex: 1;
    text-align: left;
}

.answer-value {
    text-align: right;
    font-weight: 700;
}

.answer-text {
    display: block;
    width: 100%;
    text-align: center;
}

.explanation-box {
    margin-top: 0;
    padding: 15px 20px;
    background: #e8f5e9;
    border-radius: 10px;
    border-left: 4px solid #24a020;
    text-align: justify;
    transition: opacity 0.5s ease-in;
}

.explanation-box p {
    margin: 0;
    color: #555;
    font-size: 0.95em;
    line-height: 1.6;
}

/* Players Ranking */
.players-ranking-section {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ranking-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 0;
}

.players-ranking {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 0;
    background: white;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1em;
    transition: opacity 0.5s ease-in, transform 0.5s ease-in;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.ranking-avatar-icon {
    flex-shrink: 0;
    margin-right: 12px;
}

.ranking-name {
    flex: 1;
    color: #333;
    display: flex;
    align-items: center;
}

.ranking-score {
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-score {
    font-size: 1.1em;
    color: #333;
    font-weight: 700;
}

.points-earned {
    background: #27ae60;
    color: white;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 600;
}

.error {
    color: #e74c3c;
    margin-top: 0;
    min-height: 20px;
}

.players-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player {
    display: flex;
    flex-direction: column;
    padding: 15px;
    margin: 0;
    background: #f5f5f5;
    border-radius: 10px;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 15px;
}

.player-color-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
    display: inline-block;
}

.player-avatar-icon {
    width: 80px;
    height: 80px;
    margin-right: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
}

.score-avatar-icon {
    width: 70px;
    height: 70px;
    margin-right: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
}

.name-input-container {
    margin-top: 0;
    width: 100%;
}

.name-input-container input {
    width: 100%;
    margin: 0;
    padding: 10px;
    font-size: 1em;
}

.player-name-input {
    text-align: left !important;
}

.name-color-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.name-color-input input {
    flex: 1;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
}

.color-picker-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 0;
}

.color-picker-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.avatar-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.8em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Color Picker Modal */
.color-picker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.color-picker-popup {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: 20px;
}

.color-picker-popup h3 {
    margin-bottom: 0;
    color: #333;
}

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

/* Avatar Modal */
.avatar-popup {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: calc(90vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 20px;
}

.avatar-popup h3 {
    flex-shrink: 0;
    margin-bottom: 0;
    margin-top: 0;
}

.avatar-preview-container {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    flex-shrink: 0;
}

.avatar-preview {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-preview svg {
    max-width: 100%;
    max-height: 100%;
}

.avatar-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.avatar-control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avatar-control-group label {
    font-weight: 600;
    color: #333;
    text-align: left;
}

.color-grid-small {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 0;
}

.color-circle-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.color-circle-small:hover {
    transform: scale(1.1);
    border-color: #333;
}

.color-circle-small.selected {
    border-color: #24a020;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(36, 160, 32, 0.3);
}

.color-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.arrow-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.arrow-btn:hover {
    background: #f0f0f0;
    border-color: #24a020;
    transform: scale(1.1);
}

.color-circle-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#hairStyleDisplay {
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
    min-width: 40px;
    text-align: center;
}

.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 20px;
    flex-shrink: 0;
}

#saveAvatarBtn.btn-primary {
    background: #D72622;
    color: white;
}

#saveAvatarBtn.btn-primary:hover {
    background: #F04A46;
}

.avatar-actions .btn {
    padding: 12px 30px;
    box-sizing: border-box;
}

#waitingScreen .btn {
    width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.category-grid > * {
    min-width: 0;
}

.category-option {
    color: white;
    border: none;
    border-radius: 15px;
    padding: 40px 20px;
    font-size: 1.5em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    min-height: 150px;
    min-width: 0;
    box-sizing: border-box;
}

.category-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    flex-shrink: 0;
}

.category-text {
    flex-shrink: 0;
}

.category-option:hover:not(:disabled) {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.category-option:active:not(:disabled) {
    transform: translateY(-2px);
}

.category-option:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.category-display {
    text-align: left;
    font-size: 1.2em;
    font-weight: 600;
}

.color-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 0;
    margin: 0 auto;
}

.color-circle:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.color-circle.selected {
    transform: scale(1.2);
    border: 4px solid #24a020;
    box-shadow: 0 0 0 4px rgba(36, 160, 32, 0.2);
}

.player-name {
    font-weight: 600;
    color: #333;
    flex: 1;
    text-align: left;
}

.status {
    color: #888;
    font-size: 0.9em;
}

.game-header {
    margin-bottom: 0;
    position: relative;
}

.screen {
    position: relative;
}

.scores {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    width: 100%;
}

.scores-row {
    flex-direction: row;
    flex-wrap: wrap;
}

.scores-row .score-item {
    flex: 1;
    min-width: 0;
}

.scores-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.scores-grid-2x2 .score-item {
    width: 100%;
}

.score-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 15px;
    border-radius: 10px;
    width: 100%;
    gap: 15px;
    box-sizing: border-box;
}

.score-item .score-avatar-icon {
    flex-shrink: 0;
}

.score-item .score-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    gap: 5px;
}

.score-item .score-info span:first-child {
    font-weight: 600;
    color: #000 !important;
    font-size: 1em;
}

.score-item .score-info span:last-child {
    color: #000 !important;
    font-weight: 600;
    font-size: 2em;
}

.score-item span {
    color: #000 !important;
}

.question-number {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2em;
    margin-bottom: 0;
    gap: 10px;
    width: 100%;
    height: 60px;
}

.round-category-text {
    font-weight: 600;
    display: flex;
    align-items: center;
    height: 100%;
}

.category-badge {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 4px 12px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
}

.question-number-text {
    color: #e0e0e0;
    font-weight: 600;
}

.question-number-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: space-between;
}

.question-label {
    font-weight: 600;
    color: #878787;
    font-size: 1em;
    padding-top: 3px;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 10px;
    gap: 8px;
}

.timer-label {
    font-weight: 600;
    color: #878787;
    font-size: 0.95em;
    transition: color 0.3s ease;
}

.timer-label #timerDisplay {
    transition: color 0.3s ease;
}

.timer-bar-wrapper {
    width: 100%;
    max-width: 300px;
    height: 12px;
    background-color: #d3d3d3;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transition: background-color 0.3s ease;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: #878787;
    border-radius: 6px;
    transition: width 0.1s linear, background 0.3s ease;
    will-change: width;
}

.question-badges {
    display: flex;
    gap: 5px;
    align-items: center;
}

.question-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s ease;
    border: none;
}

.question-badge.current {
    background-color: #878787;
    color: white;
}

.question-badge.previous {
    background-color: #e0e0e0;
    color: white;
}

.question-badge.upcoming {
    background-color: transparent;
    color: #e0e0e0;
    border: none;
}

.question-container {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#questionText {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 0;
    min-height: 60px;
}

#answerInputContainer {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#answerInput {
    font-size: 1.5em;
}

.waiting-message {
    margin-top: 0;
    padding: 20px;
    background: #fff3cd;
    border-radius: 10px;
    color: #856404;
}

.waiting-message.hidden {
    display: none;
}

.results-container {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin: 0;
    background: #f5f5f5;
    border-radius: 10px;
    transition: opacity 0.5s ease-in;
}

.correct-answer-item {
    background: #d4edda !important;
    color: #155724;
    font-weight: 600;
}

.result-item span:first-child {
    font-weight: 600;
    color: #333;
}

.result-item span:nth-child(2) {
    font-size: 1.5em;
    color: #24a020;
    font-weight: bold;
}

.points {
    font-size: 1.3em;
    font-weight: bold;
    color: #27ae60;
}

.correct-answer {
    margin-top: 0;
    padding: 20px;
    background: #d4edda;
    border-radius: 10px;
    color: #155724;
}

.correct-answer p {
    margin: 0;
    font-size: 1.2em;
}

.correct-answer span {
    font-weight: bold;
    font-size: 1.3em;
}

.final-scores {
    margin: 0;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    border-radius: 15px;
    overflow: hidden;
    padding: 0;
}

.final-score-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 15px;
    padding: 15px;
    margin: 0;
    background: transparent;
    transition: all 0.3s ease;
    min-height: 80px;
    align-items: center;
    box-sizing: border-box;
    border-bottom: 5px solid white;
}

.final-score-item:last-child {
    border-bottom: none;
}

.final-score-item.winner {
    background: linear-gradient(135deg, #D72622 0%, #F04A46 100%);
    color: white;
}

.final-score-item.winner .player-name,
.final-score-item.winner .final-score {
    color: white;
    font-weight: bold;
}

.final-score-avatar-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    grid-row: 1 / -1;
}

.final-score-content {
    display: grid;
    grid-template-rows: auto auto;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.final-score-top-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    position: relative;
}

.final-score-bottom-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.player-name {
    font-size: 1.1em;
    font-weight: 600;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medal-emoji {
    font-size: 1.3em;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.medal-emoji:empty {
    display: none;
}

.final-score {
    font-size: 1.2em;
    font-weight: bold;
    color: #24a020;
    flex-shrink: 0;
}

/* Results Statistics Screen */
.accuracy-container {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 20px;
    margin: 0;
    width: 100%;
    flex-wrap: nowrap; /* Prevent wrapping to keep elements in a row */
}

.accuracy-left {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    position: relative;
    aspect-ratio: 1;
    max-width: 200px;
    max-height: 200px;
}

.results-avatar-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid transparent;
    background: transparent;
    box-sizing: border-box;
}

.results-avatar-container > svg {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
}

.accuracy-middle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    position: relative;
    aspect-ratio: 1;
    max-width: 200px;
    max-height: 200px;
}

.pie-chart-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.pie-chart-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

.accuracy-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    position: relative;
    aspect-ratio: 1;
    gap: 15px;
    max-width: 200px;
    max-height: 200px;
}

.accuracy-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    font-weight: bold;
    color: #333;
    line-height: 1;
    margin-top: -0.5em;
    white-space: nowrap;
}

.accuracy-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1em;
    color: #666;
    margin-top: 1.5em;
    white-space: nowrap;
}

.skill-scale-container {
    display: flex;
    gap: 20px;
    align-items: stretch;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.skill-scale-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.9em;
    color: #666;
    min-width: 110px;
    width: 110px;
    text-align: right;
    padding-right: 0;
    position: relative;
    overflow: visible;
}

.skill-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 30px;
    position: relative;
}

.crown-emoji {
    font-size: 1.5em;
    margin-right: 8px;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.5));
    z-index: 3;
    position: relative;
    display: inline-block;
    animation: crownPulse 2s ease-in-out infinite;
    transform: translateY(-4px);
}

@keyframes crownPulse {
    0%, 100% {
        transform: translateY(-4px) scale(1);
    }
    50% {
        transform: translateY(-4px) scale(1.1);
    }
}

.skill-label-text {
    position: relative;
    z-index: 2;
    background: white;
    padding-right: 8px;
    color: #cccccc;
    font-weight: normal;
}

.skill-label.active .skill-label-text {
    color: #000000;
    font-weight: bold;
}

.skill-label.passed .skill-label-text {
    color: #000000;
    font-weight: normal;
}

.skill-label-line {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 0;
    border-top: 2px solid #cccccc;
    z-index: 1;
    pointer-events: none;
    box-sizing: border-box;
}

.skill-label.active .skill-label-line {
    border-top-color: #000000;
}

.skill-label.passed .skill-label-line {
    border-top-color: #000000;
}

.skill-scale-bar {
    width: 30px;
    background: #e0e0e0;
    border-radius: 19px;
    position: relative;
    overflow: visible;
    flex-shrink: 0;
}

.skill-scale-fill {
    position: absolute;
    bottom: 0;
    left: 0px;
    width: 30px;
    background: linear-gradient(180deg, #24a020 0%, #38ef7d 100%);
    border-radius: 15px;
    outline: 4px solid white;
    outline-offset: 0;
    height: 0%;
    transition: background 1s ease-in-out;
}

.skill-scale-fill.gold-gradient {
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
}


@media (max-width: 600px) {
    .accuracy-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .accuracy-percentage {
        font-size: 3em;
    }
    
    .skill-scale-container {
        max-width: 100%;
    }
    
    .skill-scale-labels {
        font-size: 0.8em;
        min-width: 100px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.5em;
    }

    .scores-row {
        flex-direction: column !important;
    }

    .scores-grid-2x2 {
        grid-template-columns: 1fr !important;
    }

    .score-item {
        width: 100%;
    }

    .answers-row {
        flex-direction: column !important;
    }

    .answers-grid-2x2 {
        grid-template-columns: 1fr !important;
    }

    .player-answer-box {
        width: 100%;
    }
    
    /* Mobile adjustments for accuracy container */
    .accuracy-container {
        gap: 10px;
        min-height: 0;
        flex-direction: row !important; /* Keep elements in a row on mobile */
    }
    
    .accuracy-left,
    .accuracy-middle,
    .accuracy-right {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    .accuracy-percentage {
        font-size: 2em;
    }
    
    .accuracy-label {
        font-size: 0.85em;
    }
}

@media (max-width: 600px) {
    .category-option {
        flex-direction: column;
        padding: 20px 15px;
        gap: 10px;
        min-height: auto;
    }

    .category-icon {
        width: 60px;
        height: 60px;
    }

    .category-text {
        font-size: 0.75em;
        text-align: center;
    }

    .logo {
        height: 40px !important;
    }

    .logo-wip {
        height: 60px !important;
        max-width: 250px !important;
    }
    
    /* Mobile adjustments for final scores screen */
    .final-score-item {
        padding: 12px;
        gap: 12px;
        min-height: 70px;
    }
    
    .final-score-avatar-icon {
        width: 50px;
        height: 50px;
    }
    
    .player-name {
        font-size: 0.95em;
    }
    
    .medal-emoji {
        font-size: 1.1em;
    }
    
    .final-score {
        font-size: 1em;
    }
    
    #finalScoresScreen h2 {
        font-size: 1.3em;
    }
    
    #finalScoresScreen #winnerText {
        font-size: 0.9em;
    }
}

