/* ==========================================================
   SPACE theme — deep galaxy, glass clock, starlight text
   ========================================================== */
:root {
    --s-deep: #04030c;
    --s-star: #ecebff;
    --s-lav: #b9a8ff;
    --s-glow: rgba(170, 150, 255, .8);
    --fc8: #c9b8ff;
}

/* ---------- sky ---------- */
body.space, .space section { background-color: var(--s-deep); }
.space section { background-color: transparent; }
body.space > img, .space #touch { display: none; }
#spaceWorld {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}
body.space #spaceWorld { opacity: 1; }
#spaceWorld canvas { position: absolute; inset: 0; display: block; }
/* ---------- fonts ---------- */
.space section h2,
.space section h2 *,
.space .countdown div,
.space .text,
.space h4 { font-family: 'Exo 2', sans-serif; }

/* ---------- glass clock ---------- */
.space section .box:before { display: none; }
.space section .circle {
    background: radial-gradient(circle at 35% 30%, rgba(80, 70, 160, .28), rgba(12, 10, 35, .45) 70%);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(200, 190, 255, .28);
    box-shadow:
        0 0 70px rgba(140, 120, 255, .28),
        inset 0 0 50px rgba(140, 120, 255, .14),
        inset 0 1px 0 rgba(255, 255, 255, .15);
    transition: box-shadow .3s ease, transform .2s ease;
}
.space section .circle:hover {
    box-shadow:
        0 0 100px rgba(160, 140, 255, .4),
        inset 0 0 60px rgba(140, 120, 255, .2),
        inset 0 1px 0 rgba(255, 255, 255, .2);
}
.space section .circle:before,
.space section .circle.poppuf:before {
    top: 18px; left: 18px; right: 18px; bottom: 18px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .07);
}
/* slowly turning orbit with a tiny planet */
.space section .circle:after {
    content: '';
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    border: 1px dashed rgba(200, 190, 255, .22);
    background: radial-gradient(circle at 50% 0, #d9cfff 0 4px, rgba(185, 168, 255, .5) 5px, transparent 9px) no-repeat;
    animation: spaceOrbit 90s linear infinite;
    pointer-events: none;
}
.space section .circle.popbig { transform: scale(.985); }
@keyframes spaceOrbit { to { transform: rotate(360deg); } }

/* ---------- starlight text ---------- */
.space section h2 {
    color: var(--s-star);
    font-weight: 200;
    font-size: 2.9em;
    letter-spacing: .16em;
    text-transform: uppercase;
    line-height: 1.35;
    text-shadow: 0 0 12px var(--s-glow), 0 0 34px rgba(140, 120, 255, .45);
}
.space section .poppuf h2 { font-size: 3em; }
.space span#year { font-size: 1.15em; letter-spacing: .3em; font-weight: 300; }
.space span#year em,
.space .countdown #second {
    color: var(--s-lav);
    -webkit-text-fill-color: var(--s-lav);
    -webkit-text-stroke-width: 0;
    text-shadow: 0 0 14px rgba(185, 168, 255, .9);
}
.space .countdown div {
    color: var(--s-star);
    -webkit-text-fill-color: var(--s-star);
    -webkit-text-stroke-width: 0;
    font-weight: 300;
    font-size: 1.7em;
    text-shadow: 0 0 10px rgba(170, 150, 255, .6);
}
.space .countdown div:before,
.space .countdown #second:before {
    font-size: .58rem;
    font-weight: 500;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: rgba(210, 205, 255, .55);
    -webkit-text-fill-color: rgba(210, 205, 255, .55);
    text-shadow: none;
    bottom: -30px;
}

/* ---------- hands ---------- */
.space .clock:before {
    width: 12px; height: 12px;
    background: #fff;
    box-shadow: 0 0 10px #fff, 0 0 24px var(--s-glow);
}
.space .hr:before, .space .mn:before {
    background: rgba(236, 235, 255, .92);
    border: none;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(200, 190, 255, .7);
}
.space .hr:before { width: 5px; }
.space .mn:before { width: 3px; }
.space .sc:before {
    width: 1.5px;
    background: var(--s-lav);
    box-shadow: 0 0 8px var(--s-lav);
}

/* ---------- drifting stardust (the floating dots) ---------- */
.space section i {
    max-width: 3px;
    max-height: 3px;
    background: #fff;
    border: none;
    box-shadow: 0 0 6px #fff, 0 0 12px rgba(185, 168, 255, .7);
    transform-origin: center;
}
.space section i:nth-child(3n+1) {
    background: var(--s-lav);
    border: none;
    box-shadow: 0 0 8px var(--s-lav);
}
.space section i:nth-child(n+70) { display: none; }

/* ---------- buttons ---------- */
.space .label { color: var(--s-star); }
.space .text { font-weight: 300; letter-spacing: .08em; text-shadow: 0 0 8px var(--s-glow); }
.space .indicator {
    background: rgba(20, 16, 50, .55);
    border: 1px solid rgba(200, 190, 255, .3);
    box-shadow: 0 0 14px rgba(140, 120, 255, .25);
}
.space .indicator::before { box-shadow: none; }
.space .indicator::after { background: rgba(30, 24, 70, .7); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.space .state:checked ~ .label .indicator {
    box-shadow: 0 0 20px rgba(185, 168, 255, .6), inset 0 0 12px rgba(185, 168, 255, .35);
    border-color: rgba(220, 210, 255, .6);
}
.wrapper:nth-child(5) .indicator {
    animation: lefting .4s ease;
    animation-iteration-count: 1;
    animation-delay: 3.2s;
    animation-fill-mode: forwards;
    transform: scale(1.2);
}

.space h4 {
    color: rgba(236, 235, 255, .8);
    font-weight: 300;
    letter-spacing: .25em;
    font-size: .8em;
    text-transform: uppercase;
    text-shadow: 0 0 8px var(--s-glow);
}

/* ---------- fireworks in starlight lavender ---------- */
body.space #fireworks:before, body.space #fireworks:after {
    animation: 1s bang ease-out infinite backwards,
               1s gravity ease-in infinite backwards,
               5s position linear infinite backwards;
    box-shadow: -120px 0 var(--fc8), 120px 0 var(--fc8), 0 120px var(--fc8), 0 -120px var(--fc8),
                45px 45px var(--fc8), -45px 45px var(--fc8), 85px 85px var(--fc8), -85px 85px var(--fc8),
                45px -45px var(--fc8), -45px -45px var(--fc8), 85px -85px var(--fc8), -85px -85px var(--fc8),
                65px 0 var(--fc8), -65px 0 var(--fc8), 0 65px var(--fc8), 0 -65px var(--fc8),
                100px 45px var(--fc8), -100px 45px var(--fc8), -50px 100px var(--fc8), 50px 100px var(--fc8),
                100px -45px var(--fc8), -100px -45px var(--fc8), -50px -100px var(--fc8), 50px -100px var(--fc8),
                5px 10px var(--fc8);
    filter: drop-shadow(0 0 4px var(--fc8));
}
body.space #fireworks:after {
    animation-delay: 1.25s, 1.25s, 1.25s;
    animation-duration: 1.25s, 1.25s, 6.25s;
}

/* ---------- mobile: room for 5 buttons ---------- */
@media only screen and (max-width: 600px) {
    .wrapper { margin: 12px 6px; }
    .space section h2 { font-size: 2.3em; }
}

/* ==========================================================
   ALIEN NUMERALS + DIAL
   ========================================================== */
.al-src {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.al-word { display: inline-flex; gap: .14em; align-items: center; justify-content: center; }
.al-g {
    width: .62em;
    height: .95em;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 4px rgba(185, 168, 255, .85));
}
.al-g .f { fill: currentColor; stroke: none; }
.space span#year .al-word { gap: .28em; }
.space span#year .al-g { width: .55em; height: .85em; stroke-width: 2; }
.space span#year em,
.space span#year em .al-g { color: var(--s-lav); }
.space .countdown div .al-g { width: .5em; height: .78em; stroke-width: 2.4; }
.space .countdown div { cursor: help; }
.space span#year em { -webkit-text-fill-color: initial; }

.al-dial { display: none; }
.space .al-dial {
    display: block;
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}
.al-ring {
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(185, 168, 255, .9) calc(var(--p, 0) * 1turn), rgba(255, 255, 255, .06) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    filter: drop-shadow(0 0 6px rgba(185, 168, 255, .8));
}
.al-mark {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    gap: 2px;
    font-size: 15px;
    color: rgba(225, 220, 255, .75);
    transform: translate(-50%, -50%) rotate(var(--a)) translateY(-188px) rotate(calc(var(--a) * -1));
    animation: alPulse 4s ease-in-out infinite;
    animation-delay: calc(var(--a) / 360deg * -4s);
}
.al-mark .al-g { width: .62em; height: .95em; stroke-width: 2.6; }
@keyframes alPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ==========================================================
   ORBIT COUNTDOWN (replaces numbers + hands in space)
   ========================================================== */
.space #circle2 .timer-box,
.space #circle2 .clock .hour,
.space #circle2 .clock .min,
.space #circle2 .clock .sec { opacity: 0; }
.space #circle2 .clock:before { display: none; }

.al-orbits {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.al-orbits .trk { fill: none; stroke: rgba(210, 200, 255, .07); stroke-width: 1; }
.al-orbits .arc {
    fill: none;
    stroke: url(#alGrad);
    stroke-width: 1.6;
    stroke-linecap: round;
    opacity: .55;
    filter: drop-shadow(0 0 3px rgba(185, 168, 255, .9));
}
.al-orbits .flow {
    fill: none;
    stroke: #f1edff;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-dasharray: 1 11;
    animation: alFlow linear infinite;
    filter: drop-shadow(0 0 4px rgba(220, 210, 255, 1));
}
.al-orbits .o1 .flow, .al-orbits .o3 .flow { animation-direction: reverse; stroke-dasharray: 6 14; stroke-width: 1.4; }
@keyframes alFlow { to { stroke-dashoffset: -240; } }
.al-orbits .head {
    fill: #fff;
    filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px rgba(185, 168, 255, 1));
    animation: alHead 2.4s ease-in-out infinite;
}
.al-orbits .o1 .head { animation-delay: -.6s; }
.al-orbits .o2 .head { animation-delay: -1.2s; }
.al-orbits .o3 .head { animation-delay: -1.8s; }
@keyframes alHead { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.al-orbits .lbl {
    fill: rgba(210, 200, 255, .45);
    font: 500 7px 'Exo 2', sans-serif;
    letter-spacing: .1em;
    text-anchor: end;
}
.al-orbits .orb-h {
    fill: #c9b8ff;
    stroke: rgba(255, 255, 255, .8);
    stroke-width: 1;
    filter: drop-shadow(0 0 6px #b9a8ff) drop-shadow(0 0 14px rgba(185, 168, 255, .8));
}
.al-orbits .orb-m {
    fill: #fff;
    filter: drop-shadow(0 0 5px #fff);
}

.al-core {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--s-star);
    font-family: 'Exo 2', sans-serif;
    pointer-events: none;
    animation: alBreath 6s ease-in-out infinite;
}
@keyframes alBreath { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }
.al-yr { font-size: 15px; color: rgba(225, 220, 255, .8); margin-bottom: 6px; }
.al-yr .al-word { gap: .35em; }
.al-yr em { color: var(--s-lav); }
.al-pct {
    font-size: 30px;
    font-weight: 200;
    letter-spacing: .04em;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 0 12px var(--s-glow), 0 0 30px rgba(140, 120, 255, .45);
    font-variant-numeric: tabular-nums;
}
.al-pct span { color: var(--s-star); }
.al-pct small { font-size: .5em; color: var(--s-lav); letter-spacing: .06em; }
.al-pct b { font-weight: 200; font-size: .55em; margin-left: 3px; color: rgba(225, 220, 255, .7); }
.al-cap {
    margin-top: 8px;
    font-size: 7.5px;
    font-weight: 500;
    letter-spacing: .42em;
    text-transform: uppercase;
    color: rgba(210, 205, 255, .5);
}

/* tiny yellow hour dots */
.al-orbits .hdot {
    fill: #ffd75e;
    filter: drop-shadow(0 0 3px rgba(255, 215, 94, .9));
    animation: alHead 4s ease-in-out infinite;
}
.al-orbits .hdot.big { fill: #ffe38a; }

/* hour ring + hour orb: a little more red */
.al-orbits .o1 .arc  { stroke: url(#alGradH); }
.al-orbits .o1 .flow { stroke: #ffd6e0; filter: drop-shadow(0 0 4px rgba(255, 120, 150, 1)); }
.al-orbits .o1 .head { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px rgba(255, 90, 130, 1)); }
.al-orbits .orb-h {
    fill: #ff8fa8;
    filter: drop-shadow(0 0 6px #ff6f91) drop-shadow(0 0 14px rgba(255, 90, 130, .8));
}

/* minute ring + minute orb: a little more blue */
.al-orbits .o2 .arc  { stroke: url(#alGradM); }
.al-orbits .o2 .flow { stroke: #dbeaff; filter: drop-shadow(0 0 4px rgba(110, 160, 255, 1)); }
.al-orbits .o2 .head { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px rgba(90, 140, 255, 1)); }
.al-orbits .orb-m {
    fill: #a9cbff;
    filter: drop-shadow(0 0 5px #7fb2ff) drop-shadow(0 0 10px rgba(90, 140, 255, .8));
}

/* water-like ripples on the sky: wide, slow, glassy */
.sw-ripple {
    position: absolute;
    width: 0;
    height: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    -webkit-backdrop-filter: blur(3.5px) brightness(1.08) saturate(1.15);
            backdrop-filter: blur(3.5px) brightness(1.08) saturate(1.15);
    /* thin glass edges: bright inner rim, soft outer rim */
    background: radial-gradient(circle,
        transparent 36%,
        rgba(255, 255, 255, .05) 40%,
        transparent 46%,
        transparent 60%,
        rgba(225, 215, 255, .06) 66%,
        rgba(255, 255, 255, .09) 69%,
        transparent 72%);
    -webkit-mask: radial-gradient(circle, transparent 34%, rgba(0,0,0,.55) 44%, #000 58%, #000 66%, transparent 73%);
            mask: radial-gradient(circle, transparent 34%, rgba(0,0,0,.55) 44%, #000 58%, #000 66%, transparent 73%);
    animation: swRipple 4.6s cubic-bezier(.2, .55, .3, 1) both;
}
@keyframes swRipple {
    0%   { width: 0; height: 0; opacity: 0; }
    8%   { opacity: .9; }
    60%  { opacity: .6; }
    100% { width: var(--size); height: var(--size); opacity: 0; }
}

/* the little inward wave right after the click */
.sw-ripple.sw-in {
    animation: swRippleIn .55s cubic-bezier(.5, 0, .7, .4) both;
}
@keyframes swRippleIn {
    0%   { width: var(--size); height: var(--size); opacity: 0; }
    25%  { opacity: .85; }
    85%  { opacity: .6; }
    100% { width: 0; height: 0; opacity: 0; }
}
