* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0d1b2a; 
    touch-action: none; 
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: none; 
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; 
    display: flex;
    flex-direction: column;
    align-items: center;
}

#top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    pointer-events: auto; 
}

.nav-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #1b263b;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid #778da9;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    text-align: center;
    max-width: 30%; 
}

.nav-btn:hover {
    background: #e0e1dd;
    transform: scale(1.05);
}

#scoreboard {
    background: rgba(13, 27, 42, 0.85);
    color: white;
    padding: 10px 30px;
    border-radius: 10px;
    border: 2px solid #415a77;
    display: flex;
    align-items: center;
    gap: 20px;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.score-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 12px;
    text-transform: uppercase;
    color: #778da9;
    letter-spacing: 1px;
    margin-bottom: -5px;
}

#player-score, #ai-score, #score-divider {
    font-size: 36px;
    font-weight: bold;
    color: #e0e1dd;
}

#menu {
    margin-top: 10vh;
    background: rgba(27, 38, 59, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    pointer-events: auto; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    max-width: 90%;
    color: white;
    border: 1px solid #415a77;
}

#menu h1 {
    color: #3498db;
    margin-bottom: 25px;
    font-size: 32px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#menu p {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #bdc3c7;
}

#color-select {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #415a77;
}

.color-btn {
    display: inline-block;
    margin: 5px;
    width: 60px;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.2s, border 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border: 3px solid #ecf0f1;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.diff-btn {
    display: inline-block;
    margin: 5px;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    background-color: #415a77;
    color: white;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.diff-btn:hover {
    background-color: #778da9;
    transform: scale(1.05);
}

.diff-btn[data-diff="impossible"] {
    background-color: #e74c3c;
}

.diff-btn[data-diff="impossible"]:hover {
    background-color: #c0392b;
}

@media (max-width: 600px) {
    #top-bar { padding: 10px; }
    .nav-btn { padding: 6px 8px; font-size: 11px; max-width: 35%; }
    #scoreboard { padding: 5px 15px; gap: 10px; }
    #player-score, #ai-score, #score-divider { font-size: 24px; }
    .score-label { font-size: 9px; }
    .diff-btn, .color-btn { margin: 5px 2px; }
    .color-btn { width: 50px; font-size: 11px; }
}
