/* === DANCING PRESIDENTS GAME LOGIC STYLES === */
/* Only contains styles for the active game experience */

/* Base font for game elements */
.game-ui-text {
    font-family: 'Luckiest Guy', cursive;
}

#game-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    /* Fill content-wrapper */
}

#game-container {
    display: flex;
    flex-direction: column;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: auto;
    min-height: 600px;
    /* Standard immersive height */
    width: 100%;
    background-color: #000;
    border: none;
    border-bottom: 3px solid var(--brand-color-main);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* --- Level Transition Overlay --- */
#level-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: black;
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

#level-transition-text {
    font-size: 6rem;
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    font-family: 'Luckiest Guy', cursive;
}

/* --- DEVICE OVERLAYS --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: black;
    color: white;
    z-index: 100;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1.5rem;
    padding: 1rem;
    font-family: 'Luckiest Guy', cursive;
}

/* Show rotation overlay on mobile portrait */
@media screen and (orientation: portrait) and (max-width: 850px) {
    #rotate-device-overlay {
        display: flex;
    }
}

/* --- Intro Screen (Inside Game) --- */
#intro-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 20px;
}

.intro-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

/* --- CHARACTER SELECTION --- */
#character-selection-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
}

#character-selection {
    position: relative;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 1.5rem;
    border-radius: 15px;
    border: 2px solid #f59e0b;
}

.selection-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px black;
    color: #f59e0b;
    font-family: 'Luckiest Guy', cursive;
}

.choices {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.dancer-choice {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background-color: rgba(255, 255, 255, 0.1);
    border: 4px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dancer-choice:hover {
    transform: scale(1.05);
    background-color: rgba(255, 255, 255, 0.2);
}

.dancer-choice.selected {
    border-color: #f59e0b;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.7);
    background-color: rgba(245, 158, 11, 0.2);
}

/* --- GAME HUD (Top Bar) --- */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 80;
    backdrop-filter: blur(5px);
    border-bottom: 2px solid rgba(245, 158, 11, 0.3);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 0.7rem;
    color: #9ca3af;
    letter-spacing: 1px;
}

.hud-value {
    font-size: 1.5rem;
    color: #f59e0b;
    font-family: 'Luckiest Guy', cursive;
    text-shadow: 2px 2px 0px black;
}

#lives-container {
    display: flex;
    gap: 8px;
}

/* --- GAME CONTROLS (Bottom Right) --- */
#game-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 80;
}

.control-btn {
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #f59e0b;
    border-radius: 8px;
    color: #f59e0b;
    font-size: 0.9rem;
    font-family: 'Luckiest Guy', cursive;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.control-btn:hover {
    background: #f59e0b;
    color: black;
    transform: translateY(-2px);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

/* --- GAME UI ELEMENTS --- */
.life-box {
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid #4a5568;
    border-radius: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.life-box.failed::before,
.life-box.failed::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 80%;
    height: 5px;
    background-color: red;
    border-radius: 2px;
    box-shadow: 0 0 15px red;
}

.life-box.failed::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.life-box.failed::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* --- POP-UP TEXTS --- */
#wrong-move-overlay,
#correct-sequence-overlay,
#combo-streak-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    z-index: 70;
    pointer-events: none;
    display: flex;
    white-space: nowrap;
    font-family: 'Luckiest Guy', cursive;
}

#wrong-move-overlay {
    color: #f87171;
    text-shadow: 0 0 3px white, 0 0 20px rgba(255, 0, 0, 0.8);
}

#correct-sequence-overlay {
    color: #f59e0b;
    text-shadow: 0 0 3px white, 0 0 20px rgba(253, 224, 71, 0.8);
}

#combo-streak-overlay {
    font-size: 6rem;
    color: #4ade80;
}

#wrong-move-overlay.show,
#correct-sequence-overlay.show,
#combo-streak-overlay.show {
    opacity: 1;
}

/* Dancer Area */
main#dancer-area {
    flex-grow: 1;
    position: relative;
    z-index: 55;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    /* Full height of container */
    overflow: hidden;
    box-sizing: border-box;
    padding: 20px 0;
    /* Balanced padding */
}

#message {
    position: relative;
    /* Back to relative for flex flow */
    top: 100px;
    /* Lowered by 20px as requested */
    left: 0;
    transform: none;
    width: 100%;
    font-family: 'Luckiest Guy', cursive;
    font-size: 2.5rem;
    color: #f59e0b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    text-align: center;
    z-index: 75;
    pointer-events: none;
    margin-bottom: 10px;
}

#dancer-svg-container {
    width: auto !important;
    height: 300px !important;
    /* Scaled up 10x from 30px */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 60px;
    position: relative;
    z-index: 10;
}

#dancer-svg-container img {
    height: 100% !important;
    width: auto !important;
    object-fit: contain !important;
}

/* Key Indicators (Desktop) */
.key-indicator {
    background-color: #374151;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s ease-in-out;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    border-bottom: 4px solid #1f2937;
    width: 50px;
    height: 50px;
    color: white;
    font-weight: bold;
}

#keyboard-controls {
    position: relative;
    top: 0px;
    /* Raised to top of its flex slot */
    margin-top: auto;
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 80;
    width: 100%;
}

/* Make Space key 2x as wide */
#key-\  {
    width: 100px;
}

.key-indicator.active {
    background-color: #f59e0b;
    transform: scale(1.1);
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    z-index: 85;
}

.is-mobile .mobile-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mobile-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.is-mobile .mobile-key-indicator {
    width: 70px;
    height: 70px;
    background-color: rgba(31, 41, 55, 0.8);
    border: 2px solid #9ca3af;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* === UTILS === */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.text-center {
    text-align: center;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

/* Modals & Overlays */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10005;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    padding: 20px;
}

#modal-content {
    background: #111;
    border: 3px solid #f59e0b;
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 450px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.3);
}

#modal-title {
    font-family: 'Luckiest Guy', cursive;
    font-size: 3rem;
    color: #f59e0b;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 0px black;
}

#modal-text {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#modal-button,
#submit-score-btn,
#modal-review-button {
    width: 100%;
    padding: 15px;
    font-family: 'Luckiest Guy', cursive;
    font-size: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

#modal-button,
#submit-score-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    box-shadow: 0 4px 0px #92400e;
}

#modal-review-button {
    background: transparent;
    border: 2px solid #f59e0b;
    color: #f59e0b;
}

#modal-button:active,
#submit-score-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0px #92400e;
}

/* Score Form */
#score-form {
    margin-bottom: 20px;
}

#player-name {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px solid #4b5563;
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    margin-bottom: 12px;
    text-align: center;
}

#player-name:focus {
    border-color: #f59e0b;
    outline: none;
}

#how-to-play-overlay,
#leaderboard-container {
    display: none;
}

#how-to-play-overlay.show,
#modal-overlay.show,
#leaderboard-container.show {
    display: flex;
}

#fullscreen-required-overlay {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10006;
    display: none;
    /* Default hidden */
}

#fullscreen-required-overlay:not(.hidden) {
    display: flex !important;
}

.fullscreen-modal {
    background: #111;
    border: 3px solid #f59e0b;
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.3);
}

.fullscreen-title {
    font-family: 'Luckiest Guy', cursive;
    font-size: 2.5rem;
    color: #f59e0b;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 0px black;
}

.fullscreen-text {
    font-size: 1.1rem;
    color: white;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.fullscreen-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fs-btn {
    width: 100%;
    padding: 15px;
    font-family: 'Luckiest Guy', cursive;
    font-size: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.fs-btn.primary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    box-shadow: 0 4px 0px #92400e;
}

.fs-btn.secondary {
    background: transparent;
    border: 2px solid #f59e0b;
    color: #f59e0b;
}

.fs-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0px #92400e;
}

/* Aspect Ratio Maintenance for Fullscreen */
#game-wrapper:fullscreen {
    background: #000 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

#game-wrapper:fullscreen #game-container {
    width: min(100vw, calc(100vh * 16 / 9)) !important;
    height: min(100vh, calc(100vw * 9 / 16)) !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* Fix Fullscreen Centering for UI Elements */
#game-wrapper:fullscreen #dancer-area {
    justify-content: center !important;
    padding-top: 150px !important;
    /* Shifted another 10px up */
}

#game-wrapper:fullscreen #dancer-svg-container {
    margin-top: 0 !important;
    height: 45vh !important;
    /* Scale along with screen height in FS */
    max-height: none !important;
}

#game-wrapper:fullscreen #message {
    top: 110px !important;
    /* Shifted another 30px up */
}

#game-wrapper:fullscreen #keyboard-controls {
    margin-top: auto !important;
    /* Keep controls at the bottom */
    padding-bottom: 40px !important;
}

#level-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

#level-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    /* Opaque audience */
}