:root {
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e1b4b;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --primary-color: #ec4899;
    --primary-hover: #f472b6;
    --secondary-color: #3b82f6;
    --font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Dynamic animated background blobs for premium aesthetic */
body::before, body::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    animation: float 12s infinite alternate ease-in-out;
}

body::before {
    background: rgba(236, 72, 153, 0.25);
    top: 10%;
    left: 15%;
}

body::after {
    background: rgba(59, 130, 246, 0.2);
    bottom: 10%;
    right: 15%;
    animation-delay: -6s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-40px) scale(1.1); }
}

.timer-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3rem 4rem;
    text-align: center;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    width: 100%;
    max-width: 480px;
}

.timer-container:hover {
    transform: translateY(-5px);
}

.timer-container.running {
    box-shadow: 0 0 50px rgba(236, 72, 153, 0.3);
    border-color: rgba(236, 72, 153, 0.3);
}

.title {
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 6px;
    color: var(--text-secondary);
}

.timer-display {
    font-size: 7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 4px 16px rgba(0,0,0,0.2);
    line-height: 1;
}

.colon {
    margin: 0 0.5rem;
    animation: blink 1s step-start infinite;
    transform: translateY(-5px);
}

.timer-container:not(.running) .colon {
    animation: none;
    opacity: 1;
}

@keyframes blink {
    50% { opacity: 0; }
}

.custom-time {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-time label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

#custom-minutes {
    width: 60px;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 800;
    text-align: center;
    font-family: inherit;
    outline: none;
    padding: 0.25rem;
    transition: border-color 0.3s ease;
}

#custom-minutes:focus {
    border-bottom-color: var(--secondary-color);
}

/* Hide arrows in input[type="number"] */
#custom-minutes::-webkit-outer-spin-button,
#custom-minutes::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#custom-minutes[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.controls {
    display: flex;
    gap: 1.5rem;
    width: 100%;
}

.btn {
    flex: 1;
    padding: 1.25rem 2rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    outline: none;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(236, 72, 153, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(236, 72, 153, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary:active {
    transform: translateY(0);
}

@media (max-width: 500px) {
    .timer-container {
        padding: 2.5rem 2rem;
        width: 90%;
    }
    .timer-display {
        font-size: 5rem;
    }
    .controls {
        flex-direction: column;
    }
    .btn {
        width: 100%;
    }
}
