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

:root {
    --primary: #A855F7;
    --secondary: #4ECDC4;
    --accent: #FFE66D;
    --danger: #FF6B6B;
    --success: #10B981;
    --bg-light: #FAF5FF;
    --bg-dark: #0F0F1A;
    --text-light: #1F1F3D;
    --text-dark: #E5E5FF;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    min-height: 100vh;
    transition: all 0.3s ease;
}

body.dark-mode {
    background: var(--bg-dark);
    color: var(--text-dark);
}

.app-container {
    min-height: 100vh;
    padding: 1rem;
    transition: background 0.5s ease;
    position: relative;
    overflow: hidden;
}

.app-container.light {
    background: linear-gradient(
        135deg,
        hsl(calc(var(--bg-hue, 260)), 70%, 95%) 0%,
        hsl(calc(var(--bg-hue, 260) + 40), 60%, 90%) 100%
    );
    color: var(--text-light);
}

.app-container.dark {
    background: linear-gradient(
        135deg,
        hsl(calc(var(--bg-hue, 260)), 50%, 8%) 0%,
        hsl(calc(var(--bg-hue, 260) + 40), 40%, 12%) 100%
    );
    color: var(--text-dark);
}

.header {
    text-align: center;
    padding: 2rem 1rem;
    position: relative;
}

.title {
    font-family: 'Bangers', cursive;
    font-size: clamp(4rem, 15vw, 8rem);
    letter-spacing: 0.1em;
    display: flex;
    justify-content: center;
    gap: 0.2em;
}

.letter-a {
    color: #FF6B6B;
    transform: rotate(-8deg);
    display: inline-block;
    animation: wobble 2s ease-in-out infinite;
}

.letter-s {
    color: #4ECDC4;
    transform: rotate(5deg);
    display: inline-block;
    animation: wobble 2s ease-in-out infinite 0.2s;
}

.letter-d {
    color: #FFE66D;
    transform: rotate(-3deg);
    display: inline-block;
    animation: wobble 2s ease-in-out infinite 0.4s;
}

.letter-f {
    color: #A855F7;
    transform: rotate(7deg);
    display: inline-block;
    animation: wobble 2s ease-in-out infinite 0.6s;
}

@keyframes wobble {
    0%, 100% { transform: rotate(var(--rotation, 0deg)) scale(1); }
    50% { transform: rotate(calc(var(--rotation, 0deg) * -1)) scale(1.1); }
}

.letter-a { --rotation: -8deg; }
.letter-s { --rotation: 5deg; }
.letter-d { --rotation: -3deg; }
.letter-f { --rotation: 7deg; }

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-top: 0.5rem;
    font-style: italic;
}

.controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 1.3rem;
    transition: transform 0.2s, background 0.2s;
}

.control-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.prompt-banner {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(90deg, #A855F7, #EC4899);
    border-radius: 50px;
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: white;
    animation: slideIn 0.5s ease-out;
}

.prompt-icon {
    margin-right: 0.5rem;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.mash-zone-container {
    position: relative;
    margin-bottom: 1rem;
}

.mash-zone {
    width: 100%;
    min-height: 200px;
    padding: 1.5rem;
    font-size: 1.5rem;
    font-family: 'Space Grotesk', sans-serif;
    border: 4px dashed rgba(168, 85, 247, 0.5);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    resize: none;
    outline: none;
    color: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    animation: pulse-border 2s ease-in-out infinite;
}

.mash-zone::placeholder {
    color: inherit;
    opacity: 0.5;
}

.mash-zone:focus {
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(168, 85, 247, 0.3); }
    50% { border-color: rgba(168, 85, 247, 0.7); }
}

.dancing-keyboard {
    position: absolute;
    bottom: -30px;
    right: 20px;
    font-size: 3rem;
    transition: transform 0.1s;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.clear-btn, .share-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Space Grotesk', sans-serif;
}

.clear-btn {
    background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
    color: white;
}

.share-btn {
    background: linear-gradient(135deg, #4ECDC4, #7EDDCA);
    color: white;
}

.clear-btn:hover, .share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    text-align: center;
    border: 2px solid;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.3rem;
}

.speed-graph {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.graph-bars {
    display: flex;
    align-items: flex-end;
    height: 80px;
    gap: 4px;
}

.graph-bar {
    flex: 1;
    background: linear-gradient(to top, #A855F7, #EC4899);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.2s;
}

.graph-label {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    opacity: 0.7;
}

.lifetime-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.lifetime-stat {
    text-align: center;
}

.lifetime-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 0.3rem;
}

.lifetime-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFE66D, #FF6B6B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.achievements-section {
    margin-bottom: 2rem;
}

.section-title {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.achievement-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    transition: transform 0.2s, opacity 0.2s;
}

.achievement-badge.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.achievement-badge.unlocked {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(236, 72, 153, 0.3));
    border: 2px solid rgba(168, 85, 247, 0.5);
}

.achievement-badge:hover {
    transform: scale(1.02);
}

.achievement-icon {
    font-size: 2.5rem;
}

.achievement-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.achievement-desc {
    font-size: 0.85rem;
    opacity: 0.8;
}

.floating-letter {
    position: fixed;
    font-size: 2rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 100;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: popIn 0.2s ease-out;
}

@keyframes popIn {
    from { transform: scale(0) translateY(0); }
    to { transform: scale(1) translateY(0); }
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.achievement-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    animation: slideDown 0.5s ease-out;
}

.achievement-popup-content {
    background: linear-gradient(135deg, #FFE66D, #FF6B6B);
    color: #1F1F3D;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.achievement-popup-icon {
    font-size: 1.5rem;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-50px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.footer {
    text-align: center;
    padding: 2rem 1rem;
    opacity: 0.8;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

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

@media (max-width: 600px) {
    .title {
        font-size: 3.5rem;
    }
    
    .controls {
        position: relative;
        top: 0;
        right: 0;
        justify-content: center;
        margin-bottom: 1rem;
    }
    
    .mash-zone {
        min-height: 150px;
        font-size: 1.2rem;
    }
    
    .dancing-keyboard {
        font-size: 2rem;
        bottom: -20px;
        right: 10px;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
}