:root {
    --bg-color: #0d0e15;
    --primary-color: #ff2a6d;
    --secondary-color: #05d9e8;
    --accent-color: #01012b;
    --text-color: #ffffff;
}

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

body {
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: 100%;
    max-height: 800px;
    background-color: var(--accent-color);
    overflow: hidden;
    box-shadow: 0 0 30px rgba(5, 217, 232, 0.2);
}

#score-board {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

#score {
    font-size: 4rem;
    font-weight: 900;
    color: var(--secondary-color);
    text-shadow: 0 0 10px rgba(5, 217, 232, 0.5);
}

#best-score {
    font-size: 1rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 2px;
}

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

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 14, 21, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    z-index: 20;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
    opacity: 0;
}

h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 10px;
    color: var(--primary-color);
    text-shadow: 0 0 15px rgba(255, 42, 109, 0.6);
    letter-spacing: 2px;
}

.game-over-title {
    color: #ff0055;
    animation: shake 0.4s ease-in-out;
}

p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
    max-width: 80%;
    line-height: 1.4;
}

#rank-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffdd57;
    margin-bottom: 5px;
}

#final-score {
    font-size: 1.2rem;
    margin-bottom: 25px;
}

.btn {
    background: transparent;
    color: var(--text-color);
    border: 2px solid var(--secondary-color);
    padding: 12px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(5, 217, 232, 0.3);
    margin-bottom: 15px;
    width: 200px;
}

.btn:hover, .btn:active {
    background: var(--secondary-color);
    color: var(--bg-color);
    box-shadow: 0 0 25px var(--secondary-color);
    transform: scale(1.05);
}

.share-btn {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.3);
}

.share-btn:hover, .share-btn:active {
    background: var(--primary-color);
    color: var(--text-color);
    box-shadow: 0 0 25px var(--primary-color);
}

#toast {
    position: absolute;
    bottom: 40px;
    background: var(--secondary-color);
    color: var(--bg-color);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    animation: fadeInOut 2s forwards;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}
