:root {
    --hater-red: #FF4444;
    --hater-dark: #8B0000;
    --strawberry-pink: #FF6B9D;
    --combo-gold: #FDB43A;
    --bg-dark: #2D1B3D;
    --bg-pink: #8B2252;
    --villain-purple: #4A0E4E;
}

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

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-pink) 50%, var(--villain-purple) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    color: white;
}

#game-container {
    position: relative;
    max-width: 800px;
    width: 100%;
    margin: 10px auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 68, 68, 0.2);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(255, 68, 68, 0.3);
}

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

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* HUD */
#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    z-index: 10;
}

#hud-left, #hud-center, #hud-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#hud-right {
    align-items: flex-end;
}

.hud-box {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 68, 68, 0.4);
    backdrop-filter: blur(4px);
}

.hud-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.hater-score-box #score {
    font-family: 'Bangers', cursive;
    font-size: 32px;
    color: var(--hater-red);
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    line-height: 1;
}

.combo-box #combo {
    font-family: 'Bangers', cursive;
    font-size: 22px;
    color: var(--combo-gold);
    text-shadow: 0 0 8px rgba(253, 180, 58, 0.5);
}

.accuracy-box #accuracy {
    font-family: 'Space Mono', monospace;
    font-size: 16px;
    color: #AAF;
    font-weight: 700;
}

.vibe-bar-container {
    width: 140px;
    height: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    overflow: hidden;
    margin: 4px 0;
}

#vibe-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--strawberry-pink), #FF9ED2);
    width: 100%;
    transition: width 0.3s ease;
    border-radius: 5px;
}

#vibe-hp {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--strawberry-pink);
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, rgba(74, 14, 78, 0.97) 0%, rgba(45, 27, 61, 0.98) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    overflow-y: auto;
}

.title-section {
    text-align: center;
    margin-bottom: 20px;
}

.game-title {
    font-family: 'Bangers', cursive;
    font-size: 56px;
    color: var(--hater-red);
    text-shadow: 4px 4px 0 rgba(0,0,0,0.4), 0 0 30px rgba(255, 68, 68, 0.4);
    letter-spacing: 3px;
    animation: angryShake 0.5s ease-in-out infinite;
}

@keyframes angryShake {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-2px) rotate(-0.5deg); }
    75% { transform: translateX(2px) rotate(0.5deg); }
}

.subtitle-villain {
    font-family: 'Fredoka', sans-serif;
    font-size: 18px;
    color: var(--combo-gold);
    margin-top: 4px;
    font-weight: 600;
}

.subtitle-fork {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.instructions {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 28px;
    border-radius: 14px;
    border: 1px solid rgba(255, 68, 68, 0.3);
    margin-bottom: 16px;
    max-width: 420px;
    width: 100%;
}

.instruction-item {
    font-size: 16px;
    margin-bottom: 10px;
    color: #DDD;
}

.key {
    display: inline-block;
    background: var(--hater-red);
    color: white;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.instruction-tip {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    line-height: 1.6;
    text-align: center;
}

.instruction-tip strong {
    color: var(--combo-gold);
}

.instruction-tip em {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

#high-score-display {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 14px;
}

#high-score {
    color: var(--hater-red);
    font-family: 'Space Mono', monospace;
}

.game-button {
    background: var(--hater-red);
    color: white;
    border: none;
    padding: 16px 44px;
    border-radius: 50px;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 68, 68, 0.4);
    transition: all 0.3s ease;
    font-family: 'Bangers', cursive;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.pulse-btn {
    animation: pulseAttack 1.5s ease-in-out infinite;
}

@keyframes pulseAttack {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 20px rgba(255, 68, 68, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 12px 30px rgba(255, 68, 68, 0.6); }
}

.game-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 68, 68, 0.6);
}

.difficulty-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 68, 68, 0.4);
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 18px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Fredoka', sans-serif;
}

.difficulty-btn:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: var(--hater-red);
}

.difficulty-btn.active {
    background: var(--hater-red);
    color: white;
    border-color: var(--hater-red);
}

.credits {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.credits strong {
    color: var(--combo-gold);
}

/* Game Over */
#game-over-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    overflow-y: auto;
}

#game-over-screen.win-screen {
    background: radial-gradient(ellipse at center, rgba(45, 27, 61, 0.97) 0%, rgba(30, 15, 40, 0.98) 100%);
}

#game-over-screen.lose-screen {
    background: radial-gradient(ellipse at center, rgba(20, 60, 40, 0.97) 0%, rgba(10, 40, 30, 0.98) 100%);
}

.game-over-title {
    font-family: 'Bangers', cursive;
    font-size: 44px;
    color: white;
    margin-bottom: 6px;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

.game-over-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 16px;
    text-align: center;
    max-width: 400px;
    line-height: 1.4;
}

.final-score {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 40px;
    border-radius: 16px;
    margin-bottom: 12px;
    text-align: center;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.final-score div {
    font-family: 'Fredoka', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #DDD;
    margin: 6px 0;
}

.final-score span {
    color: var(--hater-red);
    font-family: 'Bangers', cursive;
    font-size: 32px;
}

.high-score-label {
    font-size: 16px !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

#stats-breakdown {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    text-align: left;
}

.stat span {
    font-weight: 700;
    color: var(--combo-gold);
    font-family: 'Space Mono', monospace;
}

#encouragement {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 14px;
    text-align: center;
    max-width: 450px;
    line-height: 1.4;
}

#achievements {
    margin-bottom: 14px;
}

.achievement-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--combo-gold);
    margin-bottom: 8px;
    text-align: center;
}

.achievement {
    background: rgba(253, 180, 58, 0.15);
    color: white;
    padding: 5px 14px;
    border-radius: 16px;
    margin: 3px;
    display: inline-block;
    font-size: 13px;
    border: 1px solid rgba(253, 180, 58, 0.3);
}

.share-button {
    background: var(--combo-gold);
    color: #333;
    border: none;
    padding: 12px 32px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(253, 180, 58, 0.4);
    transition: all 0.3s ease;
    font-family: 'Fredoka', sans-serif;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(253, 180, 58, 0.5);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.5);
    max-width: 800px;
    font-size: 13px;
}

footer a {
    color: var(--hater-red);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.footer-joke {
    font-size: 11px;
    font-style: italic;
    opacity: 0.6;
    margin-top: 4px;
}

.hidden {
    display: none !important;
}

/* Mobile */
@media (max-width: 768px) {
    .game-title { font-size: 36px; }
    .subtitle-villain { font-size: 14px; }
    .instructions { padding: 14px 18px; }
    .instruction-item { font-size: 14px; }
    .game-button { padding: 14px 32px; font-size: 18px; }
    .difficulty-btn { padding: 6px 12px; font-size: 11px; }
    .hater-score-box #score { font-size: 24px; }
    .vibe-bar-container { width: 100px; }
    .game-over-title { font-size: 32px; }
    .final-score div { font-size: 18px; }
    .final-score span { font-size: 26px; }
    #stats-breakdown { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    #game-container { margin: 5px; }
    .game-title { font-size: 28px; }
    .difficulty-selector { flex-direction: column; width: 100%; max-width: 280px; }
    .difficulty-btn { width: 100%; }
}