* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #0a0a1a; color: #fff; font-family: 'Courier New', monospace; overflow: hidden; }

#game-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 10px;
    position: relative;
}

#gameCanvas {
    border: 2px solid #333;
    background: #111;
    image-rendering: pixelated;
}

#nextCanvas {
    display: block;
    margin: 0 auto;
    background: #111;
    border: 1px solid #333;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

#start-screen, #pause-screen, #game-over-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.92);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    pointer-events: auto;
    border: 2px solid #444;
    min-width: 280px;
}

#start-screen h1, #game-over-screen h1, #pause-screen h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #00ff88, #00aaff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.controls { margin: 15px 0; color: #888; font-size: 0.85rem; }
.controls p { margin: 4px 0; }

button {
    padding: 12px 30px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    font-family: inherit;
    transition: transform 0.1s;
}
button:hover { transform: scale(1.05); }
button:active { transform: scale(0.98); }

#hud {
    position: absolute;
    right: 10px;
    top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 150px;
}

.hud-panel {
    background: rgba(0,0,0,0.7);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}
.hud-label { font-size: 0.75rem; color: #aaa; text-transform: uppercase; letter-spacing: 1px; }
.hud-value { font-size: 1.8rem; color: #00ff88; font-weight: bold; }

#final-score { color: #ffaa00; font-size: 2rem; font-weight: bold; }
.go-stats { margin: 10px 0; color: #aaa; font-size: 0.9rem; }
.go-stats span { margin: 0 10px; }
.go-stats strong { color: #fff; }

/* Name entry */
#name-entry {
    display: none;
    margin: 12px 0;
}
#name-entry input {
    width: 160px;
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    text-align: center;
}
#name-entry input:focus {
    outline: none;
    border-color: #667eea;
}
#name-submit {
    padding: 8px 16px;
    font-size: 0.85rem;
    margin-left: 6px;
}

/* Highscore table */
#highscore-container {
    margin: 10px 0;
}
#highscore-container h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}
.highscore-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.highscore-table th {
    color: #888;
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 3px 6px;
    border-bottom: 1px solid #333;
}
.highscore-table td {
    padding: 3px 6px;
    text-align: left;
    color: #ccc;
}
.highscore-table td.hs-score {
    color: #00ff88;
    text-align: right;
}
.highscore-table tr:nth-child(1) td { color: #ffdd00; }
.highscore-table tr:nth-child(2) td { color: #c0c0c0; }
.highscore-table tr:nth-child(3) td { color: #cd7f32; }
.no-scores { color: #666; text-align: center !important; font-style: italic; }

/* Mobile */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 20;
}
.mobile-row { display: flex; gap: 5px; margin: 3px 0; }
.mobile-btn {
    flex: 1;
    padding: 15px 8px;
    font-size: 1.2rem;
    background: rgba(50,50,80,0.8);
    border: 1px solid #555;
    border-radius: 8px;
    color: #fff;
    touch-action: manipulation;
}

@media (max-width: 900px) {
    #hud { position: static; flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 5px; width: auto; }
    #mobile-controls { display: block; }
    .hud-panel { min-width: 70px; }
    #nextCanvas { height: 160px !important; }
    #game-over-screen { min-width: 90vw; max-width: 95vw; padding: 20px; }
}

/* Line clear flash */
@keyframes flash { 0%,100%{opacity:1} 50%{opacity:0.3} }
.flash { animation: flash 0.1s ease-in-out 3; }
