:root {
    --bg-color: #050505;
    --text-color: #e2e8f0;
    --accent-color: #00f3ff;
    --accent-secondary: #bc13fe;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-main: 'Outfit', sans-serif;
    --font-mono: 'Space Mono', monospace;
    --neon-glow: 0 0 10px rgba(0, 243, 255, 0.5), 0 0 20px rgba(0, 243, 255, 0.3);
}

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

[hidden] {
    display: none !important;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animations */
#bg-canvas,
#fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#bg-canvas {
    z-index: -2;
    /* Behind blobs */
}

#fireworks-canvas {
    z-index: 100;
    /* Topmost */
}

.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at center, #0b0b15 0%, #000000 100%);
    /* Darker, deeper background */
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    perspective: 500px;
    transform-style: preserve-3d;
    animation: grid-move 20s linear infinite;
    opacity: 0.5;
}

@keyframes grid-move {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(40px);
    }
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: float 15s infinite ease-in-out;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    top: -150px;
    left: -150px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-color);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #4f46e5;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -8s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(40px, -40px);
    }
}

/* Main Container */
.container {
    text-align: center;
    width: 90%;
    max-width: 900px;
    padding: 3rem;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.5;
}

header {
    margin-bottom: 3.5rem;
    transition: opacity 0.5s ease;
}

header[hidden] {
    display: none;
    opacity: 0;
}

h1 {
    font-size: 4.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    position: relative;
    display: inline-block;
    text-transform: uppercase;
}

/* Glitch Effect */
h1::before,
h1::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

h1::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

h1::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(30px, 9999px, 10px, 0);
    }

    5% {
        clip: rect(80px, 9999px, 90px, 0);
    }

    10% {
        clip: rect(10px, 9999px, 40px, 0);
    }

    15% {
        clip: rect(50px, 9999px, 20px, 0);
    }

    20% {
        clip: rect(10px, 9999px, 80px, 0);
    }

    25% {
        clip: rect(90px, 9999px, 30px, 0);
    }

    30% {
        clip: rect(60px, 9999px, 10px, 0);
    }

    35% {
        clip: rect(20px, 9999px, 70px, 0);
    }

    40% {
        clip: rect(50px, 9999px, 90px, 0);
    }

    45% {
        clip: rect(10px, 9999px, 30px, 0);
    }

    50% {
        clip: rect(80px, 9999px, 10px, 0);
    }

    55% {
        clip: rect(30px, 9999px, 50px, 0);
    }

    60% {
        clip: rect(70px, 9999px, 20px, 0);
    }

    65% {
        clip: rect(10px, 9999px, 60px, 0);
    }

    70% {
        clip: rect(90px, 9999px, 40px, 0);
    }

    75% {
        clip: rect(40px, 9999px, 80px, 0);
    }

    80% {
        clip: rect(20px, 9999px, 10px, 0);
    }

    85% {
        clip: rect(60px, 9999px, 30px, 0);
    }

    90% {
        clip: rect(10px, 9999px, 50px, 0);
    }

    95% {
        clip: rect(80px, 9999px, 20px, 0);
    }

    100% {
        clip: rect(30px, 9999px, 70px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(10px, 9999px, 80px, 0);
    }

    100% {
        clip: rect(90px, 9999px, 10px, 0);
    }
}

/* Settings Button */
.settings-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    top: auto;
    /* Reset top */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--accent-color);
    padding: 1rem;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    opacity: 0.3;
    /* Subtle by default */
}

.settings-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-color);
    transform: rotate(90deg) scale(1.1);
    opacity: 1;
}

.subtitle {
    color: #64748b;
    font-size: 1rem;
    font-weight: 300;
    font-family: var(--font-mono);
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.5s forwards;
    letter-spacing: 0.1em;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    z-index: 3000;
    /* Increased to be above message overlay (2000) */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-panel:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
}

.settings-content {
    background: rgba(15, 15, 20, 0.9);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.1);
    max-height: 90vh;
    overflow-y: auto;
}

.settings-content h2 {
    font-family: var(--font-mono);
    color: white;
    margin-bottom: 1rem;
    text-align: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.close-btn {
    background: var(--accent-color);
    color: black;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.close-btn:hover {
    background: white;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Input Styles Update */
input[type="text"],
input[type="datetime-local"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 1rem;
    outline: none;
    width: 100%;
}

input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

/* Input Section */
.input-section {
    margin-bottom: 3.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-color);
    font-family: var(--font-mono);
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.3);
}

input[type="datetime-local"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 1.2rem 2rem;
    border-radius: 16px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
    color-scheme: dark;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 350px;
    text-align: center;
}

input[type="datetime-local"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2), inset 0 2px 10px rgba(0, 0, 0, 0.5);
    transform: scale(1.02);
}

/* Counter Grid */
.counter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(1rem, 3vw, 3rem);
    margin-top: 0;
    align-items: baseline;
    max-width: 100%;
}

.time-unit {
    background: transparent;
    border: none;
    padding: 0;
    min-width: auto;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    /* overflow: hidden; Removed to prevent cropping */
}

.time-unit::after {
    display: none;
    /* Remove hover glow bg */
}

.time-unit:hover {
    transform: scale(1.05);
    box-shadow: none;
    border-color: transparent;
}

.time-unit:hover::after {
    opacity: 1;
}

.value {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 8vw, 8rem);
    /* Responsive with min and max */
    font-weight: 300;
    line-height: 1.2;
    margin-bottom: 0;
    color: white;
    text-shadow: 0 0 40px rgba(0, 243, 255, 0.15);
    letter-spacing: -0.05em;
    padding: 0.5rem;
}

.label {
    font-size: clamp(0.7rem, 1vw, 1.2rem);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--accent-color);
    font-family: var(--font-mono);
    opacity: 0.5;
    margin-top: 0.5rem;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.container:hover .label {
    opacity: 0.8;
}

.message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    /* Nearly opaque black background for entire screen */
    z-index: 2000;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3rem;

    padding: 2rem;
    pointer-events: auto;

    /* Remove borders/shadows from container, apply to content wrapper if needed */
    box-shadow: none;
    border: none;
    border-radius: 0;
}

/* Optional: Wrapper for content if we want a box look inside the overlay */
.message-content {
    padding: 3rem;
    border: 2px solid var(--accent-color);
    border-radius: 20px;
    background: black;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    width: 90%;
    max-width: 800px;
    min-width: 300px;
    /* Ensure minimum width */
    flex-shrink: 0;
    /* Prevent shrinking */
}

.new-countdown-btn {
    padding: 1rem 2rem;
    background: var(--accent-color);
    color: black;
    border: none;
    border-radius: 50px;
    font-family: var(--font-mono);
    font-weight: bold;
    cursor: pointer;
    pointer-events: auto;
    /* Enable clicks */
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
    transition: all 0.3s ease;
    /* Removed opacity: 0 and animation to ensure visibility */
    z-index: 2001;
    margin-top: 1rem;
}

.new-countdown-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.8);
    background: white;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Responsive */

/* Large Desktop / Fullscreen */
@media (min-width: 1920px) {
    .counter-container {
        gap: 4rem;
    }

    .time-unit {
        min-width: 150px;
    }
}

/* Desktop / Laptop */
@media (min-width: 1024px) and (max-width: 1919px) {
    .counter-container {
        gap: 2rem;
    }
}

/* Tablet */
@media (max-width: 1023px) {
    .value {
        font-size: clamp(2.5rem, 10vw, 6rem);
    }

    .counter-container {
        gap: 1.5rem;
    }

    h1 {
        font-size: 3rem;
    }
}

/* Mobile Landscape & Small Tablets */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 1.5rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .counter-container {
        gap: 1rem;
    }

    .time-unit {
        flex: 1 1 calc(33.333% - 1rem);
        min-width: 80px;
    }

    .value {
        font-size: clamp(2rem, 12vw, 5rem);
    }

    .label {
        font-size: 0.7rem;
        letter-spacing: 0.2em;
    }

    .settings-content {
        padding: 1.5rem;
        width: 95%;
    }

    .message {
        font-size: 8vw;
        padding: 1.5rem;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .container {
        overflow: visible;
        /* Allow content to spill out if needed */
        height: auto;
        min-height: auto;
    }

    .counter-container {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .time-unit {
        flex: 0 0 45%;
        /* Force 2 per row */
        min-width: auto;
        width: auto;
        /* Reset width */
        margin-bottom: 1rem;
    }

    .value {
        font-size: clamp(1.5rem, 15vw, 4rem);
        padding: 0.25rem;
    }

    .label {
        font-size: 0.6rem;
        margin-top: 0.25rem;
    }

    .settings-btn {
        bottom: 1rem;
        right: 1rem;
        padding: 0.75rem;
    }

    input[type="datetime-local"],
    input[type="text"] {
        font-size: 16px;
        /* Prevent zoom on iOS */
        padding: 0.875rem;
    }

    .settings-content {
        padding: 1rem;
    }

    .message {
        font-size: 10vw;
        padding: 1rem;
    }
}

/* Very Small Screens */
@media (max-width: 360px) {
    .value {
        font-size: clamp(1.2rem, 18vw, 3rem);
    }

    .label {
        font-size: 0.5rem;
    }
}