@property --light-x {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 50%;
}

@property --line-light-x {
    syntax: "<percentage>";
    inherits: false;
    initial-value: 50%;
}

@property --light-y {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 10%;
}

@property --lit-core {
    syntax: "<color>";
    inherits: true;
    initial-value: #fff8ca;
}

@property --lit-edge {
    syntax: "<color>";
    inherits: true;
    initial-value: #ffd766;
}

@property --far-core {
    syntax: "<color>";
    inherits: true;
    initial-value: #b8edff;
}

@property --far-edge {
    syntax: "<color>";
    inherits: true;
    initial-value: #5ab7ff;
}

:root {
    --sky: #7ddcff;
    --sky-deep: #4bbcff;
    --sun: #ffe88a;
    --sun-strong: #ffd766;
    --coral: #ffae82;
    --paper: #fffaf0;
    --ink: #071827;
    --page-bg: #081a2b;
    --light-x: 50%;
    --light-y: 10%;
    --lit-core: #fff8ca;
    --lit-edge: #ffd766;
    --far-core: #b8edff;
    --far-edge: #5ab7ff;
}

* { box-sizing: border-box; }

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    position: relative;
    color: #ffffff;
    background: linear-gradient(155deg, #071827 0%, #0c2740 49%, #152d43 72%, #1e2f42 100%);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    transition:
        --lit-core 2600ms ease,
        --lit-edge 2600ms ease,
        --far-core 2600ms ease,
        --far-edge 2600ms ease,
        --light-x 32s linear,
        --light-y 32s linear;
}

.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.atmosphere-day,
.atmosphere-night {
    position: absolute;
    inset: 0;
    transition: opacity 2600ms ease;
}

.atmosphere-day {
    opacity: 1;
    background:
        radial-gradient(circle at var(--light-x) var(--light-y), rgba(255, 235, 153, 0.28) 0%, rgba(255, 207, 111, 0.09) 20%, transparent 43%),
        radial-gradient(circle at 50% -8%, rgba(125, 220, 255, 0.42) 0%, rgba(75, 188, 255, 0.12) 31%, transparent 52%),
        radial-gradient(circle at 88% 92%, rgba(255, 174, 130, 0.22) 0%, transparent 40%),
        radial-gradient(circle at 12% 84%, rgba(255, 232, 138, 0.13) 0%, transparent 34%),
        linear-gradient(155deg, #071827 0%, #0c2740 49%, #152d43 72%, #1e2f42 100%);
}

.atmosphere-night {
    opacity: 0;
    background:
        radial-gradient(circle at var(--light-x) var(--light-y), rgba(137, 211, 255, 0.31) 0%, rgba(87, 151, 255, 0.11) 22%, transparent 45%),
        radial-gradient(circle at 50% -12%, rgba(49, 94, 144, 0.3) 0%, transparent 48%),
        radial-gradient(circle at 84% 88%, rgba(255, 190, 112, 0.1) 0%, transparent 36%),
        linear-gradient(155deg, #030912 0%, #07182b 52%, #10263d 76%, #17293b 100%);
}

body[data-phase="night"] .atmosphere-day { opacity: 0; }
body[data-phase="night"] .atmosphere-night { opacity: 1; }

.atmosphere::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(115deg, transparent 0 42%, rgba(255, 255, 255, 0.035) 49%, transparent 56%),
        radial-gradient(ellipse 70% 48% at 50% 50%, rgba(255, 255, 255, 0.035), transparent 72%);
}

.celestial-stage {
    position: fixed;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

.celestial-orb {
    position: absolute;
    left: 50%;
    top: 10%;
    width: clamp(34px, 3.3vw, 58px);
    aspect-ratio: 1;
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
    transition:
        left 2800ms cubic-bezier(0.22, 0.75, 0.25, 1),
        top 2800ms cubic-bezier(0.22, 0.75, 0.25, 1),
        opacity 1600ms ease,
        transform 1800ms ease;
    will-change: left, top, opacity, transform;
}

.celestial-orb.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.celestial-orb.is-cruising {
    transition:
        left 32s linear,
        top 32s linear,
        opacity 1800ms ease,
        transform 1800ms ease;
}

.sun-orb {
    background: radial-gradient(circle at 36% 34%, #fffde0 0%, #fff2a6 36%, #ffd765 70%, #ffb85f 100%);
    box-shadow:
        0 0 16px rgba(255, 246, 184, 0.96),
        0 0 42px rgba(255, 216, 103, 0.56),
        0 0 90px rgba(255, 174, 92, 0.25);
}

.moon-orb {
    background:
        radial-gradient(circle at 68% 30%, rgba(106, 148, 185, 0.34) 0 7%, transparent 8%),
        radial-gradient(circle at 35% 64%, rgba(94, 136, 175, 0.28) 0 9%, transparent 10%),
        radial-gradient(circle at 42% 37%, #f7fdff 0%, #d9f1ff 48%, #9bcfff 100%);
    box-shadow:
        0 0 16px rgba(219, 244, 255, 0.9),
        0 0 44px rgba(111, 195, 255, 0.46),
        0 0 94px rgba(75, 133, 255, 0.23);
}

.memorial-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: grid;
    grid-template-rows: repeat(10, minmax(0, 1fr));
    gap: 0.12vh;
    padding: 1.2vh 0;
    overflow: hidden;
}

.memorial-layer::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 62% 58% at 50% 49%,
            rgba(8, 26, 43, 0.93) 0%,
            rgba(8, 26, 43, 0.82) 36%,
            rgba(8, 26, 43, 0.31) 70%,
            rgba(8, 26, 43, 0.04) 100%
        ),
        linear-gradient(90deg, var(--page-bg) 0%, transparent 5%, transparent 95%, var(--page-bg) 100%);
}

.memorial-track {
    position: relative;
    z-index: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.track-content {
    width: max-content;
    display: flex;
    align-items: center;
    will-change: transform;
    animation: memorial-left var(--duration, 132s) linear infinite;
    animation-delay: var(--delay, 0s);
}

.memorial-track.reverse .track-content { animation-name: memorial-right; }
.memorial-track.is-paused .track-content { animation-play-state: paused; }

.track-set {
    flex: none;
    display: flex;
    align-items: center;
    gap: clamp(28px, 3.4vw, 72px);
    padding-right: clamp(28px, 3.4vw, 72px);
}

.hero-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.58em;
    padding: 7px 0;
    border: 0;
    color: rgba(220, 242, 255, 0.28);
    background: transparent;
    font: 620 clamp(12px, 1.08vw, 18px) / 1.1 ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.015em;
    white-space: nowrap;
    cursor: default;
    transition: color 160ms ease, text-shadow 160ms ease, transform 160ms ease;
}

.hero-item::before {
    content: "";
    width: 3px;
    height: 3px;
    flex: none;
    border-radius: 50%;
    background: rgba(255, 232, 138, 0.48);
    box-shadow: 0 0 8px rgba(255, 232, 138, 0.16);
}

.hero-item:hover,
.hero-item:focus-visible,
.hero-item.is-active {
    z-index: 5;
    color: rgba(255, 250, 240, 0.98);
    text-shadow: 0 0 22px rgba(125, 220, 255, 0.46);
    transform: scale(1.035);
    outline: none;
}

.hero-item:hover::before,
.hero-item:focus-visible::before,
.hero-item.is-active::before {
    width: 5px;
    height: 5px;
    background: var(--sun);
    box-shadow: 0 0 14px rgba(255, 232, 138, 0.86);
}

@keyframes memorial-left {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-50%, 0, 0); }
}

@keyframes memorial-right {
    from { transform: translate3d(-50%, 0, 0); }
    to   { transform: translate3d(0, 0, 0); }
}

.timer-panel {
    position: fixed;
    inset: 0;
    z-index: 5;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: clamp(12px, 2.2vh, 28px);
    padding: clamp(22px, 4vh, 48px) 3vw;
    pointer-events: none;
}

.timer-row {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.line {
    display: inline-block;
    flex: none;
    width: max-content;
    max-width: none;
    margin: 0;
    white-space: nowrap;
    text-align: center;
    font-weight: 900;
    line-height: 0.96;
    letter-spacing: -0.035em;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums lining-nums;
    transform-origin: 50% 50%;
    --line-light-x: 50%;
    transition: --line-light-x 32s linear;
    background-image: radial-gradient(
        circle at var(--line-light-x) 50%,
        var(--lit-core) 0%,
        var(--lit-edge) 18%,
        var(--far-core) 62%,
        var(--far-edge) 100%
    );
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter:
        drop-shadow(0 0 11px color-mix(in srgb, var(--lit-core) 24%, transparent))
        drop-shadow(0 0 28px color-mix(in srgb, var(--far-edge) 14%, transparent));
}

body.celestial-intro .line { transition-duration: 2600ms; }

#time { letter-spacing: -0.045em; }
.button-row { margin-top: clamp(2px, 0.8vh, 10px); }

.copy-button {
    min-width: 132px;
    padding: 12px 27px;
    border: 1px solid rgba(255, 250, 240, 0.32);
    border-radius: 999px;
    color: rgba(255, 250, 240, 0.96);
    background: linear-gradient(135deg, rgba(125, 220, 255, 0.14), rgba(255, 232, 138, 0.12));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 12px 38px rgba(2, 10, 20, 0.24),
        0 0 28px rgba(125, 220, 255, 0.08);
    backdrop-filter: blur(16px) saturate(125%);
    -webkit-backdrop-filter: blur(16px) saturate(125%);
    font: 780 clamp(13px, 1.2vw, 18px) / 1 ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.13em;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.copy-button:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(125, 220, 255, 0.22), rgba(255, 232, 138, 0.2));
    border-color: rgba(255, 250, 240, 0.52);
}

.copy-button:active { transform: translateY(0) scale(0.98); }

.copy-button:focus-visible {
    outline: 3px solid rgba(255, 232, 138, 0.82);
    outline-offset: 4px;
}

.hero-card {
    position: fixed;
    z-index: 20;
    width: min(390px, calc(100vw - 28px));
    padding: 18px 19px 16px;
    border: 1px solid rgba(196, 233, 255, 0.24);
    border-radius: 18px;
    color: rgba(255, 250, 240, 0.95);
    background: linear-gradient(145deg, rgba(22, 54, 77, 0.95), rgba(14, 36, 57, 0.96));
    box-shadow:
        0 24px 72px rgba(2, 10, 20, 0.5),
        0 0 34px rgba(125, 220, 255, 0.08);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 120ms ease, transform 120ms ease;
}

.hero-card.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hero-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--sky), var(--sun), var(--coral));
    opacity: 0.96;
}

.hero-card-name {
    margin: 0 0 9px;
    color: #ffffff;
    font-size: 17px;
    font-weight: 820;
    line-height: 1.35;
}

.hero-card-line {
    margin: 4px 0;
    color: rgba(231, 244, 255, 0.78);
    font-size: 13px;
    line-height: 1.5;
}

.hero-card-source {
    margin-top: 10px;
    color: rgba(255, 232, 138, 0.78);
    font-size: 11px;
    letter-spacing: 0.04em;
}

.meta-note {
    position: fixed;
    z-index: 10;
    bottom: 10px;
    color: rgba(220, 242, 255, 0.43);
    font: 580 10px / 1.3 ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.055em;
    text-decoration: none;
    transition: color 160ms ease;
}

.version-note { left: 14px; }
.source-note { right: 14px; text-align: right; }

.source-note:hover,
.source-note:focus-visible {
    color: rgba(255, 250, 240, 0.86);
    outline: none;
}

@media (max-width: 640px) {
    .memorial-layer {
        grid-template-rows: repeat(8, minmax(0, 1fr));
        padding: 1.8vh 0;
    }

    .memorial-layer::after {
        background:
            radial-gradient(
                ellipse 92% 64% at 50% 49%,
                rgba(8, 26, 43, 0.95) 0%,
                rgba(8, 26, 43, 0.84) 43%,
                rgba(8, 26, 43, 0.25) 82%,
                transparent 100%
            );
    }

    .hero-item {
        font-size: 12px;
        color: rgba(220, 242, 255, 0.25);
    }

    .timer-panel {
        gap: clamp(10px, 1.65vh, 18px);
        padding: 4vh 2.5vw 5vh;
    }

    .copy-button {
        min-width: 108px;
        padding: 10px 20px;
    }

    .meta-note {
        bottom: 7px;
        font-size: 8px;
        letter-spacing: 0.035em;
    }

    .version-note { left: 10px; }
    .source-note { right: 10px; max-width: 58vw; }
}

@media (prefers-reduced-motion: reduce) {
    body { transition: none; }
    .track-content { animation-play-state: paused; }
    .celestial-orb,
    .atmosphere-day,
    .atmosphere-night,
    .copy-button,
    .hero-item,
    .hero-card { transition: none; }
}
