/* Stylesheet for ¡El Piso es Lava! - Ruleta Digital */

:root {
    --bg-dark: #0d0808;
    --bg-card: rgba(26, 16, 16, 0.75);
    --border-card: rgba(255, 69, 0, 0.18);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --font-game: 'Outfit', sans-serif;
    
    /* Game Colors */
    --color-rojo: #ef4444;
    --color-amarillo: #fbbf24;
    --color-verde: #10b981;
    --color-azul: #3b82f6;
    --color-gris: #6b7280;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-game);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Lava Glows */
.lava-glow-bottom {
    position: fixed;
    bottom: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 85vw;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 69, 0, 0.35) 0%, rgba(255, 0, 0, 0.05) 75%, transparent 100%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    animation: pulseGlow 7s ease-in-out infinite alternate;
}

.lava-glow-top {
    position: fixed;
    top: -120px;
    right: 5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 140, 0, 0.12) 0%, transparent 70%);
    filter: blur(65px);
    z-index: -1;
    pointer-events: none;
}

@keyframes pulseGlow {
    0% { opacity: 0.65; transform: translateX(-50%) scale(1); }
    100% { opacity: 1.0; transform: translateX(-50%) scale(1.12); }
}

/* App Header styling */
.game-title {
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(to right, #ff4500, #ff8c00, #ff4500);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: lavaText 4s linear infinite;
    filter: drop-shadow(0px 2px 8px rgba(255, 69, 0, 0.3));
}

.game-subtitle {
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 1px;
}

@keyframes lavaText {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glassmorphism Cards styling */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.glass-card:hover {
    border-color: rgba(255, 69, 0, 0.32);
    box-shadow: 0 12px 32px rgba(255, 69, 0, 0.08), 0 5px 15px rgba(0, 0, 0, 0.6);
}

.glass-card h2 {
    font-weight: 800;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Custom Scrollbar for cards */
.glass-card::-webkit-scrollbar,
.tile-toggles::-webkit-scrollbar {
    width: 6px;
}
.glass-card::-webkit-scrollbar-track,
.tile-toggles::-webkit-scrollbar-track {
    background: transparent;
}
.glass-card::-webkit-scrollbar-thumb,
.tile-toggles::-webkit-scrollbar-thumb {
    background: rgba(255, 69, 0, 0.25);
    border-radius: 3px;
}
.glass-card::-webkit-scrollbar-thumb:hover,
.tile-toggles::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 69, 0, 0.45);
}

/* Config Controls */
.control-group {
    width: 100%;
}

.toggle-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    width: 100%;
}

.control-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background-color: #372f2f;
    border-radius: 34px;
    transition: 0.25s;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

input:checked + .slider {
    background-color: #ff4500;
    box-shadow: 0 0 8px rgba(255, 69, 0, 0.35);
    border-color: rgba(255, 69, 0, 0.25);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Custom Select styling */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select {
    width: 100%;
    background-color: rgba(20, 15, 15, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 10px;
    font-family: var(--font-game);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.select-wrapper select:focus {
    border-color: #ff4500;
    box-shadow: 0 0 8px rgba(255, 69, 0, 0.3);
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.7rem;
    color: var(--text-secondary);
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Tile buttons list */
.tile-toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.tile-btn {
    border: none;
    border-radius: 12px;
    font-family: var(--font-game);
    font-weight: 800;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    background-color: #221818;
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: #fff;
    opacity: 0.35;
    text-decoration: line-through;
    position: relative;
    width: 100%;
}

.tile-btn.active {
    background-color: var(--tile-color);
    opacity: 1;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.tile-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.35), 0 0 8px var(--tile-color);
}

.tile-btn:active {
    transform: translateY(1px);
}

.tile-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    background-color: transparent;
}

.tile-btn.active .tile-indicator {
    background-color: white;
}

/* Wheel Container styling */
.wheel-outer-container {
    position: relative;
    border: 12px solid #1a0f0a;
    border-radius: 50%;
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.75),
        0 0 20px rgba(255, 69, 0, 0.2),
        inset 0 0 15px rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: box-shadow 0.25s ease;
}

.wheel-outer-container.spinning-glow {
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.75),
        0 0 40px rgba(255, 69, 0, 0.6),
        inset 0 0 15px rgba(0, 0, 0, 0.9);
}

.wheel-canvas-wrapper {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#wheel-canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border-radius: 50%;
    cursor: pointer;
}

/* Pointer Needle */
.wheel-pointer {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 44px;
    z-index: 20;
    pointer-events: none;
    transform-origin: top center;
}

.wheel-pointer.wiggle {
    animation: pointerWiggle 0.12s ease-in-out infinite;
}

@keyframes pointerWiggle {
    0% { transform: translateX(-50%) rotate(0deg); }
    33% { transform: translateX(-50%) rotate(-10deg); }
    66% { transform: translateX(-50%) rotate(8deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

/* Spin Button */
.btn-spin {
    position: relative;
    font-family: var(--font-game);
    font-weight: 900;
    letter-spacing: 1px;
    color: #fff;
    background: linear-gradient(135deg, #ff4500 0%, #ca1c00 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 
        0 6px 16px rgba(255, 69, 0, 0.35),
        inset 0 1px 1px rgba(255, 255, 255, 0.25);
    outline: none;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.2), box-shadow 0.15s;
    overflow: hidden;
    user-select: none;
}

.btn-spin:hover {
    transform: scale(1.04) translateY(-1px);
    box-shadow: 
        0 10px 24px rgba(255, 69, 0, 0.5),
        0 0 12px rgba(255, 140, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.btn-spin:active {
    transform: scale(0.98) translateY(1px);
    box-shadow: 
        0 4px 8px rgba(255, 69, 0, 0.35),
        inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

.btn-spin:disabled {
    background: linear-gradient(135deg, #443232 0%, #2c1d1d 100%);
    color: #7c6464;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: translateX(-100%);
    pointer-events: none;
}

.btn-spin:hover .btn-glow {
    transform: translateX(100%);
    transition: 0.55s;
}

/* Results section */
.result-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.result-placeholder {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
}

.result-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: fadeInScale 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

.result-intro {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #ff8c00;
    text-shadow: 0 0 8px rgba(255, 140, 0, 0.25);
}

.color-badge {
    font-weight: 900;
    border-radius: 14px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.45), 0 0 10px rgba(255,255,255,0.3);
    box-shadow: 0 8px 16px rgba(0,0,0,0.35);
    border: 2px solid rgba(255,255,255,0.22);
    transition: all 0.25s;
}

/* Countdown Alert */
.countdown-card {
    background: rgba(38, 10, 10, 0.85);
    border: 1.5px solid rgba(239, 68, 68, 0.4);
    text-align: center;
    animation: slideIn 0.3s ease-out forwards;
    height: 180px;
    box-sizing: border-box;
    overflow: hidden;
}

@keyframes slideIn {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

.countdown-card h2 {
    color: #ef4444;
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
    justify-content: center;
}

.countdown-timer {
    font-weight: 900;
    color: #ef4444;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    animation: heartbeat 1s ease-in-out infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    height: 60px;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    12% { transform: scale(1.12); }
    25% { transform: scale(1); }
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, #ff8c00, #ef4444);
    border-radius: 5px;
}

.countdown-subtext {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Challenge Card */
.challenge-card {
    background: rgba(43, 29, 15, 0.75);
    border: 1.5px solid rgba(251, 191, 36, 0.35);
    text-align: center;
    animation: slideIn 0.3s ease-out forwards;
}

.challenge-card h2 {
    color: #fbbf24;
    border-bottom: 1px solid rgba(251, 191, 36, 0.18);
    justify-content: center;
}

.challenge-text {
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.45);
}

.hidden {
    display: none !important;
}

/* Fullscreen Lava Disaster Alert */
.lava-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(185, 28, 28, 0.95);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: flashOverlay 0.5s infinite alternate, shakeScreen 0.25s infinite;
}

.lava-overlay-content {
    background: rgba(15, 5, 5, 0.92);
    border: 4px solid #f97316;
    border-radius: 30px;
    padding: 35px 50px;
    box-shadow: 0 0 50px rgba(249, 115, 22, 0.65);
    max-width: 90%;
}

.lava-alert-text {
    font-size: 3rem;
    font-weight: 900;
    color: #f97316;
    text-shadow: 0 0 20px #f97316;
    margin-bottom: 12px;
    animation: scaleText 0.5s infinite alternate;
}

.lava-alert-subtext {
    font-size: 1.35rem;
    font-weight: 600;
    color: #f3f4f6;
    margin-bottom: 24px;
}

.btn-close-overlay {
    padding: 12px 36px;
    font-family: var(--font-game);
    font-size: 1.15rem;
    font-weight: 800;
    color: white;
    background-color: #f97316;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    transition: transform 0.15s, background-color 0.15s;
}

.btn-close-overlay:hover {
    background-color: #ea580c;
    transform: scale(1.04);
}

.btn-close-overlay:active {
    transform: scale(0.96);
}

@keyframes flashOverlay {
    0% { background-color: rgba(185, 28, 28, 0.9); }
    100% { background-color: rgba(220, 38, 38, 0.96); }
}

@keyframes shakeScreen {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-2px, 0px) rotate(1deg); }
    30% { transform: translate(0px, 1px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    55% { transform: translate(-1px, 1px) rotate(-1deg); }
    70% { transform: translate(-2px, 1px) rotate(0deg); }
    85% { transform: translate(1px, 1px) rotate(-1deg); }
    100% { transform: translate(1px, -1px) rotate(0deg); }
}

@keyframes scaleText {
    0% { transform: scale(0.96); }
    100% { transform: scale(1.04); }
}


/* ==========================================================================
   DESKTOP VIEWPORT LAYOUT & STYLING
   ========================================================================== */
@media (min-width: 1024px) {
    body {
        overflow-y: auto;
        align-items: flex-start;
    }
    
    .app-container {
        position: relative;
        left: auto;
        transform: none;
        margin: 0 auto;
        width: 100%;
        max-width: 1280px;
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 8px;
        box-sizing: border-box;
        min-height: 100vh;
    }
    
    .app-header {
        margin-bottom: 0px;
        flex-shrink: 0;
    }
    
    .game-title {
        font-size: 1.85rem;
        margin: 0;
    }
    
    .game-subtitle {
        font-size: 0.8rem;
        margin-top: 1px;
    }
    
    .game-layout {
        display: grid;
        grid-template-columns: 240px 1fr 260px;
        gap: 12px;
        min-height: 0;
        align-items: start;
    }
    
    .side-panel {
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-height: 0;
    }
    
    .glass-card {
        flex: 0 0 auto;
        padding: 12px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        min-height: 0;
    }
    
    .glass-card h2 {
        font-size: 0.95rem;
        padding-bottom: 4px;
        margin-bottom: 8px;
        flex-shrink: 0;
    }
    
    .section-description {
        font-size: 0.7rem;
        margin-bottom: 6px;
        flex-shrink: 0;
        line-height: 1.3;
    }
    
    .control-group {
        margin-bottom: 6px;
        flex-shrink: 0;
    }
    
    .control-label {
        font-size: 0.85rem;
    }
    
    .slider {
        width: 38px;
        height: 20px;
    }
    
    .slider:before {
        height: 14px;
        width: 14px;
        left: 2px;
        bottom: 2px;
    }
    
    input:checked + .slider:before {
        transform: translateX(18px);
    }
    
    .select-wrapper select {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 8px;
    }
    
    .tile-toggles {
        gap: 4px;
    }
    
    .tile-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 8px;
    }
    
    /* Center Wheel Panel in Desktop */
    .wheel-panel {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 12px;
        min-height: 0;
    }
    
    .wheel-outer-container {
        width: 100%;
        max-width: min(460px, 65vh);
        max-height: min(460px, 65vh);
        aspect-ratio: 1 / 1;
        flex-shrink: 0;
        border-width: 12px;
    }
    
    .btn-spin {
        padding: 10px 28px;
        font-size: 1.1rem;
        border-radius: 40px;
        flex-shrink: 0;
    }
    
    /* Right Panel Details */
    .result-card {
        flex: 0 0 auto;
        min-height: 80px;
    }
    
    .result-placeholder {
        font-size: 0.75rem;
    }
    
    .result-intro {
        font-size: 0.7rem;
    }
    
    .color-badge {
        font-size: 1.4rem;
        padding: 4px 16px;
        min-width: 120px;
        border-radius: 10px;
    }
    
    .countdown-card {
        flex: 0 0 auto;
        height: 130px;
    }
    
    .countdown-timer {
        font-size: 2.25rem;
        margin: 2px 0;
        height: 40px;
    }
    
    .countdown-subtext {
        font-size: 0.7rem;
        margin-top: 4px;
    }
    
    .challenge-card {
        /* Auto height on scrolling mode to allow normal flow */
    }
    
    .challenge-text {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}

/* ==========================================================================
   DESKTOP SCREEN HEIGHT LIMITS: SCROLL-LOCK ACTIVATED
   Only locks view when screen height is sufficient (>= 740px) to prevent vertical clipping.
   ========================================================================== */
@media (min-width: 1024px) and (min-height: 740px) {
    html, body {
        height: 100vh;
        max-height: 100vh;
        min-height: 100vh;
        overflow: hidden;
    }
    body {
        align-items: center;
    }
    
    .app-container {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        height: 100vh;
        max-height: 100vh;
        min-height: 0;
        justify-content: space-between;
        overflow: hidden;
    }
    
    .game-layout {
        height: 0;
        max-height: 100%;
        flex: 1;
        align-items: stretch;
        overflow: hidden;
    }
    
    .side-panel {
        height: 100%;
        overflow: hidden;
    }
    
    .glass-card {
        overflow-y: auto;
    }
    
    .tile-toggles {
        flex: 1;
        overflow-y: auto;
    }
    
    .wheel-panel {
        height: 100%;
    }
    
    .challenge-card {
        flex: 1;
    }
}


/* ==========================================================================
   TABLETS AND MOBILE VIEWPORT (SCROLL PERMITTED)
   ========================================================================== */
@media (max-width: 1023px) {
    body {
        overflow-y: auto;
        align-items: flex-start;
    }
    
    .app-container {
        width: 100%;
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .app-header {
        margin-bottom: 4px;
    }
    
    .game-title {
        font-size: 2.25rem;
    }
    
    .game-subtitle {
        font-size: 1rem;
    }
    
    .game-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    /* Reordering for flow: Wheel -> Results -> Config */
    .wheel-panel {
        order: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 20px;
        margin-bottom: 8px;
        width: 100%;
    }
    
    .wheel-outer-container {
        width: min(320px, 75vw);
        height: min(320px, 75vw);
        border-width: 10px;
    }
    
    .btn-spin {
        padding: 14px 40px;
        font-size: 1.3rem;
    }
    
    .side-panel.right-panel {
        order: 2;
    }
    
    .side-panel.left-panel {
        order: 3;
    }
    
    .glass-card {
        padding: 20px;
        min-height: auto;
        overflow-y: visible;
    }
    
    .glass-card h2 {
        font-size: 1.15rem;
        padding-bottom: 8px;
        margin-bottom: 14px;
    }
    
    .tile-toggles {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .tile-btn {
        width: calc((100% - 16px) / 3);
        max-width: 110px;
        aspect-ratio: 1 / 1;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 10px;
        font-size: 0.85rem;
        gap: 6px;
        border-radius: 16px;
    }
    
    .color-badge {
        font-size: 1.8rem;
        padding: 8px 24px;
        min-width: 160px;
    }
    
    .countdown-timer {
        font-size: 3.5rem;
    }
    
    .challenge-text {
        font-size: 1rem;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 12px;
    }
    
    .game-title {
        font-size: 1.85rem;
    }
    
    .wheel-outer-container {
        width: min(270px, 75vw);
        height: min(270px, 75vw);
        border-width: 8px;
    }
    
    .btn-spin {
        padding: 12px 32px;
        font-size: 1.15rem;
    }
    
    .lava-alert-text {
        font-size: 2rem;
    }
    
    .lava-alert-subtext {
        font-size: 1.1rem;
    }
}

/* ==========================================================================
   APP HEADER FLEX LAYOUT
   ========================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 24px;
    gap: 16px;
}

@media (min-width: 1024px) {
    .app-header {
        margin-bottom: 12px;
    }
}

.header-titles {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* ==========================================================================
   SETTINGS POPUP BUTTON & OVERLAY MODAL
   ========================================================================== */
.btn-settings-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.35rem;
    color: var(--text-primary);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.btn-settings-toggle:hover {
    border-color: rgba(255, 69, 0, 0.45);
    box-shadow: 0 6px 16px rgba(255, 69, 0, 0.2), 0 0 8px rgba(255, 69, 0, 0.1);
    transform: rotate(45deg) scale(1.05);
}

.btn-settings-toggle:active {
    transform: scale(0.95);
}

/* Settings Modal Overlay Background */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 950;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeInModal 0.25s ease-out forwards;
}

/* Modal Content Card */
.settings-modal-card {
    width: 100%;
    max-width: 400px;
    background: rgba(26, 16, 16, 0.96) !important;
    border: 1.5px solid rgba(255, 69, 0, 0.35) !important;
    border-radius: 24px;
    padding: 24px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(255, 69, 0, 0.15) !important;
    transform: scale(0.9);
    animation: popInModal 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: visible !important;
}

.settings-modal-card h2 {
    font-size: 1.25rem !important;
    padding-bottom: 8px !important;
    margin-bottom: 4px !important;
    color: #fff;
    font-weight: 800;
}

.settings-modal-card .control-group {
    width: 100%;
}

.settings-modal-card .toggle-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Modal Actions Buttons */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    width: 100%;
}

.btn-modal {
    padding: 10px 22px;
    font-family: var(--font-game);
    font-size: 0.9rem;
    font-weight: 800;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-modal-cancel {
    background-color: #372f2f;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-modal-cancel:hover {
    background-color: #4b3e3e;
}

.btn-modal-save {
    background: linear-gradient(135deg, #ff4500 0%, #ca1c00 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.35);
}

.btn-modal-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 69, 0, 0.5);
}

.btn-modal:active {
    transform: translateY(1px);
}

@keyframes fadeInModal {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes popInModal {
    0% { transform: scale(0.9); }
    100% { transform: scale(1); }
}
