body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #87CEEB;
    touch-action: manipulation;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.sky {
    height: 70%;
    background: linear-gradient(to bottom, #4facfe 0%, #00f2fe 100%);
    position: relative;
}

.cloud {
    position: absolute;
    background: white;
    border-radius: 50px;
    opacity: 0.8;
}
.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}
.c1 { width: 100px; height: 30px; top: 10%; left: 10%; }
.c1::before { width: 50px; height: 50px; top: -20px; left: 15px; }
.c1::after { width: 40px; height: 40px; top: -10px; left: 50px; }

.c2 { width: 120px; height: 35px; top: 15%; right: 10%; }
.c2::before { width: 60px; height: 60px; top: -30px; left: 20px; }
.c2::after { width: 45px; height: 45px; top: -15px; left: 65px; }

.c3 { width: 150px; height: 40px; top: 25%; left: 45%; }
.c3::before { width: 70px; height: 70px; top: -35px; left: 25px; }
.c3::after { width: 55px; height: 55px; top: -20px; left: 80px; }

.ground {
    height: 30%;
    background: linear-gradient(to bottom, #8bc34a 0%, #558b2f 100%);
    position: relative;
    border-top: 5px solid #689f38;
}

#header {
    position: relative;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.2);
}

.flags {
    font-size: 30px;
    letter-spacing: 5px;
}

#players-container {
    position: absolute;
    top: 55px;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    z-index: 10;
}

.player-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Let's differentiate players slightly by button colors */
#player1 .answer-btn {
    border-color: #c62828;
    background: #f44336;
    box-shadow: 0 6px 0 #c62828, 0 10px 10px rgba(0,0,0,0.2);
}
#player1 .answer-btn:hover { background: #e53935; }
#player1 .answer-btn:active { box-shadow: 0 0 0 #c62828, 0 4px 4px rgba(0,0,0,0.2); transform: translateY(6px); }

#player2 .answer-btn {
    border-color: #1565C0;
    background: #2196F3;
    box-shadow: 0 6px 0 #1565C0, 0 10px 10px rgba(0,0,0,0.2);
}
#player2 .answer-btn:hover { background: #1E88E5; }
#player2 .answer-btn:active { box-shadow: 0 0 0 #1565C0, 0 4px 4px rgba(0,0,0,0.2); transform: translateY(6px); }

#divider {
    width: 6px;
    background: rgba(255,255,255,0.6);
    height: 100%;
    z-index: 20;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

.stats {
    width: 100%;
    display: flex;
    justify-content: space-around;
    font-size: 22px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-top: 15px;
    z-index: 11;
}

.game-area {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
}

.progress-bar-container {
    position: absolute;
    left: 5%;
    top: 5%;
    width: 25px;
    height: 85%;
    background: rgba(255, 255, 255, 0.4);
    border: 3px solid white;
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #ff9800, #ffeb3b);
    border-radius: 12px;
    transition: height 0.5s ease-out;
}

.pole {
    position: absolute;
    bottom: 0;
    width: 50px;
    height: 90%;
    background: linear-gradient(to right, #795548, #4E342E, #795548);
    border-radius: 10px 10px 0 0;
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
}

.pole::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: repeating-linear-gradient(to bottom, transparent, transparent 40px, rgba(0,0,0,0.1) 40px, rgba(0,0,0,0.1) 45px);
}

.gifts {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    white-space: nowrap;
    text-shadow: 0 0 15px gold;
    z-index: 15;
}

.gift-wheel {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 20px;
    background: #8D6E63;
    border-radius: 10px;
    border: 2px solid #5D4037;
    z-index: 14;
}

.climber {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 0);
    font-size: 60px;
    transition: bottom 0.5s cubic-bezier(0.25, 1, 0.5, 1), transform 0.2s;
    z-index: 16;
}

.spectators {
    position: absolute;
    bottom: -5px;
    width: 100%;
    text-align: center;
    font-size: 35px;
    white-space: nowrap;
    z-index: 15;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

@keyframes wiggle {
    0% { transform: translate(-50%, 0) rotate(0deg); }
    25% { transform: translate(-50%, -10px) rotate(-10deg); }
    50% { transform: translate(-50%, 0) rotate(0deg); }
    75% { transform: translate(-50%, 10px) rotate(10deg); }
    100% { transform: translate(-50%, 0) rotate(0deg); }
}

.climbing {
    animation: wiggle 0.5s ease-in-out;
}

@keyframes slideDownWobble {
    0% { transform: translate(-50%, 0) rotate(0deg); }
    25% { transform: translate(-50%, 0) rotate(-15deg); }
    50% { transform: translate(-50%, 0) rotate(15deg); }
    75% { transform: translate(-50%, 0) rotate(-10deg); }
    100% { transform: translate(-50%, 0) rotate(0deg); }
}

.falling {
    animation: slideDownWobble 0.5s ease-in-out;
}

.ui-layer {
    width: 100%;
    height: 280px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 6px solid #d32f2f;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    box-sizing: border-box;
    z-index: 20;
}

.question-text {
    font-size: 16px;
    margin: 5px 10px 10px 10px;
    text-align: center;
    color: #1a1a1a;
    font-weight: 800;
    width: 95%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 95%;
    max-width: 650px;
}

.answer-btn {
    padding: 12px 10px;
    font-size: 14px;
    font-weight: bold;
    border: 4px solid;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.1s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.answer-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 6px 0 rgba(0,0,0,0.3) !important;
}

.message-overlay {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 40px;
    font-weight: 900;
    text-align: center;
    width: 100%;
    pointer-events: none;
    transition: opacity 0.4s, transform 0.4s;
    opacity: 0;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    z-index: 110;
}

.message-overlay.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}

#win-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    border: 8px solid #ffeb3b;
    z-index: 200;
}

.hidden {
    display: none !important;
}

#win-screen h1 {
    color: #d32f2f;
    font-size: 55px;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 0px #ffeb3b;
}

#win-screen h2 {
    color: #2e7d32;
    font-size: 24px;
    margin-top: 0;
}

#win-screen button {
    margin-top: 30px;
    padding: 20px 40px;
    font-size: 28px;
    background: #ff9800;
    color: white;
    border: 4px solid #ef6c00;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 6px 0 #ef6c00;
    transition: transform 0.1s;
}

#win-screen button:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #ef6c00;
}

/* Settings Modal & Header Adjustments */
#header {
    justify-content: space-between;
    padding: 10px 20px;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.emblem-container {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.emblem {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.emblem .icon {
    margin-right: 6px;
    font-size: 16px;
}

.bg-primary {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    border-color: #bbdefb;
}

.bg-secondary {
    background: linear-gradient(135deg, #d32f2f, #c62828);
    border-color: #ffcdd2;
}

.bg-accent {
    background: linear-gradient(135deg, #F57C00, #E65100);
    border-color: #ffe0b2;
}

#settings-btn {
    background: #ff9800;
    color: white;
    border: 2px solid #ef6c00;
    padding: 10px 15px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 0 #ef6c00;
    transition: transform 0.1s;
}
#settings-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #ef6c00;
}

#settings-modal {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
}

#settings-modal .modal-content {
    background: white;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#settings-modal h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

.settings-options {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.checkbox-container {
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-text {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 10px;
}

.editors-container {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 400px;
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-section h3 {
    margin: 0 0 5px 0;
    color: #1976D2;
}

.editor-section textarea {
    flex: 1;
    width: 100%;
    padding: 10px;
    font-family: monospace;
    font-size: 14px;
    border: 2px solid #ccc;
    border-radius: 8px;
    resize: none;
    box-sizing: border-box;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 12px 25px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    border: none;
}

.btn-save {
    background: #4CAF50;
    color: white;
    box-shadow: 0 4px 0 #388E3C;
}
.btn-save:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #388E3C;
}

.btn-cancel {
    background: #f44336;
    color: white;
    box-shadow: 0 4px 0 #d32f2f;
}
.btn-cancel:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #d32f2f;
}
