/* DYGERS — aurora glass, slow cinematic motion */

:root {
    --bg: #060606;
    --red: #ff2b2b;
    --orange: #ff7a18;
    --yellow: #ffd23f;
    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, 0.7);
    --text: #f5f2ea;
    --muted: #6f6f6f;
    --hairline: rgba(255, 255, 255, 0.09);
    --glass: rgba(255, 255, 255, 0.04);
    --grad: linear-gradient(100deg, var(--red), var(--orange) 50%, var(--yellow));
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

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

html,
body {
    min-height: 100vh;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- aurora ---------- */
.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    will-change: transform, filter;
}

.blob-red {
    background: var(--red);
    width: 48vmax;
    height: 48vmax;
    top: -20%;
    left: -14%;
    opacity: 0.14;
    animation: drift 46s ease-in-out infinite alternate,
        hue 30s linear infinite;
}

.blob-orange {
    background: var(--orange);
    width: 44vmax;
    height: 44vmax;
    bottom: -24%;
    right: -12%;
    opacity: 0.13;
    animation: drift 58s ease-in-out infinite alternate-reverse,
        hue 36s linear infinite;
}

.blob-yellow {
    background: var(--yellow);
    width: 28vmax;
    height: 28vmax;
    top: 44%;
    left: 40%;
    opacity: 0.07;
    animation: drift 64s ease-in-out infinite alternate,
        hue 42s linear infinite;
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(9vmax, -7vmax, 0) scale(1.28);
    }
}

@keyframes hue {
    0%,
    100% {
        filter: blur(110px) hue-rotate(0deg);
    }
    50% {
        filter: blur(120px) hue-rotate(24deg);
    }
}

.grain {
    position: absolute;
    inset: 0;
    opacity: 0.45;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ---------- layout ---------- */
.wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 44px 20px;
    gap: 36px;
}

.hero {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-img {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    object-fit: cover;
    animation: logo-pulse 4.5s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%,
    100% {
        box-shadow: 0 0 34px rgba(255, 122, 24, 0.3);
    }
    50% {
        box-shadow: 0 0 56px rgba(255, 210, 63, 0.5);
    }
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.44em;
    font-size: 18px;
}

.title {
    font-family: var(--font-display);
    font-size: clamp(32px, 6vw, 54px);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--grad);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 6s linear infinite;
}

.subtitle {
    color: var(--muted);
    font-size: 15px;
    max-width: 340px;
    line-height: 1.6;
}

/* ---------- glass card ---------- */
.card {
    position: relative;
    width: min(400px, 100%);
    background: var(--glass);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--hairline);
    border-radius: 24px;
    padding: 32px 28px 30px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .card {
        background: #0d0d0d;
    }
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: 24px;
    background: conic-gradient(
        from var(--angle),
        transparent 0%,
        var(--red) 10%,
        var(--yellow) 20%,
        var(--orange) 30%,
        transparent 44%,
        transparent 56%,
        var(--yellow) 68%,
        var(--red) 82%,
        transparent 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: border-spin 10s linear infinite;
    opacity: 0.85;
    pointer-events: none;
    z-index: 2;
}

@keyframes border-spin {
    to {
        --angle: 360deg;
    }
}

.flicker-line {
    position: absolute;
    top: 0;
    left: -60%;
    width: 45%;
    height: 1.5px;
    background: var(--grad);
    filter: drop-shadow(0 0 8px var(--orange));
    animation: slide 6.5s ease-in-out infinite;
}

@keyframes slide {
    0%,
    100% {
        left: -60%;
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    55% {
        left: 115%;
        opacity: 1;
    }
    70% {
        opacity: 0;
    }
}

.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 22px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- hidden input ---------- */
.code-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    font-size: 16px;
    pointer-events: none;
}

/* ---------- cubes ---------- */
.slots {
    display: flex;
    gap: 12px;
    cursor: text;
    outline: none;
}

.slot {
    flex: 1;
    height: 74px;
    border-radius: 18px;
    position: relative;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.055),
        rgba(255, 255, 255, 0.02)
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 30px rgba(0, 0, 0, 0.45);
    transition:
        border-color 0.5s var(--ease),
        box-shadow 0.5s var(--ease),
        background 0.5s var(--ease),
        transform 0.5s var(--ease);
}

.slot.active {
    border-color: rgba(34, 197, 94, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 3px rgba(34, 197, 94, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.45);
}

.slot.active::after {
    content: "";
    position: absolute;
    width: 2.5px;
    height: 34px;
    border-radius: 3px;
    background: var(--green);
    box-shadow: 0 0 14px var(--green);
    animation: blink 1.4s steps(2, start) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.slot.filled {
    border-color: var(--green-soft);
    background: linear-gradient(
        180deg,
        rgba(34, 197, 94, 0.16),
        rgba(34, 197, 94, 0.04)
    );
    text-shadow: 0 0 18px rgba(74, 222, 128, 0.6);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 0 0 1.5px rgba(34, 197, 94, 0.3),
        0 0 22px rgba(34, 197, 94, 0.22),
        0 10px 30px rgba(0, 0, 0, 0.45);
    animation: fill-in 0.6s var(--ease);
}

@keyframes fill-in {
    0% {
        transform: scale(0.7) rotate(-3deg);
        box-shadow: 0 0 34px rgba(34, 197, 94, 0.55);
        background: rgba(34, 197, 94, 0.28);
    }
    55% {
        transform: scale(1.08) rotate(1deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* волна при полном коде */
.slots.complete .slot {
    border-color: var(--green);
    animation: wave 0.75s var(--ease);
}

.slots.complete .slot:nth-child(1) { animation-delay: 0s; }
.slots.complete .slot:nth-child(2) { animation-delay: 0.07s; }
.slots.complete .slot:nth-child(3) { animation-delay: 0.14s; }
.slots.complete .slot:nth-child(4) { animation-delay: 0.21s; }
.slots.complete .slot:nth-child(5) { animation-delay: 0.28s; }

@keyframes wave {
    0%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
        box-shadow:
            0 0 36px rgba(34, 197, 94, 0.55),
            0 14px 34px rgba(0, 0, 0, 0.5);
    }
    70% {
        transform: translateY(2px);
    }
}

.slots.shake {
    animation: shake 0.55s var(--ease);
}

.slots.shake .slot {
    border-color: rgba(255, 43, 43, 0.7);
    background: rgba(255, 43, 43, 0.08);
    box-shadow: 0 0 22px rgba(255, 43, 43, 0.2);
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    22% {
        transform: translateX(-9px);
    }
    46% {
        transform: translateX(7px);
    }
    70% {
        transform: translateX(-4px);
    }
}

/* ---------- toast ---------- */
.toast {
    display: none;
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 15px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    background: rgba(18, 18, 18, 0.9);
    border: 1px solid var(--hairline);
    text-align: center;
    color: var(--text);
    z-index: 3;
}

.toast.show {
    display: block;
    animation: toast-in 0.5s var(--ease);
}

.toast.error {
    border-color: rgba(255, 43, 43, 0.6);
    color: #ff9696;
    box-shadow: 0 0 24px rgba(255, 43, 43, 0.15);
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.6);
    color: #86efac;
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.18);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- reveal ---------- */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    filter: blur(6px);
    animation: rise 1.1s var(--ease) forwards;
}

.d2 {
    animation-delay: 0.18s;
}
.d3 {
    animation-delay: 0.36s;
}
.d4 {
    animation-delay: 0.55s;
}

@keyframes rise {
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* ---------- success ---------- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: rgba(3, 3, 3, 0.85);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    text-align: center;
    padding: 20px;
}

.check {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #22c55e 55%, #4ade80);
    display: grid;
    place-items: center;
    font-size: 0;
    animation: pop-in 0.8s var(--ease);
    box-shadow:
        0 0 70px rgba(34, 197, 94, 0.5),
        0 0 140px rgba(34, 197, 94, 0.22);
}

@keyframes pop-in {
    from {
        transform: scale(0) rotate(-12deg);
    }
    65% {
        transform: scale(1.08) rotate(2deg);
    }
    to {
        transform: scale(1) rotate(0deg);
    }
}

.check-icon {
    width: 48px;
    height: 48px;
}

.check-path {
    fill: none;
    stroke: #06120a;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: draw 0.85s 0.3s var(--ease) forwards;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

.ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--green);
    opacity: 0;
    animation: ring 2.6s ease-out infinite;
}

.ring.r2 {
    animation-delay: 0.7s;
    border-color: #86efac;
}

@keyframes ring {
    0% {
        transform: scale(1);
        opacity: 0.75;
    }
    100% {
        transform: scale(2.1);
        opacity: 0;
    }
}

.modal-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: linear-gradient(
        100deg,
        var(--red),
        var(--orange),
        var(--yellow),
        var(--orange),
        var(--red)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 4.5s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: 200% center;
    }
}

.modal-nick {
    margin-top: 12px;
    color: var(--muted);
    font-size: 15px;
}

/* ---------- confetti ---------- */
.confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.confetti span {
    position: absolute;
    top: -24px;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    opacity: 0;
    animation: drop 5s ease-in forwards;
}

.confetti span:nth-child(1) { left: 6%;  background: var(--red);    animation-delay: 0.1s; }
.confetti span:nth-child(2) { left: 14%; background: var(--yellow); animation-delay: 0.6s;  animation-duration: 5.6s; }
.confetti span:nth-child(3) { left: 22%; background: var(--orange); animation-delay: 0.3s; }
.confetti span:nth-child(4) { left: 30%; background: var(--red);    animation-delay: 0.9s;  animation-duration: 5.4s; }
.confetti span:nth-child(5) { left: 38%; background: var(--yellow); animation-delay: 0.4s; }
.confetti span:nth-child(6) { left: 46%; background: var(--orange); animation-delay: 0.7s; }
.confetti span:nth-child(7) { left: 54%; background: var(--red);    animation-delay: 0.2s;   animation-duration: 5.8s; }
.confetti span:nth-child(8) { left: 62%; background: var(--yellow); animation-delay: 0.8s; }
.confetti span:nth-child(9) { left: 70%; background: var(--orange); animation-delay: 0.5s; animation-duration: 5.2s; }
.confetti span:nth-child(10) { left: 78%; background: var(--red);   animation-delay: 1s; }
.confetti span:nth-child(11) { left: 86%; background: var(--yellow); animation-delay: 0.35s; animation-duration: 6s; }
.confetti span:nth-child(12) { left: 94%; background: var(--orange); animation-delay: 0.65s; }

@keyframes drop {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(112vh) rotate(680deg);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 28px 18px 26px;
    }
    .slots {
        gap: 8px;
    }
    .slot {
        height: 62px;
        border-radius: 14px;
        font-size: 24px;
    }
}
