* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Verhindert Wackeln auf mobilen Geräten */
    touch-action: none; /* Blockiert Pull-to-Refresh */
}

body {
    font-family: fantasy, system-ui, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    background-color: #777;
}

#container, .container {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    background: linear-gradient(to bottom, #87CEEB, #FFFACD);
}

canvas {
    display: block;
    margin: 0 auto;
}

/* --- UI LEISTEN (Score, Booster, Icons & Time) --- */
#scoreBoard, #bottomBoard {
    width: 100%;
    height: 47px;
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    user-select: none;
    visibility: hidden;
    z-index: 100;
}

#scoreBoard {
    top: 0;
    background: rgba(182, 200, 220, 0.72);
    padding: 0 12px;
    gap: 8px;
}

#bottomBoard {
    bottom: 0;
    background: rgba(182, 200, 220, 0.45);
    padding: 0 15px;
}

#score {
    flex: 0 0 auto;
    min-width: 72px;
    font-size: 20px;
}

#powerUp {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

#powerUp img {
    cursor: pointer;
    height: 30px;
    width: auto;
    object-fit: contain;
}

#menu {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

#menu button {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#menu img, #soundImg, #screenImg {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain;
    margin: 0 !important;
    cursor: pointer;
}

#time {
    flex: 1;
    text-align: left;
}

#fps {
    flex: 1;
    text-align: right;
}

/* --- MENÜS (Start & Game Over) --- */
#sprite {
    display: none;
}

#mainMenu, #gameOverMenu {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding-top: 8px;
    text-align: center;
    z-index: 150;
}

#gameOverMenu {
    visibility: hidden;
}

#gameOverMenu img {
    max-width: 75%;
    max-height: 20dvh;
    object-fit: contain;
    margin-top: 10px;
}

/* --- TEXTE --- */
h1, h2, h3 {
    font-weight: normal;
}

h1 {
    font-size: clamp(42px, 11vw, 60px);
    color: #5a5816;
    transform: rotate(-10deg);
    margin: 0;
    padding: 18px 20px 14px;
}

h3 {
    text-align: right;
    margin: -8px 22px 0 0;
    color: #5e96be;
}

h3 a {
    color: #5a5816;
}

#go_score {
    text-align: center;
    margin: 8px 16px 0;
    color: #1e293b;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 16px;
}

/* Alte statische Tabelle ausblenden, da Game.js das Live-Panel rendert */
.highScore {
    display: none;
}

/* --- BUTTONS & POSITIONIERUNG --- */
.buttons {
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 38px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.button {
    min-width: 120px;
    height: 36px;
    padding: 0 18px;
    background-color: #64748b;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.button:active {
    transform: scale(0.96);
}

.button:hover, .ok {
    background-color: #04AA6D;
}

/* Play-Button höher setzen, damit darunter die Top-10-Liste & Impressum sauber Platz haben */
.button.play {
    position: absolute;
    left: 50%;
    bottom: clamp(195px, 28dvh, 235px);
    transform: translateX(-50%);
    z-index: 160;
}

. button.play:active {
    transform: translateX(-50%) scale(0.96);
}

/* Kompakte Höhe für das injizierte Highscore-Panel auf Smartphones */
#rj-main-hs .rj-hs-list {
    max-height: clamp(88px, 14dvh, 130px) !important;
}

#rj-go-hs {
    margin-top: 4px !important;
}

#rj-go-hs .rj-hs-list {
    max-height: clamp(90px, 16dvh, 140px) !important;
}

/* --- FOOTER & PWA INSTALL --- */
.copy {
    position: absolute;
    left: 16px;
    bottom: 10px;
    margin: 0;
    font-size: 13px;
    color: #5e96be;
    z-index: 165;
}

.impressum {
    position: absolute;
    right: 16px;
    bottom: 10px;
    font-size: 13px;
    color: #5e96be;
    text-decoration: none;
    z-index: 165;
    cursor: pointer;
}

.impressum:hover, .btnInstall:hover {
    text-decoration: underline;
}

.btnInstall {
    position: absolute;
    right: 6px;
    top: 210px;
    color: #5e96be;
    text-decoration: none;
    writing-mode: sideways-lr;
    z-index: 165;
    cursor: pointer;
}
