/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 80%, #120458 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, #421a6b 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, #1a1a2e 0%, transparent 50%),
        linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    margin: 0;
    font-family: 'Orbitron', 'Segoe UI', monospace;
    overflow: hidden;
    position: relative;
}

/* Animated background particles */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, rgba(255, 224, 102, 0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(102, 255, 178, 0.2), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255, 102, 178, 0.2), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(102, 178, 255, 0.2), transparent);
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: sparkle 20s linear infinite;
    pointer-events: none;
}

@keyframes sparkle {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-200px); }
}

.clock-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    z-index: 1;
    gap: 30px;
}

/* Clock title styling */
.clock-title {
    text-align: center;
    margin-bottom: 10px;
}

.clock-title h1 {
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 2.5rem;
    color: #ffe066;
    margin: 0;
    text-shadow:
        0 0 10px #ffe066,
        0 0 20px #ffe066,
        0 0 30px rgba(255, 224, 102, 0.5);
    letter-spacing: 0.2em;
    animation: titleGlow 3s ease-in-out infinite;
}

.subtitle {
    font-family: 'Orbitron', monospace;
    font-weight: 400;
    font-size: 0.9rem;
    color: rgba(255, 224, 102, 0.7);
    letter-spacing: 0.3em;
    margin-top: 5px;
    text-shadow: 0 0 5px rgba(255, 224, 102, 0.3);
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow:
            0 0 10px #ffe066,
            0 0 20px #ffe066,
            0 0 30px rgba(255, 224, 102, 0.5);
    }
    50% {
        text-shadow:
            0 0 15px #ffe066,
            0 0 30px #ffe066,
            0 0 45px rgba(255, 224, 102, 0.8);
    }
}

.digital-clock {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 40px 50px;
    background:
        linear-gradient(145deg, rgba(26, 26, 46, 0.9), rgba(16, 33, 62, 0.9)),
        rgba(0, 0, 0, 0.4);
    border-radius: 25px;
    border: 2px solid rgba(255, 224, 102, 0.2);
    box-shadow:
        0 0 50px rgba(255, 224, 102, 0.15),
        0 0 100px rgba(255, 224, 102, 0.1),
        inset 0 0 30px rgba(0, 0, 0, 0.6),
        inset 0 2px 10px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    position: relative;
    overflow: hidden;
}

.digital-clock::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        rgba(255, 224, 102, 0.3) 0%,
        rgba(102, 255, 178, 0.3) 25%,
        rgba(255, 102, 178, 0.3) 50%,
        rgba(102, 178, 255, 0.3) 75%,
        rgba(255, 224, 102, 0.3) 100%);
    border-radius: 25px;
    z-index: -1;
    animation: borderGlow 4s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.digit-container {
    position: relative;
    perspective: 1000px;
}

.digit-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(255, 224, 102, 0.1) 0%, transparent 70%);
    border-radius: 15px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.digit-container:hover::before {
    opacity: 1;
}

.digit {
    width: 90px;
    height: 140px;
    position: relative;
    margin: 15px;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.digit:hover {
    transform: rotateY(5deg) rotateX(2deg);
}

/* 7-segment display segments */
.digit .segment {
    position: absolute;
    background: linear-gradient(145deg, #1a1a2e, #2a2a3e);
    border: 1px solid rgba(255, 224, 102, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Horizontal segments */
.digit .segment-a,
.digit .segment-d,
.digit .segment-g {
    width: 70px;
    height: 12px;
    left: 10px;
    clip-path: polygon(15% 0%, 85% 0%, 100% 50%, 85% 100%, 15% 100%, 0% 50%);
}

.digit .segment-a { top: 0; }
.digit .segment-d { bottom: 0; }
.digit .segment-g {
    top: calc(50% - 6px); /* 使用calc代替transform，避免冲突 */
}

/* Vertical segments */
.digit .segment-b,
.digit .segment-c,
.digit .segment-e,
.digit .segment-f {
    width: 12px;
    height: 60px;
    clip-path: polygon(0% 15%, 50% 0%, 100% 15%, 100% 85%, 50% 100%, 0% 85%);
}

.digit .segment-b { top: 8px; right: 0; }
.digit .segment-c { bottom: 8px; right: 0; }
.digit .segment-e { bottom: 8px; left: 0; }
.digit .segment-f { top: 8px; left: 0; }

/* Active segment styling with enhanced effects */
.digit .segment.active {
    background: linear-gradient(145deg, #ffe066, #ffcc00) !important;
    border: 1px solid #ffe066 !important;
    box-shadow:
        0 0 15px #ffe066,
        0 0 30px #ffe066,
        0 0 45px rgba(255, 224, 102, 0.8),
        inset 0 1px 5px rgba(255, 255, 255, 0.3),
        inset 0 -1px 5px rgba(0, 0, 0, 0.3) !important;
    animation: segmentPulse 2s ease-in-out infinite;
}

/* 确保非G段的active状态不会影响位置 */
.digit .segment-a.active,
.digit .segment-b.active,
.digit .segment-c.active,
.digit .segment-d.active,
.digit .segment-e.active,
.digit .segment-f.active {
    animation: segmentPulse 2s ease-in-out infinite;
}

@keyframes segmentPulse {
    0%, 100% {
        filter: brightness(1) saturate(1);
    }
    50% {
        filter: brightness(1.2) saturate(1.3);
    }
}

/* 为G段创建特殊的脉冲动画，保持位置不变 */
.digit .segment-g.active {
    animation: segmentPulseG 2s ease-in-out infinite;
}

@keyframes segmentPulseG {
    0%, 100% {
        filter: brightness(1) saturate(1);
        top: calc(50% - 6px);
    }
    50% {
        filter: brightness(1.2) saturate(1.3);
        top: calc(50% - 6px);
    }
}

/* Enhanced Colon styling */
.colon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 140px;
    gap: 25px;
    position: relative;
}

.colon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 80px;
    background: radial-gradient(ellipse, rgba(255, 224, 102, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
}

.dot {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #ffe066 0%, #ffcc00 70%);
    border-radius: 50%;
    border: 2px solid rgba(255, 224, 102, 0.3);
    box-shadow:
        0 0 15px #ffe066,
        0 0 30px rgba(255, 224, 102, 0.8),
        inset 0 2px 5px rgba(255, 255, 255, 0.3),
        inset 0 -2px 5px rgba(0, 0, 0, 0.3);
    animation: colonBlink 1.5s ease-in-out infinite;
    position: relative;
}

.dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: dotShine 2s ease-in-out infinite;
}

@keyframes colonBlink {
    0%, 45% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1);
    }
    50%, 95% {
        opacity: 0.2;
        transform: scale(0.9);
        filter: brightness(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes dotShine {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    .digital-clock {
        gap: 15px;
        padding: 25px 30px;
        border-radius: 20px;
    }

    .digit {
        width: 70px;
        height: 105px;
        margin: 10px;
    }

    .digit .segment-a,
    .digit .segment-d,
    .digit .segment-g {
        width: 55px;
        height: 9px;
        left: 7.5px;
    }

    .digit .segment-b,
    .digit .segment-c,
    .digit .segment-e,
    .digit .segment-f {
        width: 9px;
        height: 45px;
    }

    .dot {
        width: 12px;
        height: 12px;
    }

    .colon {
        height: 105px;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .digital-clock {
        gap: 10px;
        padding: 20px 25px;
        border-radius: 15px;
    }

    .digit {
        width: 55px;
        height: 85px;
        margin: 8px;
    }

    .digit .segment-a,
    .digit .segment-d,
    .digit .segment-g {
        width: 42px;
        height: 7px;
        left: 6.5px;
    }

    .digit .segment-b,
    .digit .segment-c,
    .digit .segment-e,
    .digit .segment-f {
        width: 7px;
        height: 35px;
    }

    .dot {
        width: 10px;
        height: 10px;
    }

    .colon {
        height: 85px;
        gap: 15px;
    }
}

/* Additional visual enhancements */
.digital-clock:hover {
    transform: scale(1.02);
    box-shadow:
        0 0 60px rgba(255, 224, 102, 0.2),
        0 0 120px rgba(255, 224, 102, 0.15),
        inset 0 0 30px rgba(0, 0, 0, 0.6),
        inset 0 2px 10px rgba(255, 255, 255, 0.15);
}

/* Smooth transitions for all interactive elements */
.digital-clock,
.digit,
.digit-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading animation for initial display */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.digital-clock {
    animation: fadeInUp 1s ease-out;
}

.digit-container:nth-child(1) { animation-delay: 0.1s; }
.digit-container:nth-child(2) { animation-delay: 0.2s; }
.digit-container:nth-child(3) { animation-delay: 0.3s; }
.digit-container:nth-child(4) { animation-delay: 0.4s; }
.digit-container:nth-child(5) { animation-delay: 0.5s; }
.digit-container:nth-child(6) { animation-delay: 0.6s; }
.digit-container:nth-child(7) { animation-delay: 0.7s; }
.digit-container:nth-child(8) { animation-delay: 0.8s; }

/* Clock info styling */
.clock-info {
    display: flex;
    gap: 40px;
    margin-top: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.label {
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    color: rgba(255, 224, 102, 0.6);
    letter-spacing: 0.2em;
    font-weight: 400;
}

.value {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: #ffe066;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(255, 224, 102, 0.5);
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .clock-title h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .clock-info {
        gap: 30px;
        margin-top: 15px;
    }

    .label {
        font-size: 0.6rem;
    }

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

@media (max-width: 480px) {
    .clock-title h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.7rem;
    }

    .clock-info {
        gap: 20px;
        margin-top: 10px;
    }

    .label {
        font-size: 0.55rem;
    }

    .value {
        font-size: 0.7rem;
    }

    .clock-container {
        gap: 20px;
    }
}