/* Pac-Man Styles — Retro Arcade Look */

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

body {
    background: #000;
    color: #fff;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    padding: 10px 0;
    font-size: 18px;
    color: #fff;
}

#score-display {
    display: flex;
    gap: 20px;
}

#score-display span {
    text-transform: uppercase;
}

#level-display {
    color: #ff0;
}

#game-canvas {
    border: 2px solid #2121de;
    background: #000;
    max-width: 100%;
    max-height: 80vh;
    aspect-ratio: 28 / 31;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#lives-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 18px;
    width: 100%;
    max-width: 800px;
    justify-content: flex-start;
}

#lives {
    color: #ff0;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#overlay.hidden {
    display: none;
}

#overlay-content {
    text-align: center;
}

#overlay-title {
    font-size: 48px;
    color: #ff0;
    margin-bottom: 20px;
    text-shadow: 0 0 10px #ff0;
}

#overlay-message {
    font-size: 18px;
    color: #fff;
    animation: blink 1s infinite;
}

#highscore-list {
    margin-top: 20px;
}

#highscore-list h2 {
    color: #ff0;
    margin-bottom: 10px;
}

#highscore-entries {
    list-style: none;
    padding: 0;
    text-align: left;
}

#highscore-entries li {
    padding: 5px;
    border-bottom: 1px solid #333;
}

#highscore-list.hidden {
    display: none;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ==================== Difficulty Buttons ==================== */

#difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

#difficulty-buttons button {
    background: #333;
    color: #fff;
    border: 2px solid #ff0;
    padding: 10px 20px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

#difficulty-buttons button:hover {
    background: #ff0;
    color: #000;
}

#difficulty-buttons button:active {
    background: #cc0;
}

/* ==================== On-Screen Controls ==================== */

#controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 6px;
    max-width: 240px;
    margin: 12px auto 0;
    user-select: none;
}

#controls button {
    width: 70px;
    height: 56px;
    font-size: 24px;
    background: #222;
    color: #fff;
    border: 2px solid #555;
    border-radius: 8px;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}

#controls button:active {
    background: #444;
}

/* Action-Button row (Restart / Pause) */
#controls .action-row {
    display: flex;
    gap: 6px;
    grid-column: 1 / -1;
    justify-content: center;
    margin-top: 4px;
}

#controls .control-btn.action {
    width: 100px;
    height: 44px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #1a1a1a;
    border-color: #ff0;
    color: #ff0;
}

#controls .control-btn.action:active {
    background: #ff0;
    color: #000;
}

/* Pause-Button hervorgehoben, wenn pausiert */
#controls .control-btn.paused {
    background: #ff0;
    color: #000;
    border-color: #fff;
}

#btn-up {
    grid-column: 2;
    grid-row: 1;
}

.controls-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 6px;
}

#btn-left {
    order: 1;
}

#btn-down {
    order: 2;
}

#btn-right {
    order: 3;
}