body {
    font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #69d2e7;
    margin: 0;
    display: flex;
    justify-content: center;
    overflow: hidden;
    /* Allow regular scrolling (pan-y) until drag logic intervenes */
    touch-action: pan-y; 
}

.container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
}

header {
    margin-bottom: 10px;
    color: #a7dbd8;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link {
    text-decoration: none;
    font-weight: bold;
    color: #fa6900;
    font-size: 18px;
    transition: transform 0.2s;
}

.back-link:hover {
    transform: translateX(-3px);
}

h1 {
    margin: 0;
    font-size: 32px;
    color: #fa6900;
    text-shadow: 0 0 10px rgba(250, 105, 0, 0.5);
}

.score-board {
    background: linear-gradient(135deg, #f38630, #fa6900);
    padding: 5px 10px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    display: flex;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(250, 105, 0, 0.3);
}

.game-area {
    flex: 1;
    position: relative;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    border-radius: 10px;
    /* Enable vertical scrolling */
    overflow-y: auto; 
    overflow-x: hidden;
    /* iOS smooth scrolling */
    -webkit-overflow-scrolling: touch; 
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

canvas {
    background: transparent;
    border-radius: 5px;
    cursor: grab;
    display: block; /* Removes scrollbar gap */
}

canvas:active {
    cursor: grabbing;
}

.overlay {
    position: absolute;
    /* Stick to the viewport logic */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 250px;
    z-index: 100;
    animation: slideIn 0.3s ease-out;
    /* Position fixed to stay on screen while lane scrolls */
    position: fixed; 
}

@keyframes slideIn {
    from {
        transform: translate(-50%, -60%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

h2 {
    margin: 0;
    color: #fa6900;
    font-size: 36px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.final-score-display {
    font-size: 48px;
    font-weight: bold;
    color: #333;
}

.actions {
    display: flex;
    flex-direction: column; 
    justify-content: center;
    gap: 15px; 
    width: 100%;
}

.btn {
    background: linear-gradient(135deg, #f38630, #fa6900);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(250, 105, 0, 0.3);
    width: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 105, 0, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.twitter {
    background: linear-gradient(135deg, #1da1f2, #0c85d0);
}

.tutorial-text {
    position: fixed; /* Fixed so it's always visible at bottom of viewport */
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-weight: bold;
    pointer-events: none;
    opacity: 0.8;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

@media screen and (max-width: 520px) {
    .header-top {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 10px;
        align-items: center;
    }

    .back-link {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    h1 {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
        font-size: 24px;
        margin: 0;
    }

    .score-board {
        grid-column: 2;
        grid-row: 2;
        justify-self: end;
    }
}