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

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Arial', sans-serif;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: center;
    padding: 20px 0;
}

.top-link {
    position: fixed;
    top: 10px;
    right: 15px;
    color: white;
    text-decoration: none;
    background: rgba(0,0,0,0.4);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    z-index: 500;
}

.top-link:hover {
    background: rgba(0,0,0,0.65);
}

footer {
    width: 100%;
    background: rgba(0,0,0,0.3);
    color: white;
    text-align: center;
    padding: 12px 20px;
    font-size: 0.85em;
}

footer a {
    color: rgba(255,255,255,0.8);
}

h1 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 1.6em;
}

.info-panel {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    color: white;
    font-size: 1.2em;
}

.stat--hidden {
    display: none;
}

.stat {
    background: rgba(0,0,0,0.3);
    padding: 8px 12px;
    border-radius: 8px;
    width: 110px;
    text-align: center;
}

.canvas-wrapper {
    position: relative;
    line-height: 0;
}

canvas {
    border: 3px solid white;
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: block;
    cursor: none;
    touch-action: none;
    width: 700px;
    height: 455px;
}

@media (max-width: 1024px) {
    canvas {
        width: 92vw;
        height: calc(92vw * 0.65);
    }
}

@media (min-width: 1025px) {
    .stat br { display: none; }
    .stat { width: 130px; padding: 8px 16px; }
}

.controls {
    color: white;
    text-align: center;
    background: rgba(0,0,0,0.3);
    padding: 15px 25px;
    border-radius: 8px;
}

.controls p {
    margin: 5px 0;
}

.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    display: none;
    z-index: 1000;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    max-width: 500px;
    width: 90%;
    box-sizing: border-box;
}

@media (min-width: 481px) and (max-width: 1024px) {
    .game-over {
        width: 60%;
    }
}

@media (max-width: 480px) {
    .game-over {
        width: 80%;
        padding: 25px;
    }
}

.game-over h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #ffd700;
}

.game-over p {
    font-size: 1.5em;
    margin: 10px 0;
}

.game-over button {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 1.2em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.game-over button {
    -webkit-user-select: none;
    user-select: none;
}

.game-over button:hover {
    background: #764ba2;
}

#rapidFireBtn {
    display: none;
    position: absolute;
    left: calc(50% - 90px);
    top: 10px;
    width: 180px;
    padding: 12px 4px;
    font-size: 20px;
    font-weight: bold;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 0 25px rgba(255,68,68,0.9);
    animation: rapidPulse 0.5s infinite alternate;
    -webkit-user-select: none;
    user-select: none;
}

#rapidFireBtn:disabled {
    background: transparent;
    color: #000;
    box-shadow: none;
    animation: none;
    cursor: default;
}

@keyframes rapidPulse {
    from { opacity: 0.85; }
    to   { opacity: 1; }
}

.start-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.88);
    color: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    max-width: 500px;
    width: 90%;
    box-sizing: border-box;
}

.start-screen h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #ffd700;
}

.start-screen p {
    font-size: 1.1em;
    margin: 8px 0;
}

.start-screen button {
    margin-top: 25px;
    padding: 14px 40px;
    font-size: 1.3em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    -webkit-user-select: none;
    user-select: none;
}

.start-screen button:hover {
    background: #764ba2;
}

