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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.swipe-guard {
    position: fixed;
    top: 0; left: 0;
    width: 30px;
    height: 100%;
    z-index: 9999;
}

body {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4, #ffecd2);
    transition: background 0.8s ease;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(5px);
    z-index: 100;
}

.back-btn, .fullscreen-btn {
    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    min-width: 48px;
    min-height: 48px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

h1 {
    font-size: 24px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    text-align: center;
    flex: 1;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    position: relative;
}

.count-display {
    flex-shrink: 0;
}

#count-number {
    font-size: 120px;
    font-weight: 900;
    color: #fff;
    text-shadow: 4px 4px 0 rgba(0,0,0,0.15), 0 0 30px rgba(255,255,255,0.5);
    line-height: 1;
    transition: transform 0.15s ease;
}

#count-number.bump {
    transform: scale(1.3);
}

.objects-area {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 10px;
    max-width: 500px;
    align-content: center;
}

.countable {
    font-size: 64px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: transform 0.1s ease, opacity 0.3s ease;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
}

.countable:active {
    transform: scale(0.85);
}

.countable.counted {
    opacity: 0;
    transform: scale(2);
    pointer-events: none;
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.count-bubble {
    position: fixed;
    font-size: 48px;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 200;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-80px) scale(1.5); opacity: 0; }
}

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

.confetti-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    animation: confettiFall 2s ease-in forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.celebration-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    color: #fff;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.2);
    z-index: 301;
    animation: celebPop 2s ease-out forwards;
    text-align: center;
}

@keyframes celebPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    60% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}