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

body {
    background-color: #000000;
    /*background-image: 
        radial-gradient(circle at 50% 50%, rgba(20, 20, 20, 1) 0%, rgba(0, 0, 0, 1) 100%);*/
    color: #f1f1f1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    perspective: 2000px;
}

.clock-wrapper {
    transform: rotateX(0deg); /* Removed the tilt that might be obscuring the bottom */
    transform-style: preserve-3d;
}

.time-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    position: relative;
    transform-style: preserve-3d;
}

.time-group {
    display: flex;
    gap: 0.8rem;
    transform-style: preserve-3d;
}

.colon {
    font-size: 5rem;
    color: #333;
    font-weight: 600;
    margin-top: -1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}

.colon::before, .colon::after {
    content: "";
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #444 0%, #111 100%);
    border-radius: 50%;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.8),
        inset 0 1px 2px rgba(255,255,255,0.1);
}

.ampm-box {
    position: absolute;
    right: -6rem;
    bottom: 1rem;
    font-size: 2rem;
    font-weight: 700;
    color: #444;
    letter-spacing: 3px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* FLIP CARD STYLES */
.flip-card {
    position: relative;
    width: 120px;
    height: 180px;
    background-color: #050505;
    border-radius: 12px;
    perspective: 1500px;
    transform-style: preserve-3d;
    box-shadow: 
        0 30px 60px rgba(0,0,0,0.9), 
        0 10px 20px rgba(0,0,0,0.7),
        inset 0 1px 1px rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.05);
}

.flip-card::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #000;
    transform: translateY(-50%) translateZ(10px);
    z-index: 100;
}

.top, .bottom, .flip-top, .flip-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background-color: #080808;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

.top, .flip-top {
    top: 0;
    border-radius: 12px 12px 0 0;
    transform-origin: bottom;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    z-index: 2;
    border-bottom: 0.5px solid rgba(0,0,0,0.5);
}

.bottom, .flip-bottom {
    top: 50%;
    height: 50%;
    border-radius: 0 0 12px 12px;
    transform-origin: top;
    background: linear-gradient(135deg, #050505 0%, #151515 100%);
    z-index: 1;
    display: block;
    border-top: 0.5px solid rgba(255,255,255,0.05);
}

.digit {
    position: absolute;
    left: 0;
    width: 100%;
    height: 180px;
    line-height: 180px;
    text-align: center;
    font-size: 140px;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 
        0 1px 0 #ccc,
        0 2px 0 #c9c9c9,
        0 3px 0 #bbb,
        0 4px 0 #b9b9b9,
        0 5px 0 #aaa,
        0 6px 1px rgba(0,0,0,.1),
        0 0 5px rgba(0,0,0,.1),
        0 1px 3px rgba(0,0,0,.3),
        0 3px 5px rgba(0,0,0,.2),
        0 5px 10px rgba(0,0,0,.25),
        0 10px 10px rgba(0,0,0,.2),
        0 20px 20px rgba(0,0,0,.15);
    letter-spacing: -4px;
    font-variant-numeric: tabular-nums;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.top .digit, .flip-top .digit {
    top: 0;
}

.bottom .digit, .flip-bottom .digit {
    bottom: 0;
}

.flip-top {
    animation: flipTop 0.4s ease-in forwards;
    z-index: 10;
    transform-origin: bottom;
}

.flip-bottom {
    transform: rotateX(90deg);
    animation: flipBottom 0.4s ease-out 0.4s forwards;
    z-index: 10;
    transform-origin: top;
}

@keyframes flipTop {
    0% {
        transform: rotateX(0deg);
        filter: brightness(1);
    }
    100% {
        transform: rotateX(-90deg);
        filter: brightness(0.2);
    }
}

@keyframes flipBottom {
    0% {
        transform: rotateX(90deg);
        filter: brightness(0.2);
    }
    100% {
        transform: rotateX(0deg);
        filter: brightness(1);
    }
}

.date-row {
    font-size: 1.8rem;
    letter-spacing: 8px;
    color: #333;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    background: linear-gradient(to bottom, #444, #111);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Install Modal */
.install-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.install-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.install-content {
    background: #0d0d0d;
    border: 1px solid #222;
    padding: 2.5rem;
    border-radius: 16px;
    text-align: center;
    max-width: 90%;
    width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.9);
}

.install-content h3 {
    margin-bottom: 1rem;
    font-size: 1.6rem;
    letter-spacing: 1px;
    color: #fff;
}

.install-content p {
    color: #888;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.install-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.8rem 1.8rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.btn-cancel {
    background: transparent;
    color: #888;
    border: 1px solid #333;
}

.btn-cancel:hover {
    background: #1a1a1a;
    color: #fff;
    border-color: #555;
}

.btn-install {
    background: #f1f1f1;
    color: #000;
}

.btn-install:hover {
    background: #fff;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

@media (max-width: 900px) {
    .clock-container {
        transform: scale(0.8);
    }
}

@media (max-width: 600px) {
    .clock-container {
        transform: scale(0.6);
    }
    .ampm-box {
        right: -4rem;
        bottom: 0;
    }
}
