:root {
  --bg-color: #050b14;
  --text-main: #00d2ff;
  --text-dim: #94a3b8;
  --overlay-bg: rgba(5, 11, 20, 0.85);
}

html[data-theme="light"] {
  --bg-color: #f8fafc;
  --text-main: #0ea5e9;
  --text-dim: #475569;
  --overlay-bg: rgba(248, 250, 252, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-main);
    touch-action: pan-y; /* Allow vertical pull-to-refresh */
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
}

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

#score-display {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
    z-index: 10;
}

#start-screen, #game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--overlay-bg);
    backdrop-filter: blur(5px);
    pointer-events: auto;
    z-index: 20;
    text-align: center;
}

#game-over {
    display: none;
}

h2 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--text-main);
    text-shadow: 0 0 20px rgba(0, 210, 255, 0.5);
}

p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: var(--text-dim);
}

.btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--text-main);
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
}

.btn:hover {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
    transform: translateY(-2px);
}

.btn.outline {
    border-color: #94a3b8;
    color: #94a3b8;
    text-decoration: none;
}

.btn.outline:hover {
    background: rgba(148, 163, 184, 0.1);
    box-shadow: none;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    pointer-events: auto;
    display: none; /* Hidden by default, shown via JS on touch devices */
}

.control-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: white;
    backdrop-filter: blur(5px);
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

#rotate-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: var(--bg-color);
    color: var(--text-main);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    text-align: center;
    padding: 20px;
}

#rotate-screen svg {
    margin-bottom: 20px;
    color: var(--text-main);
    animation: rotatePhone 2s infinite;
}

@keyframes rotatePhone {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-90deg); }
    100% { transform: rotate(-90deg); }
}

@media screen and (orientation: portrait) and (max-width: 768px) {
    #rotate-screen {
        display: flex;
    }
}

@media (max-width: 768px) {
    #mobile-controls {
        display: none; /* Remains none until JS detects touch */
    }
}
