﻿body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #333;
    /* Letterbox color */
}

canvas {
    background-color: #87CEEB;
    /* Sky blue */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    max-height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas when possible */
}

/* Enable pointer events on actual UI elements */
.screen,
.panel,
button {
    pointer-events: auto;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    text-shadow: 2px 2px 0px #000;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 4rem;
    margin: 20px;
}

h2 {
    font-size: 2.5rem;
    margin: 15px;
    color: gold;
}

p {
    font-size: 1.5rem;
    margin: 10px;
}

.label-gold {
    color: gold;
    font-weight: bold;
    margin-bottom: 5px;
}

.label-red {
    color: red;
    font-weight: bold;
}

.label-cyan {
    color: cyan;
}

/* Menu */
.menu-btn {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 15px 40px;
    font-size: 1.35rem;
    /* Reduced from 1.5rem */
    margin: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-weight: bold;
}

.menu-btn:hover {
    background: white;
    color: black;
    transform: scale(1.1);
}

/* HUD panels */
.panel {
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid black;
    border-radius: 10px;
    padding: 15px;
    position: absolute;
    color: white;
    font-size: 1.2rem;
}

#hud-normal .panel {
    top: 20px;
    left: 20px;
    width: 250px;
}

#hud-normal .right-panel {
    top: 20px;
    right: 20px;
    left: auto;
    width: 250px;
}

#hud-survival .panel {
    top: 20px;
    left: 20px;
    width: 290px;
}

.center-panel {
    position: relative;
    top: auto;
    left: auto;
    width: 500px;
    margin-top: 20px;
}

/* Progress bar */
.progress-bar-bg {
    width: 100%;
    height: 20px;
    background-color: #333;
    border: 1px solid black;
    margin-top: 5px;
}

.progress-bar-fill {
    width: 100%;
    height: 100%;
    background-color: limegreen;
    transition: width 0.2s;
}

/* Animations */
.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

/* Debug */
#debug-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: lime;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px;
    pointer-events: none;
}

/* Hearts */
.heart {
    display: inline-block;
    width: 30px;
    height: 30px;
    fill: red;
    margin-right: 5px;
}

.heart.empty {
    fill: #555;
}

/* Scoreboard Styles */
.scoreboard-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 20px;
}

.scoreboard-container h1 {
    font-size: 2.5rem;
    margin: 10px 0 20px 0;
    text-align: center;
}

.scoreboard-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    /* Was 20px */
    margin: 25px 0 15px 0;
    /* Reduced margins */
}

.tab-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 2px solid #666;
    padding: 10px 35px;
    /* Was 12px 40px */
    font-size: 16px;
    /* Was 18px */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px;
}

.tab-btn.active {
    background: rgba(255, 215, 0, 0.6);
    border-color: #ffd700;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
    z-index: 10;
}

.tab-btn:hover {
    transform: scale(1.05);
}

.scoreboard-mode {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

.mode-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 2px solid #666;
    padding: 8px 25px;
    /* Was 10px 30px */
    font-size: 14px;
    /* Was 16px */
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 6px;
}

.mode-btn.active {
    background: rgba(100, 200, 255, 0.6);
    border-color: #64c8ff;
    color: #fff;
    box-shadow: 0 0 15px rgba(100, 200, 255, 0.6);
    transform: scale(1.05);
    z-index: 10;
}

.level-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.level-btn {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: 1px solid #555;
    padding: 6px 16px;
    /* Was 8px 20px */
    font-size: 13px;
    /* Was 14px */
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.level-btn.active {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    color: #ffd700;
}

.level-btn:hover {
    border-color: #888;
}

.scoreboard-list {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #444;
    border-radius: 10px;
    padding: 15px;
    /* Was 20px */
    margin: 15px 0;
    min-height: 350px;
    /* Was 400px */
    max-height: 450px;
    /* Was 500px */
    overflow-y: auto;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    /* Was 12px 15px */
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 15px;
    /* Was 16px */
    transition: background 0.2s;
}

.score-entry:hover {
    background: rgba(255, 255, 255, 0.1);
}

.score-entry.top3 {
    background: rgba(255, 215, 0, 0.15);
    border-left: 3px solid #ffd700;
}

.score-rank {
    font-weight: bold;
    color: #ffd700;
    min-width: 35px;
}

.score-country {
    font-size: 16px;
    /* Was 18px */
    min-width: 90px;
}

.score-time {
    color: #64c8ff;
    font-weight: bold;
    min-width: 70px;
    text-align: right;
}

.loading {
    text-align: center;
    color: #888;
    padding: 40px 0;
    font-size: 16px;
}

.menu-btn-secondary {
    background: rgba(100, 100, 100, 0.3);
    border-color: #666;
    margin-top: 20px;
}

.menu-btn-secondary:hover {
    background: rgba(100, 100, 100, 0.5);
    border-color: #888;
}

/* Twemoji styling */
.emoji {
    height: 1.2em;
    width: 1.2em;
    vertical-align: -0.2em;
    margin: 0 0.1em;
}

/* Buy Me a Coffee Button */
.bmc-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    background-color: #FFDD00;
    color: #000000 !important;
    padding: 8px 24px;
    /* Reduced from 12px 30px */
    border-radius: 50px;

    font-family: Arial, Helvetica, sans-serif !important;
    font-weight: bold;
    font-size: 16px;
    text-decoration: none;
    text-shadow: none !important;
    letter-spacing: normal;

    transition: all 0.2s ease;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    border: 3px solid #FFDD00;
    z-index: 100;
    white-space: nowrap;
}

.bmc-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
    background-color: #ffe44d;
}

.bmc-btn:active {
    transform: translateX(-50%) translateY(2px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
}

.bmc-btn span {
    font-size: 26px;
    /* Increased 30% from 20px */
    filter: none;
}