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

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0a0a;
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height for mobile */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 10px;
    /* Prevent edge cutoff */
}

.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    z-index: -1;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }

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

h1 {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    color: #00ffff;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    }

    to {
        text-shadow: 0 0 30px rgba(0, 255, 255, 0.8), 0 0 40px rgba(0, 255, 255, 0.6);
    }
}

.clock-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    /* Prevent excessive width on large screens */
    margin: 0 auto;
}

.clock-container {
    background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
    border: 2px solid #333;
    border-radius: 20px;
    padding: 50px 60px;
    box-shadow:
        0 0 50px rgba(0, 255, 255, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    /* Prevent excessive width */
}

.clock-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.1), transparent);
    animation: scan 4s linear infinite;
}

@keyframes scan {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

#clock {
    font-size: 5rem;
    font-weight: 300;
    color: #ffffff;
    text-align: center;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#clock::-webkit-scrollbar {
    display: none;
}

.digit {
    display: inline-block;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 0 8px;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.digit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ffff, transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.digit:hover::before {
    transform: translateX(100%);
}

.digit:hover {
    box-shadow:
        0 15px 25px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 255, 255, 0.3);
    border-color: #00ffff;
}

.separator {
    color: #00ffff;
    font-size: 4rem;
    margin: 0 15px;
    animation: pulse 2s infinite;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

.info-panel {
    display: flex;
    gap: 40px;
    align-items: center;
    width: 100%;
    max-width: 600px;
    justify-content: center;
    flex-wrap: wrap;
    /* Allow wrapping on smaller screens */
}

.date-section,
.timezone-section {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid #333;
    border-radius: 15px;
    padding: 20px 30px;
    text-align: center;
    backdrop-filter: blur(10px);
    flex: 1;
    min-width: 150px;
    /* Minimum width for readability */
    max-width: 250px;
    /* Maximum width to prevent stretching */
}

.date-section {
    color: #ffffff;
}

.date-label,
.timezone-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
    margin-bottom: 8px;
}

.date-value {
    font-size: 1.3rem;
    font-weight: 500;
    color: #ffffff;
}

.timezone-section {
    color: #00ffff;
}

.timezone-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.accent-line {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ffff, transparent);
    animation: lineGlow 3s ease-in-out infinite;
}

@keyframes lineGlow {

    0%,
    100% {
        width: 60px;
        opacity: 0.6;
    }

    50% {
        width: 100px;
        opacity: 1;
    }
}

/* Tablet Landscape (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    h1 {
        font-size: 2.5rem;
        letter-spacing: 6px;
    }

    .clock-container {
        padding: 40px 50px;
    }

    #clock {
        font-size: 4rem;
    }

    .digit {
        padding: 12px 18px;
        margin: 0 6px;
    }

    .separator {
        font-size: 3.5rem;
        margin: 0 12px;
    }

    .info-panel {
        gap: 30px;
    }

    .date-section,
    .timezone-section {
        padding: 18px 25px;
    }
}

/* Tablet Portrait (600px to 767px) */
@media (min-width: 600px) and (max-width: 767px) {
    h1 {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }

    .clock-container {
        padding: 35px 40px;
    }

    #clock {
        font-size: 3.5rem;
    }

    .digit {
        padding: 10px 15px;
        margin: 0 5px;
    }

    .separator {
        font-size: 3rem;
        margin: 0 10px;
    }

    .info-panel {
        flex-direction: column;
        gap: 20px;
    }

    .date-section,
    .timezone-section {
        padding: 15px 25px;
    }
}

/* Mobile Landscape (480px to 599px) */
@media (min-width: 480px) and (max-width: 599px) {
    h1 {
        font-size: 1.8rem;
        letter-spacing: 3px;
        top: 10%;
    }

    .clock-container {
        padding: 20px 15px;
    }

    #clock {
        font-size: 2.2rem;
    }

    .digit {
        padding: 6px 8px;
        margin: 0 2px;
        font-size: 2.2rem;
    }

    .separator {
        font-size: 2rem;
        margin: 0 4px;
    }

    .info-panel {
        flex-direction: column;
        gap: 15px;
    }

    .date-section,
    .timezone-section {
        padding: 12px 20px;
    }

    .date-value {
        font-size: 1.1rem;
    }

    .timezone-value {
        font-size: 1rem;
    }
}

/* Mobile Portrait (320px to 479px) */
@media (min-width: 320px) and (max-width: 479px) {
    h1 {
        font-size: 1.4rem;
        letter-spacing: 2px;
        top: 8%;
    }

    .clock-container {
        padding: 15px 10px;
    }

    #clock {
        font-size: 1.8rem;
    }

    .digit {
        padding: 4px 6px;
        margin: 0 1px;
        font-size: 1.8rem;
    }

    .separator {
        font-size: 1.6rem;
        margin: 0 3px;
    }

    .info-panel {
        flex-direction: column;
        gap: 12px;
    }

    .date-section,
    .timezone-section {
        padding: 10px 15px;
    }

    .date-value {
        font-size: 1rem;
    }

    .timezone-value {
        font-size: 0.9rem;
    }

    .date-label,
    .timezone-label {
        font-size: 0.7rem;
    }

    .grid-background {
        background-size: 30px 30px;
    }
}

/* Extra Small Mobile (below 320px) */
@media (max-width: 319px) {
    h1 {
        font-size: 1.2rem;
        letter-spacing: 1px;
        top: 6%;
    }

    .clock-container {
        padding: 10px 8px;
    }

    #clock {
        font-size: 1.4rem;
    }

    .digit {
        padding: 3px 4px;
        margin: 0 1px;
        font-size: 1.4rem;
    }

    .separator {
        font-size: 1.2rem;
        margin: 0 2px;
    }

    .info-panel {
        flex-direction: column;
        gap: 10px;
    }

    .date-section,
    .timezone-section {
        padding: 8px 12px;
    }

    .date-value {
        font-size: 0.9rem;
    }

    .timezone-value {
        font-size: 0.8rem;
    }

    .date-label,
    .timezone-label {
        font-size: 0.6rem;
    }

    .grid-background {
        background-size: 25px 25px;
    }
}