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

:root {
    --bg-deep: #070a1a;
    --bg-mid: #101a3a;
    --text-main: #e9eeff;
    --text-soft: #adc0ff;
    --card-bg: rgba(14, 20, 48, 0.62);
    --card-border: rgba(146, 170, 255, 0.35);
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.75rem 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    isolation: isolate;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(1200px 600px at 12% 18%, rgba(58, 120, 255, 0.16), transparent 65%),
        radial-gradient(1000px 520px at 82% 84%, rgba(246, 98, 172, 0.14), transparent 70%),
        linear-gradient(135deg, var(--bg-deep), #080f27 46%, #0d1430 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: -18vmax;
    pointer-events: none;
    z-index: -2;
    filter: blur(34px);
}

body::before {
    background:
        radial-gradient(circle at 24% 32%, rgba(125, 168, 255, 0.34), transparent 40%),
        radial-gradient(circle at 76% 66%, rgba(108, 252, 222, 0.20), transparent 48%);
    animation: nebulaWave 16s ease-in-out infinite alternate;
}

body::after {
    background:
        radial-gradient(circle at 80% 22%, rgba(248, 114, 187, 0.30), transparent 42%),
        radial-gradient(circle at 20% 80%, rgba(119, 106, 255, 0.23), transparent 45%);
    animation: nebulaSpin 26s linear infinite;
}

.app {
    width: min(980px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    padding-top: 4.2rem;
}

h1 {
    font-size: clamp(1.35rem, 3.6vw, 2.4rem);
    font-weight: 500;
    letter-spacing: 0.07em;
    text-align: center;
    position: absolute;
    top: -3.9rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(90vw, 900px);
    margin: 0;
    color: #f4f6ff;
    text-shadow: 0 0 24px rgba(141, 168, 255, 0.38);
}

.scene {
    width: 220px;
    height: 220px;
    perspective: 820px;
    margin: 1.4rem auto 1.05rem;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

.face {
    position: absolute;
    width: 220px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(140, 160, 255, 0.2);
    border-radius: 13px;
    backdrop-filter: blur(4px);
    overflow: hidden;
}

.face canvas {
    border-radius: 9px;
}

.front {
    background: rgba(16, 16, 40, 0.85);
    box-shadow: inset 0 0 40px rgba(110, 195, 244, 0.1), 0 0 30px rgba(110, 195, 244, 0.08);
    transform: translateZ(110px);
}

.back {
    background: rgba(16, 16, 40, 0.85);
    box-shadow: inset 0 0 40px rgba(244, 110, 184, 0.1), 0 0 30px rgba(244, 110, 184, 0.08);
    transform: rotateY(180deg) translateZ(110px);
}

.right {
    background: rgba(16, 16, 40, 0.85);
    box-shadow: inset 0 0 40px rgba(138, 110, 244, 0.1), 0 0 30px rgba(138, 110, 244, 0.08);
    transform: rotateY(90deg) translateZ(110px);
}

.left {
    background: rgba(16, 16, 40, 0.85);
    box-shadow: inset 0 0 40px rgba(110, 244, 170, 0.1), 0 0 30px rgba(110, 244, 170, 0.08);
    transform: rotateY(-90deg) translateZ(110px);
}

.top {
    background: rgba(16, 16, 40, 0.85);
    box-shadow: inset 0 0 40px rgba(244, 220, 110, 0.1);
    transform: rotateX(90deg) translateZ(110px);
}

.bottom {
    background: rgba(16, 16, 40, 0.85);
    box-shadow: inset 0 0 40px rgba(244, 140, 110, 0.1);
    transform: rotateX(-90deg) translateZ(110px);
}

.glow {
    width: 180px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(110, 140, 244, 0.28) 0%, transparent 70%);
    border-radius: 50%;
    margin-bottom: 0.7rem;
    animation: glowPulse 3s ease-in-out infinite;
}

.refresh-btn {
    border: 1px solid rgba(145, 166, 255, 0.55);
    border-radius: 999px;
    width: 2.1rem;
    height: 2.1rem;
    line-height: 1;
    padding: 0;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, rgba(30, 45, 96, 0.92), rgba(31, 79, 123, 0.86));
    color: #eef2ff;
    font-size: 1.1rem;
    cursor: pointer;
}

.refresh-btn:hover,
.refresh-btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
    box-shadow: 0 6px 18px rgba(67, 117, 255, 0.32);
}

.links-line {
    width: min(980px, 100%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem 0.55rem;
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.35;
}

.inline-link {
    color: #d6e1ff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.inline-link:hover,
.inline-link:focus-visible {
    color: #ffffff;
    border-bottom-color: rgba(214, 225, 255, 0.9);
    outline: none;
}

.link-sep {
    color: rgba(164, 182, 245, 0.76);
}

.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: float linear infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.52; transform: scaleX(1); }
    50% { opacity: 1; transform: scaleX(1.33); }
}

@keyframes float {
    0% { transform: translateY(110vh) scale(0.15); opacity: 0; }
    10% { opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translateY(-12vh) scale(1); opacity: 0; }
}

@keyframes nebulaWave {
    0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.72; }
    100% { transform: translate3d(-3%, 2%, 0) scale(1.11); opacity: 0.93; }
}

@keyframes nebulaSpin {
    0% { transform: rotate(0deg) scale(1.06); }
    100% { transform: rotate(360deg) scale(1.16); }
}

@media (max-width: 640px) {
    body {
        align-items: stretch;
        padding-top: 1rem;
        padding-bottom: 1.1rem;
    }

    .app {
        width: 100%;
        padding-top: 1rem;
    }

    h1 {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        width: 96%;
        margin: 0 0 0.55rem;
        letter-spacing: 0.04em;
    }

    .scene {
        width: 196px;
        height: 196px;
        margin-top: 8.5rem;
        margin-bottom: 1.05rem;
    }

    .face {
        width: 196px;
        height: 196px;
    }

    .front { transform: translateZ(98px); }
    .back { transform: rotateY(180deg) translateZ(98px); }
    .right { transform: rotateY(90deg) translateZ(98px); }
    .left { transform: rotateY(-90deg) translateZ(98px); }
    .top { transform: rotateX(90deg) translateZ(98px); }
    .bottom { transform: rotateX(-90deg) translateZ(98px); }

    .glow {
        width: 150px;
        margin-bottom: 0.65rem;
    }
}
