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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #FAFAFA;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

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

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

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

/* Stats Bar */
#stats-bar, #toss-stats-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    background: white;
    padding: 12px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: #7F8C8D;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2C3E50;
}

.stat.highlight .stat-value {
    color: #27AE60;
}

/* Note Screen */
#note-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

#sticky-note-container {
    perspective: 1000px;
    margin-top: 60px;
}

#sticky-note {
    width: min(320px, 85vw);
    min-height: 200px;
    background: #F9E79F;
    border-radius: 4px;
    padding: 20px;
    position: relative;
    transform: rotate(-2deg);
    box-shadow: 
        0 4px 6px rgba(0,0,0,0.1),
        0 10px 30px rgba(0,0,0,0.08),
        inset 0 -3px 0 rgba(0,0,0,0.05);
    transition: transform 0.3s ease, background 0.3s ease;
}

#sticky-note:hover {
    transform: rotate(-1deg) scale(1.02);
}

#sticky-note::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.03), transparent);
    border-radius: 4px 4px 0 0;
}

#note-input {
    width: 100%;
    min-height: 140px;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Caveat', cursive;
    font-size: 22px;
    color: #2C3E50;
    resize: none;
    line-height: 1.4;
}

#note-input::placeholder {
    color: rgba(44, 62, 80, 0.4);
}

#char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: rgba(44, 62, 80, 0.3);
}

/* Color Picker */
#color-picker {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 3px solid transparent;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: #2C3E50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Toss Button */
#toss-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 32px;
    padding: 16px 40px;
    background: #2C3E50;
    color: white;
    border: none;
    border-radius: 50px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
}

#toss-btn:hover {
    background: #34495E;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
}

#toss-btn:active {
    transform: translateY(0);
}

#toss-btn svg {
    stroke: white;
}

/* Toss Screen */
#toss-screen {
    position: relative;
    width: 100%;
    height: 100%;
}

#instruction-text {
    position: absolute;
    bottom: 220px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    color: #7F8C8D;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

/* Result Overlay */
#result-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 30px 20px 40px;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.1);
    text-align: center;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#result-text {
    font-size: 28px;
    font-weight: 700;
    color: #2C3E50;
    margin-bottom: 20px;
}

#result-text small {
    font-size: 16px;
    font-weight: 400;
    color: #7F8C8D;
}

#new-note-btn {
    padding: 14px 36px;
    background: #27AE60;
    color: white;
    border: none;
    border-radius: 50px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#new-note-btn:hover {
    background: #219A52;
    transform: scale(1.05);
}

/* Footer */
#footer {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #BDC3C7;
    z-index: 5;
}

#footer a {
    color: #95A5A6;
    text-decoration: none;
}

#footer a:hover {
    color: #7F8C8D;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}

/* Mobile adjustments */
@media (max-height: 700px) {
    #sticky-note-container {
        margin-top: 40px;
    }
    
    #sticky-note {
        min-height: 150px;
    }
    
    #note-input {
        min-height: 100px;
        font-size: 20px;
    }
}

@media (max-width: 380px) {
    #stats-bar, #toss-stats-bar {
        gap: 16px;
        padding: 10px 18px;
    }
    
    .stat-value {
        font-size: 20px;
    }
}