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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f1a 100%);
    position: relative;
}

#page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

#page-wrapper > h1 {
    margin-bottom: 15px;
}

#page-title {
    font-family: 'Satoshi', sans-serif;
    font-size: 68px;
    font-weight: 900;
    color: #5a9de9;
    text-shadow:
        3px 3px 0 #1a3a5a,
        -2px -2px 0 #1a3a5a,
        2px -2px 0 #1a3a5a,
        -2px 2px 0 #1a3a5a;
    letter-spacing: 3px;
    margin: 0;
    text-transform: uppercase;
}

#game-container {
    position: relative;
    width: 960px;
    height: 640px;
    background: #0f0f1a;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    box-shadow:
        0 0 0 4px #333,
        0 0 0 8px #1a1a1a,
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(74, 144, 217, 0.3);
    z-index: 1;
}

#gameCanvas {
    display: block;
    background: #d4a574;
    cursor: none;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#score-display {
    font-size: 18px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#score {
    color: #ffdd44;
    font-weight: bold;
}

#hud-bottom {
    width: 960px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    padding: 10px 20px;
    background: linear-gradient(to bottom, #c41e1e, #8b1515);
    border-radius: 0 0 8px 8px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    margin-top: 8px;
}

#hud-bottom.hidden {
    display: none;
}

/* Frank Fact */
#frank-fact {
    width: 960px;
    background: linear-gradient(to bottom, #1a1a2a, #12121f);
    border-radius: 0 0 8px 8px;
    padding: 14px 20px;
    margin-top: 8px;
    border-top: 1px solid #2a2a4a;
    text-align: center;
}

#frank-fact.hidden {
    display: none;
}

.fact-label {
    color: #4a90d9;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 2px;
    margin-right: 10px;
}

#frank-fact-text {
    color: #8a9aaa;
    font-size: 14px;
    letter-spacing: 0.5px;
}

#mission-display {
    font-size: 18px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#lives-display {
    display: flex;
    gap: 6px;
    align-items: center;
}

.life-icon {
    width: 24px;
    height: 18px;
    background: linear-gradient(to bottom, #5b9bd5, #3a7ab8);
    border-radius: 3px;
    border: 2px solid #2d5a8a;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
}

.life-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 4px;
    background: #2d5a8a;
    border-radius: 1px;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(20, 20, 40, 0.97);
    color: white;
    z-index: 10;
    padding: 15px;
}

.screen.hidden {
    display: none;
}

/* Menu screen - world-class design */
#menu-screen {
    justify-content: flex-start;
    padding: 50px 50px 30px;
    background: #ffffff;
    position: relative;
}

#frank-image {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 300px;
    width: auto;
    pointer-events: none;
}

.screen h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #4a90d9;
}

.tagline {
    font-size: 17px;
    font-style: normal;
    color: #667788;
    margin: 0;
    margin-top: auto;
    padding-bottom: 10px;
    letter-spacing: 0.5px;
}

.menu-content {
    display: flex;
    gap: 60px;
    width: 100%;
    justify-content: center;
}

.menu-left {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 280px;
}

.menu-right {
    min-width: 280px;
}

.player-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-section label {
    font-size: 11px;
    font-weight: bold;
    color: #445566;
    letter-spacing: 2px;
}

#player-name {
    padding: 14px 18px;
    font-size: 18px;
    border: 2px solid #ccd0d8;
    border-radius: 8px;
    background: #f5f7fa;
    color: #333;
    text-align: center;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#player-name::placeholder {
    color: #999;
}

#player-name:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 15px rgba(74, 144, 217, 0.25);
}

.button-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-btn {
    padding: 14px 30px;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 2px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.menu-btn.primary {
    background: linear-gradient(180deg, #5a9de9 0%, #3a7dc9 100%);
    color: white;
    box-shadow: 0 4px 0 #2a5a8a, 0 6px 20px rgba(74, 144, 217, 0.4);
}

.menu-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2a5a8a, 0 10px 30px rgba(74, 144, 217, 0.5);
}

.menu-btn.primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2a5a8a, 0 3px 10px rgba(74, 144, 217, 0.3);
}

.menu-btn.secondary {
    background: rgba(60, 70, 90, 0.6);
    color: #a0b0c0;
    border: 2px solid #4a5a7a;
    box-shadow: 0 4px 0 #2a3a4a;
}

.menu-btn.secondary:hover {
    background: rgba(70, 80, 100, 0.8);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2a3a4a;
}

.menu-btn.secondary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2a3a4a;
}

#menu-screen .controls-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 15px;
    background: #f0f2f5 !important;
    border-radius: 8px;
    border: 1px solid #dde0e5 !important;
}

#menu-screen .control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #445566 !important;
}

#menu-screen .control-row .key {
    background: linear-gradient(180deg, #5a9de9 0%, #3a7dc9 100%) !important;
    color: white !important;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 2px 0 #2a5a8a;
}

#menu-screen #top-scores {
    background: #f0f2f5 !important;
    border-radius: 12px;
    border: 1px solid #dde0e5 !important;
    padding: 20px;
    height: 100%;
}

#menu-screen #top-scores h3 {
    color: #3a7dc9 !important;
    margin: 0 0 15px 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #dde0e5 !important;
}

#menu-screen #top-scores-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#menu-screen #top-scores-list .top-score-entry {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #ffffff !important;
    border-radius: 6px;
    border: 1px solid #e0e0e0 !important;
    transition: background 0.15s;
}

#menu-screen #top-scores-list .top-score-entry:hover {
    background: #f8f9fa !important;
}

#menu-screen #top-scores-list .top-score-entry:first-child {
    background: linear-gradient(90deg, rgba(255, 200, 50, 0.2) 0%, #ffffff 100%) !important;
    border: 1px solid rgba(200, 160, 50, 0.5) !important;
}

#menu-screen #top-scores-list .top-rank {
    color: #3a7dc9 !important;
    font-weight: bold;
    font-size: 14px;
    width: 30px;
}

#menu-screen #top-scores-list .top-score-entry:first-child .top-rank {
    color: #c49000 !important;
}

#menu-screen #top-scores-list .top-name {
    flex: 1;
    text-align: left;
    color: #333 !important;
    font-size: 14px;
}

#menu-screen #top-scores-list .top-score {
    color: #2e8b2e !important;
    font-weight: bold;
    font-size: 15px;
}

#menu-screen #top-scores-list .no-scores {
    color: #666 !important;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* Game Over Screen */
#game-over-screen {
    background: linear-gradient(180deg, rgba(20, 25, 40, 0.98) 0%, rgba(15, 20, 35, 0.98) 100%);
}

#game-over-screen h2 {
    font-size: 42px;
    margin-bottom: 30px;
    letter-spacing: 4px;
}

#game-over-title {
    color: #e85050;
}

.stats-grid {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 30px;
    background: rgba(30, 35, 50, 0.6);
    border-radius: 10px;
    border: 1px solid #3a4a5a;
}

.stat-label {
    font-size: 11px;
    font-weight: bold;
    color: #6a7a9a;
    letter-spacing: 2px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #4a90d9;
}

.game-over-buttons {
    margin-top: 10px;
    flex-direction: row !important;
    gap: 15px !important;
}

#score-submitted {
    margin: 15px 0;
    padding: 12px 20px;
    background: rgba(40, 100, 40, 0.4);
    border: 1px solid #4a8a4a;
    border-radius: 8px;
    color: #7eca7e;
    font-size: 14px;
    letter-spacing: 1px;
}

/* Leaderboard Screen */
#leaderboard-screen {
    background: linear-gradient(180deg, rgba(20, 25, 40, 0.98) 0%, rgba(15, 20, 35, 0.98) 100%);
}

#leaderboard-screen h2 {
    letter-spacing: 4px;
    margin-bottom: 25px;
}

/* Victory state */
#game-over-screen.victory #game-over-title {
    color: #50c878;
}

#leaderboard-list {
    width: 450px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(30, 35, 50, 0.6);
    border-radius: 12px;
    border: 1px solid #3a4a5a;
    padding: 20px;
    margin-bottom: 20px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(40, 50, 70, 0.4);
    border-radius: 8px;
    transition: background 0.15s;
}

.leaderboard-entry:hover {
    background: rgba(50, 60, 80, 0.6);
}

.leaderboard-entry:last-child {
    margin-bottom: 0;
}

.leaderboard-entry:first-child {
    background: linear-gradient(90deg, rgba(255, 200, 50, 0.2) 0%, rgba(40, 50, 70, 0.4) 100%);
    border: 1px solid rgba(255, 200, 50, 0.4);
}

.leaderboard-entry:nth-child(2) {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, rgba(40, 50, 70, 0.4) 100%);
    border: 1px solid rgba(192, 192, 192, 0.3);
}

.leaderboard-entry:nth-child(3) {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, rgba(40, 50, 70, 0.4) 100%);
    border: 1px solid rgba(205, 127, 50, 0.3);
}

.leaderboard-rank {
    color: #5a9aca;
    font-weight: bold;
    font-size: 16px;
    width: 40px;
}

.leaderboard-entry:first-child .leaderboard-rank {
    color: #ffc832;
}

.leaderboard-entry:nth-child(2) .leaderboard-rank {
    color: #c0c0c0;
}

.leaderboard-entry:nth-child(3) .leaderboard-rank {
    color: #cd7f32;
}

.leaderboard-name {
    flex: 1;
    text-align: left;
    padding-left: 10px;
    color: #c0d0e0;
    font-size: 15px;
}

.leaderboard-score {
    color: #6eca6e;
    font-weight: bold;
    font-size: 16px;
}

#mission-start {
    background: linear-gradient(180deg, rgba(20, 25, 40, 0.95) 0%, rgba(15, 20, 35, 0.95) 100%);
}

#mission-start h2 {
    font-size: 56px;
    letter-spacing: 6px;
    color: #f0e6d0;
    text-shadow:
        0 0 10px rgba(255, 200, 100, 0.6),
        0 0 30px rgba(255, 180, 80, 0.4);
    animation: pulse 1.5s ease-in-out infinite;
}

#mission-start p {
    font-size: 16px;
    color: #6a7a9a;
    margin-top: 20px;
    letter-spacing: 2px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.9; }
}

/* Pause Screen */
#pause-screen {
    background: rgba(15, 15, 25, 0.95);
}

#pause-screen h2 {
    font-size: 48px;
    letter-spacing: 8px;
    margin-bottom: 40px;
}

#pause-screen .button-section {
    flex-direction: column;
    gap: 15px;
}

.pause-hint {
    margin-top: 30px;
    color: #5a6a7a;
    font-size: 14px;
}

