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

html, body {
    font-family: Arial, sans-serif;
    background: radial-gradient(ellipse at center 40%, #111 0%, #000 60%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
    touch-action: none;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

.spiral-container {
    perspective: 800px;
    perspective-origin: 50% 20%;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    touch-action: none; /* Prevent default touch scrolling */
    overscroll-behavior: none;
}

.spiral-tunnel {
    position: relative;
    transform-style: preserve-3d;
    width: 100%;
    height: 100%;
    will-change: transform;
    pointer-events: none;
    touch-action: none;
}

.spiral-letter {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    color: #fff;
    text-decoration: none;
    font-size: 2.4rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    padding: 2px; /* Small padding for easier clicking */
    display: inline-block;
    font-weight: 600;
    white-space: nowrap;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: 0.05em;
    pointer-events: auto;
    cursor: pointer;
}


.spiral-letter:hover {
    color: #fff;
    text-shadow: 0 0 40px rgba(255, 255, 255, 1), 0 0 80px rgba(255, 255, 255, 0.5);
}


/* Ripple splash effect */
.ripple {
    position: absolute;
    border-style: solid;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: ripple-expand 1.5s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes ripple-expand {
    0% {
        width: 0;
        height: 0;
    }

    100% {
        width: var(--final-size, 300px);
        height: var(--final-size, 300px);
        opacity: 0;
    }
}

.splash-center {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: splash-fade 0.8s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes splash-fade {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

.post-data {
    display: none;
}

.instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0.7;
    font-size: 0.9rem;
}

.mobile-instruction {
    display: none;
}

.velocity-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
}

#velocity-display {
    color: #fff;
    font-weight: bold;
}

@media (max-width: 768px) {
    html, body {
        background: radial-gradient(ellipse at center 30%, #111 0%, #000 50%);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    .spiral-container {
        perspective: 600px;
        perspective-origin: 50% 30%;
    }
    
    .spiral-letter {
        font-size: 1.8rem;
        padding: 4px;
        letter-spacing: 0.03em;
        pointer-events: auto;
    }
    
    .instructions {
        font-size: 1rem;
        background: rgba(0, 0, 0, 0.7);
        padding: 10px 20px;
        border-radius: 20px;
        opacity: 0.9;
    }
    
    .desktop-instruction {
        display: none;
    }
    
    .mobile-instruction {
        display: inline;
    }
    
    .velocity-indicator {
        display: none;
    }
    
    .ripple {
        animation-duration: 1s;
    }
    
    .splash-center {
        animation-duration: 0.5s;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .spiral-letter {
        font-size: 1.4rem;
        letter-spacing: 0.02em;
    }
    
    .instructions {
        font-size: 0.85rem;
        bottom: 10px;
        padding: 8px 16px;
    }
}

@media (pointer: coarse) {
    .spiral-letter {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .spiral-letter[style*="opacity: 1"],
    .spiral-letter[style*="opacity: 0.9"],
    .spiral-letter[style*="opacity: 0.8"] {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    }
    
}