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

body {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    font-family: 'Oswald', 'Do Hyeon', sans-serif;
}

.clock-container {
    display: flex;
    gap: 5vw;
    align-items: center;
}

.flip-card {
    width: clamp(280px, 40vw, 768px);
    aspect-ratio: 1 / 1.05;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border-radius: clamp(24px, 4vw, 48px);
    box-shadow:
        0 clamp(6px, 1vw, 16px) clamp(20px, 3vw, 48px) rgba(0,0,0,0.6),
        0 clamp(2px, 0.3vw, 4px) clamp(6px, 0.8vw, 12px) rgba(0,0,0,0.4),
        inset 0 clamp(1px, 0.15vw, 2px) 0 rgba(255,255,255,0.04);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.flip-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3%;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.08) 0%,
        rgba(255,255,255,0.02) 50%,
        transparent 100%);
    pointer-events: none;
    z-index: 10;
}

/* Horizontal divider in card */
.flip-card::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1px;
    background: #000;
    box-shadow: 0 1px 0 #2a2a2a;
    z-index: 9;
    pointer-events: none;
}

/* Digit row */
.digit-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(2px, 0.3vw, 6px);
    z-index: 2;
}

/* Single digit */
.digit {
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: clamp(180px, 31.2vw, 600px);
    line-height: 1;
    color: #ccc;
    text-shadow:
        0 0 clamp(6px, 1vw, 14px) rgba(204,204,204,0.25),
        0 0 clamp(2px, 0.3vw, 4px) rgba(204,204,204,0.12);
}

/* AM/PM */
.am-pm {
    position: absolute;
    bottom: clamp(24px, 3.5vw, 52px);
    left: clamp(24px, 3.5vw, 52px);
    font-family: 'Do Hyeon', 'Oswald', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 2.4vw, 44px);
    color: rgba(204,204,204,0.5);
    letter-spacing: 0.06em;
    z-index: 3;
    line-height: 1;
}

/* Fullscreen button */
#fullscreen-btn {
    position: fixed;
    bottom: clamp(14px, 2vw, 24px);
    right: clamp(14px, 2vw, 24px);
    width: clamp(32px, 3vw, 44px);
    height: clamp(32px, 3vw, 44px);
    border: none;
    border-radius: clamp(6px, 0.8vw, 10px);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.3);
    font-size: clamp(16px, 1.6vw, 22px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    z-index: 100;
    line-height: 1;
}

#fullscreen-btn:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.6);
}

/* Fake fullscreen fallback for iOS Safari */
body.fake-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    z-index: 9999;
    background: #000;
}

/* ===== Tablet / Narrow Landscape — larger cards to match Mac visual density ===== */
@media (orientation: landscape) and (max-aspect-ratio: 16/10) and (min-width: 769px) {
    .clock-container {
        gap: 5.5vw;
    }
    .flip-card {
        width: clamp(308px, 44vw, 768px);
    }
    .digit {
        font-size: clamp(198px, 34.3vw, 600px);
    }
    .am-pm {
        font-size: clamp(16px, 2.6vw, 44px);
        bottom: clamp(26px, 3.9vw, 52px);
        left: clamp(26px, 3.9vw, 52px);
    }
}

/* ===== Mobile Portrait ===== */
@media (orientation: portrait) and (max-width: 768px) {
    .clock-container {
        flex-direction: column;
        gap: 3vh;
    }

    #fullscreen-btn {
        bottom: clamp(10px, 2vw, 16px);
        right: clamp(10px, 2vw, 16px);
        width: clamp(36px, 10vw, 48px);
        height: clamp(36px, 10vw, 48px);
        font-size: clamp(18px, 4.5vw, 26px);
        border-radius: clamp(8px, 2vw, 12px);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    body.fake-fullscreen #fullscreen-btn {
        bottom: clamp(4px, 1vw, 8px);
        right: clamp(4px, 1vw, 8px);
        width: clamp(28px, 7vw, 36px);
        height: clamp(28px, 7vw, 36px);
        font-size: clamp(14px, 3vw, 18px);
        opacity: 0.25;
    }
    body.fake-fullscreen #fullscreen-btn:active {
        opacity: 0.6;
    }
}