/* === RESET & BASIS === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    background: #0f0f1a;
    color: #e0e0e0;
    font-family: 'Segoe UI', Arial, sans-serif;
    overflow: hidden;
}

/* === SCREENS === */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    padding: 20px 20px 40px;
    margin: 0 auto;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    display: flex;
}

/* === HAUPTMENÜ === */
h1 {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.3em;
    background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.subtitle {
    color: #666;
    font-size: 1rem;
    margin-bottom: 40px;
}

/* === SPIELKARTEN === */
.game-cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.game-card {
    background: #1a1a2e;
    border: 2px solid #2a2a4a;
    border-radius: 16px;
    padding: 30px 25px;
    width: 200px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    color: #e0e0e0;
    font-family: inherit;
    font-size: inherit;
}

.game-card:hover {
    border-color: #4d96ff;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(77, 150, 255, 0.2);
}

.game-icon {
    font-size: 3rem;
}

.game-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.game-desc {
    font-size: 0.8rem;
    color: #888;
}

.game-hs {
    font-size: 0.75rem;
    color: #ffd93d;
    font-weight: 700;
    min-height: 1em;
}

/* === SPIELBEREICH === */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 480px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.back-btn {
    background: none;
    border: 1px solid #444;
    color: #aaa;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: #4d96ff;
    color: #fff;
}

#game-title {
    font-weight: 700;
    color: #fff;
}

#game-score {
    color: #ffd93d;
    font-weight: 700;
}

canvas {
    background: #111122;
    border-radius: 8px;
    border: 2px solid #2a2a4a;
    display: block;
    max-width: 100%;
    touch-action: none;
}

.hint {
    margin-top: 12px;
    color: #555;
    font-size: 0.8rem;
}

/* === HIGHSCORE-OVERLAY === */
#hs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#hs-overlay.hidden {
    display: none;
}

#hs-box {
    background: #1a1a2e;
    border: 2px solid #4d96ff;
    border-radius: 16px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 260px;
    max-width: 320px;
    width: 90%;
    text-align: center;
}

#hs-score-text {
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffd93d;
}

#hs-box label {
    color: #888;
    font-size: 0.85rem;
}

#hs-name-input {
    background: #0f0f1a;
    border: 2px solid #2a2a4a;
    color: #e0e0e0;
    font-size: 1.3rem;
    font-family: inherit;
    text-align: center;
    text-transform: uppercase;
    padding: 8px 14px;
    border-radius: 8px;
    width: 100%;
    outline: none;
    letter-spacing: 0.1em;
}

#hs-name-input:focus {
    border-color: #4d96ff;
}

#hs-save-btn {
    background: #4d96ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 28px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

#hs-save-btn:hover {
    background: #3a82e8;
}

#hs-ranking {
    width: 100%;
}

.hs-top-label {
    color: #555;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    margin-bottom: 6px;
}

.hs-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 4px;
    font-size: 0.9rem;
    color: #aaa;
    border-bottom: 1px solid #2a2a4a;
    gap: 8px;
}

.hs-entry:last-child {
    border-bottom: none;
}

.hs-entry.highlight {
    color: #ffd93d;
    font-weight: 700;
}

.hs-rank {
    color: #555;
    width: 18px;
    text-align: left;
    flex-shrink: 0;
}

.hs-entry-name {
    flex: 1;
    text-align: left;
}

.hs-not-top3 {
    color: #555;
    font-size: 0.8rem;
    margin-top: 6px;
}

/* === MOBILE === */
@media (max-width: 680px) {
    h1 {
        font-size: 2.2rem;
    }

    .game-cards {
        flex-direction: column;
        align-items: center;
    }

    .game-card {
        width: 80%;
        max-width: 280px;
        padding: 20px;
    }
}
