* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0a0a0a;
    overflow: hidden;
    font-family: 'IBM Plex Sans', sans-serif;
    color: #e8e8e8;
    user-select: none;
}

#scene-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

#scene-container canvas {
    display: block;
}

#particles-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 50;
    pointer-events: none;
}

.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Title Screen */
#title-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    background: radial-gradient(ellipse at center bottom, rgba(0,180,255,0.05) 0%, transparent 60%);
}

.title-content {
    text-align: center;
    z-index: 2;
}

.title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 100;
    font-size: clamp(3rem, 10vw, 6rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #e8e8e8;
    text-shadow: 0 0 40px rgba(0,180,255,0.3);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-weight: 300;
    font-size: clamp(0.9rem, 3vw, 1.3rem);
    color: rgba(232,232,232,0.5);
    letter-spacing: 0.5em;
    text-transform: uppercase;
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.thumbprint-glow {
    position: absolute;
    bottom: 15%;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,180,255,0.3) 0%, transparent 70%);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 1; }
}

/* HUD */
.hud-top-left {
    position: fixed;
    top: 12px; left: 12px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,180,255,0.2);
    border-radius: 20px;
    padding: 6px 16px;
    display: flex;
    gap: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    z-index: 20;
}

.hud-top-right {
    position: fixed;
    top: 12px; right: 12px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,180,255,0.15);
    border-radius: 8px;
    padding: 6px 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.55rem;
    z-index: 20;
    max-width: 55vw;
    overflow-x: auto;
}

.scorecard-table {
    border-collapse: collapse;
}

.scorecard-table th, .scorecard-table td {
    padding: 1px 4px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 22px;
}

.scorecard-table th {
    color: rgba(255,255,255,0.4);
    font-weight: 300;
}

.frame-current {
    background: rgba(0,180,255,0.15);
    box-shadow: 0 0 8px rgba(0,180,255,0.3);
}

.controls-layer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 15;
}

/* Power Meter */
.power-meter {
    position: fixed;
    left: 12px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.power-label, .hook-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
}

.power-track {
    width: 28px;
    height: 180px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
}

.power-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to top, #22c55e, #eab308 50%, #ff3b3b);
    border-radius: 0 0 14px 14px;
    transition: height 0.1s;
}

.power-indicator {
    position: absolute;
    left: -4px; right: -4px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    bottom: 50%;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
    transition: bottom 0.1s;
}

.power-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.6);
}

/* Hook Control */
.hook-control {
    position: fixed;
    right: 12px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hook-track {
    width: 28px;
    height: 180px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
}

.hook-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 0%;
    background: linear-gradient(to top, rgba(0,180,255,0.3), rgba(0,180,255,0.8));
    border-radius: 0 0 14px 14px;
    transition: height 0.1s;
}

.hook-indicator {
    position: absolute;
    left: -4px; right: -4px;
    height: 3px;
    background: #00b4ff;
    border-radius: 2px;
    bottom: 0%;
    box-shadow: 0 0 8px rgba(0,180,255,0.5);
    transition: bottom 0.1s;
}

.hook-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: rgba(0,180,255,0.8);
}

/* Aim Area */
.aim-area {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.aim-track {
    width: clamp(200px, 50vw, 350px);
    height: 28px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    touch-action: none;
}

.aim-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    background: radial-gradient(circle, #00b4ff, transparent);
    border: 2px solid #00b4ff;
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(0,180,255,0.6);
    transition: left 0.05s;
}

.aim-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.5);
}

/* Bowl Button */
.bowl-btn {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px; height: 44px;
    border-radius: 22px;
    border: 2px solid #00b4ff;
    background: rgba(0,180,255,0.15);
    color: #00b4ff;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.bowl-btn:hover {
    background: rgba(0,180,255,0.3);
    box-shadow: 0 0 20px rgba(0,180,255,0.4);
}

.bowl-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.bowl-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Ball Info */
.ball-info {
    position: fixed;
    bottom: 16px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
}

.ball-weight-btn {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: #e8e8e8;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ball-color-dot {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #111;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    margin-left: 4px;
}

/* Oil pattern select */
.oil-select {
    position: fixed;
    bottom: 16px;
    right: 12px;
    display: flex;
    gap: 4px;
}

.oil-btn {
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.4);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.55rem;
    cursor: pointer;
    transition: all 0.2s;
}

.oil-btn.active {
    border-color: rgba(0,180,255,0.4);
    background: rgba(0,180,255,0.1);
    color: #00b4ff;
}

.sound-toggle {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    width: 32px; height: 32px;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Speed display */
.speed-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2rem;
    font-weight: 100;
    color: rgba(255,255,255,0.7);
    text-shadow: 0 0 20px rgba(0,180,255,0.5);
    z-index: 30;
    pointer-events: none;
    animation: fadeSpeed 2s ease-out forwards;
}

@keyframes fadeSpeed {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

/* Result overlay */
.result-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 40;
    pointer-events: none;
}

.result-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(3rem, 12vw, 7rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: resultIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.result-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 1rem;
    color: rgba(255,255,255,0.5);
    margin-top: 8px;
}

@keyframes resultIn {
    0% { opacity: 0; transform: scale(2); }
    100% { opacity: 1; transform: scale(1); }
}

.result-strike {
    color: #ff3b3b;
    text-shadow: 0 0 60px rgba(255,59,59,0.6), 0 0 120px rgba(255,59,59,0.3);
}

.result-spare {
    color: #00b4ff;
    text-shadow: 0 0 60px rgba(0,180,255,0.6);
}

.result-gutter {
    color: rgba(255,255,255,0.3);
}

.result-turkey {
    color: #f5a623;
    text-shadow: 0 0 60px rgba(245,166,35,0.6);
}

.result-perfect {
    background: linear-gradient(45deg, #f5a623, #ff3b3b, #f5a623);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 30px rgba(245,166,35,0.8));
}

/* Game Over */
#gameover-screen {
    pointer-events: auto;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gameover-content {
    text-align: center;
}

.gameover-title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 100;
    font-size: 1.5rem;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-bottom: 1rem;
}

.final-score {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(4rem, 15vw, 8rem);
    line-height: 1;
    color: #e8e8e8;
    text-shadow: 0 0 40px rgba(0,180,255,0.3);
}

.final-grade {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 2rem;
    color: #00b4ff;
    margin: 0.5rem 0 1.5rem;
}

.game-stats {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.8;
    margin-bottom: 2rem;
}

.play-again-btn {
    padding: 12px 40px;
    border-radius: 30px;
    border: 2px solid #00b4ff;
    background: rgba(0,180,255,0.1);
    color: #00b4ff;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.3s;
}

.play-again-btn:hover {
    background: rgba(0,180,255,0.25);
    box-shadow: 0 0 30px rgba(0,180,255,0.3);
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

.app-footer a {
    color: rgba(255,255,255,0.15);
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    transition: color 0.3s;
}

.app-footer a:hover {
    color: rgba(0,180,255,0.5);
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .power-track, .hook-track {
        height: 140px;
    }
    .hud-top-right {
        font-size: 0.45rem;
        max-width: 60vw;
    }
    .bowl-btn {
        width: 70px;
        height: 40px;
    }
}