:root {
    --primary-color: #6d28d9;
    --secondary-color: #8b5cf6;
    --accent-color: #f43f5e;
    --bg-dark: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden; /* Only hide horizontal overflow */
    position: relative;
    touch-action: manipulation; /* Disable double-tap zoom on iOS */
    -webkit-user-select: none; /* Disable text selection */
    user-select: none;
}

/* Dynamic Animated Background */
.background-animation {
    position: fixed; /* Fixed so it doesn't break scrolling */
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(109, 40, 217, 0.2), transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(244, 63, 94, 0.15), transparent 50%);
    animation: rotate 20s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Main Container - Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.8s ease-out forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #c4b5fd, #fecdd3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

/* Counter Display */
.counter-section {
    margin-bottom: 3rem;
}

.counter-wrapper {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

@keyframes pop-anim {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.counter-wrapper.pop {
    animation: pop-anim 0.2s ease-out;
}

.counter-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Interaction Area */
.interaction-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.input-group {
    position: relative;
    width: 100%;
    max-width: 300px;
}

input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 8px;
    padding: 1rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: background 0.3s ease;
    text-align: center;
    user-select: auto; /* Re-enable selection for input */
    -webkit-user-select: auto;
}

input[type="text"]:focus {
    background: rgba(0, 0, 0, 0.4);
}

.input-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease, left 0.3s ease;
}

input[type="text"]:focus ~ .input-line {
    width: 100%;
    left: 0;
}

/* Premium Button */
.glow-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px -10px var(--accent-color);
    touch-action: manipulation; /* Extra safety for button double-tap */
    -webkit-tap-highlight-color: transparent; /* Remove mobile tap highlight */
}

.glow-button::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.glow-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -10px var(--accent-color), 0 0 20px rgba(109, 40, 217, 0.6);
}

.glow-button:hover::before {
    left: 100%;
}

.glow-button:active {
    transform: translateY(2px);
    box-shadow: 0 5px 10px -5px var(--accent-color);
}

.milestone-hint {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#next-milestone {
    color: var(--secondary-color);
    font-weight: bold;
}

/* Notifications */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border-left: 4px solid var(--accent-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, 
               fadeOut 0.4s ease forwards 4.6s; /* 5s total lifespan */
    opacity: 0;
    transform: translateX(100%);
}

@keyframes slideIn {
    to { opacity: 1; transform: translateX(0); }
}

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

.toast-icon {
    font-size: 1.5rem;
}

.toast-content strong {
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Click ripples */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-anim 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}
