/* ==========================================================================
   STACK MASTER - Menu & Modal Stylesheet (menu.css)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Splash Screen
   -------------------------------------------------------------------------- */
#splashScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
    padding: 30px;
}

.splash-logo-container {
    text-align: center;
    margin-bottom: 40px;
    animation: floatAnim 3s ease-in-out infinite;
}

.splash-icon {
    font-size: 64px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.splash-title {
    font-size: 38px;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.splash-subtitle {
    font-size: 14px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #fed7aa;
    margin-top: 4px;
}

.splash-loader {
    width: 100%;
    max-width: 260px;
    text-align: center;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #ffffff);
    border-radius: 999px;
    transition: width 0.15s ease-out;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: #fed7aa;
}

/* --------------------------------------------------------------------------
   Main Menu Screen
   -------------------------------------------------------------------------- */
#mainMenuScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    pointer-events: auto;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

.stat-icon {
    color: #fbbf24;
    font-size: 16px;
}

.menu-hero {
    text-align: center;
    margin: auto 0;
    padding: 12px 0;
    flex-shrink: 0;
}

.game-title {
    font-size: 44px;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.05;
    text-transform: uppercase;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.game-tagline {
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #fed7aa;
    margin-top: 6px;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    flex-shrink: 0;
}

.btn-play-hero {
    padding: 16px 32px;
    font-size: 19px;
    letter-spacing: 2px;
    animation: pulseGlow 2.5s infinite;
}

.btn-more-games {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    border: 1px solid rgba(147, 197, 253, 0.3);
    text-decoration: none;
}

.btn-more-games:hover {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
    transform: translateY(-2px);
}

.badge-reward {
    display: inline-block;
    padding: 2px 6px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
    margin-left: 6px;
}

/* --------------------------------------------------------------------------
   Modal Overlays (Game Over, Settings, How to Play, Pause)
   -------------------------------------------------------------------------- */
.ui-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.ui-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 360px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(15px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ui-modal.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-title {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: #ffffff;
}

/* Game Over Stats Grid */
.gameover-score-wrap {
    margin-bottom: 20px;
}

.gameover-big-score {
    font-size: 64px;
    font-weight: 900;
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 2px 15px rgba(249, 115, 22, 0.5);
}

.gameover-score-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #94a3b8;
    margin-top: 4px;
}

.badge-new-best {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    border-radius: 999px;
    letter-spacing: 1px;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 8px;
}

.stat-box-value {
    font-size: 20px;
    font-weight: 800;
    color: #fbbf24;
}

.stat-box-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.modal-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Settings Toggle Rows */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-label {
    font-size: 15px;
    font-weight: 600;
}

/* Switch Toggle UI */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #475569;
    transition: 0.25s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #f97316;
}

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

/* How to Play list */
.how-to-play-content {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
    color: #e2e8f0;
}

.instruction-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f97316;
    color: #fff;
    border-radius: 50%;
    font-weight: 800;
    font-size: 12px;
    flex-shrink: 0;
}
