body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100dvh; /* Dynamic viewport fixes mobile URL bar cutoffs */
    overflow: hidden;
    background-color: #0b0c10; /* Darker gaming background */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    overscroll-behavior: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Portrait Warning */
#portrait-warning {
    display: none;
    position: absolute;
    top: 0; left: 0; width: 100%; 
    background-color: rgba(0, 255, 255, 0.85); /* Neon Cyan banner */
    color: #000;
    z-index: 2000;
    text-align: center;
    padding: 8px 10px;
    font-size: 0.9rem;
    font-weight: 900;
    box-sizing: border-box;
    pointer-events: none;
}

@media (orientation: portrait) and (max-width: 768px) {
    #portrait-warning { display: block; }
    #ui { top: 45px !important; }
}

/* HUD Overlay */
#ui {
    position: absolute;
    top: 20px; left: 20px; right: 20px;
    color: #fff;
    pointer-events: none;
    z-index: 10;
    display: none;
    justify-content: space-between;
    align-items: flex-start;
}

.stats-bar {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(11, 12, 16, 0.8);
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid #00ffff; /* Neon cyan border */
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
}

#score, #target-score {
    color: #ffff00; /* Yellow highlight for targets */
    font-weight: bold;
}

@media (min-width: 768px) {
    h2 { font-size: 1.5rem; }
    .stats-bar { padding: 10px 20px; }
}

.button-group {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-group button {
    padding: 10px 15px;
    font-size: 0.9rem;
    background-color: #1a1a1d;
    color: #00ffff;
    border: 2px solid #00ffff;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.button-group button:hover { 
    background-color: #00ffff; 
    color: #000;
}

/* Tutorial Text Overlay */
#tutorial-text {
    position: absolute;
    top: 30%; width: 100%;
    text-align: center;
    color: #ffff00;
    font-size: 2rem;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    z-index: 5;
    pointer-events: none;
    display: none;
}

/* On-Screen Arrow Controls */
#on-screen-controls {
    display: none;
    position: absolute;
    bottom: max(20px, env(safe-area-inset-bottom)); 
    right: max(20px, env(safe-area-inset-right));
    z-index: 15;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.arrow-row { display: flex; gap: 5px; }

.arrow-btn {
    width: 60px; height: 60px;
    border-radius: 12px;
    background-color: rgba(11, 12, 16, 0.8);
    color: #00ffff;
    border: 2px solid #00ffff;
    font-size: 1.5rem;
    display: flex; justify-content: center; align-items: center;
    pointer-events: auto;
    cursor: pointer;
}

.arrow-btn:active, .arrow-btn.simulated-active {
    background-color: rgba(0, 255, 255, 0.8); 
    color: #000;
}

@media (max-width: 1024px) {
    #on-screen-controls { display: flex; }
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(11, 12, 16, 0.95);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 20; text-align: center; padding: 20px; box-sizing: border-box;
}

.overlay h1 {
    font-size: 3rem;
    color: #ff3366; /* Hot pink neon */
    margin-bottom: 10px;
    text-shadow: 
        -2px -2px 0 #fff,  
         2px -2px 0 #fff,
        -2px  2px 0 #fff,
         2px  2px 0 #fff,
         0px  0px 15px #ff3366;
}

.overlay p {
    font-size: 1.1rem;
    color: #c5c6c7;
    margin: 5px 0;
}

#status-desc {
    font-size: 1.3rem;
    font-weight: 900;
    color: #000;
    text-shadow: 
        -1.5px -1.5px 0 #fff,  
         1.5px -1.5px 0 #fff,
        -1.5px  1.5px 0 #fff,
         1.5px  1.5px 0 #fff;
    margin: 15px 0;
}

.overlay button {
    margin-top: 30px; padding: 15px 30px; font-size: 1.2rem;
    background-color: #00ffff; color: #000;
    border: 3px solid #000; border-radius: 8px;
    cursor: pointer; font-weight: bold; transition: 0.2s;
}

.overlay button:hover { background-color: #fff; transform: scale(1.05); }
.overlay button:active { transform: scale(0.95); }

@media (min-width: 768px) {
    .overlay h1 { font-size: 4rem; }
    .overlay p { font-size: 1.2rem; }
    .overlay button { padding: 15px 40px; font-size: 1.5rem; }
}
