/* ==========================================================================
   Key system — single-card layout, lime theme, animated background
   ========================================================================== */

:root {
    --bg: #070b07;
    --card: #0e140e;
    --card-2: #121a12;
    --line: rgba(180, 255, 57, 0.14);
    --line-soft: rgba(255, 255, 255, 0.07);

    --text: #eaf5e4;
    --muted: #9bb08f;
    --dim: #6c7f63;

    --lime: #b4ff39;
    --lime-2: #74e03a;
    --lime-dim: rgba(180, 255, 57, 0.12);
    --err: #ff6b6b;

    --radius: 20px;
    --radius-sm: 12px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Animated background ------------------------------------------------- */

.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(90rem 60rem at 50% 120%, #0a120a, var(--bg) 70%);
}

.bg__aurora {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.5;
    will-change: transform;
}

.bg__aurora--1 {
    top: -22vh;
    left: 50%;
    width: 46rem;
    height: 30rem;
    margin-left: -23rem;
    background: radial-gradient(circle, rgba(180, 255, 57, 0.30), transparent 68%);
    animation: drift-a 22s var(--ease) infinite alternate;
}

.bg__aurora--2 {
    bottom: -26vh;
    left: -10rem;
    width: 40rem;
    height: 28rem;
    background: radial-gradient(circle, rgba(116, 224, 58, 0.26), transparent 70%);
    animation: drift-b 28s var(--ease) infinite alternate;
}

.bg__aurora--3 {
    top: 30%;
    right: -14rem;
    width: 34rem;
    height: 34rem;
    opacity: 0.35;
    background: radial-gradient(circle, rgba(57, 255, 176, 0.22), transparent 70%);
    animation: drift-c 24s var(--ease) infinite alternate;
}

@keyframes drift-a {
    from { transform: translate3d(-4rem, -1rem, 0) scale(1); }
    to   { transform: translate3d(4rem, 3rem, 0) scale(1.14); }
}

@keyframes drift-b {
    from { transform: translate3d(0, 2rem, 0) scale(1.05); }
    to   { transform: translate3d(7rem, -3rem, 0) scale(0.92); }
}

@keyframes drift-c {
    from { transform: translate3d(2rem, 0, 0) scale(0.95); }
    to   { transform: translate3d(-5rem, -4rem, 0) scale(1.12); }
}

/* Slowly sliding grid. */
.bg__grid {
    position: absolute;
    inset: -60px;
    background-image:
        linear-gradient(rgba(180, 255, 57, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(180, 255, 57, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(70% 60% at 50% 40%, #000 35%, transparent 100%);
    -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 35%, transparent 100%);
    animation: grid-pan 26s linear infinite;
}

@keyframes grid-pan {
    to { transform: translate3d(56px, 56px, 0); }
}

/* Single light sweep running down the page. */
.bg__scan {
    position: absolute;
    left: 0;
    right: 0;
    height: 42vh;
    background: linear-gradient(180deg, transparent, rgba(180, 255, 57, 0.055), transparent);
    animation: scan 11s linear infinite;
}

@keyframes scan {
    from { transform: translate3d(0, -50vh, 0); }
    to   { transform: translate3d(0, 150vh, 0); }
}

/* Floating dust particles. */
.bg__dust i {
    position: absolute;
    bottom: -10px;
    left: var(--x);
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: var(--lime);
    opacity: 0;
    animation: rise var(--t) linear var(--d) infinite;
}

@keyframes rise {
    0%   { transform: translate3d(0, 0, 0); opacity: 0; }
    10%  { opacity: 0.55; }
    50%  { transform: translate3d(2rem, -52vh, 0); opacity: 0.7; }
    90%  { opacity: 0.2; }
    100% { transform: translate3d(-1rem, -104vh, 0); opacity: 0; }
}

/* --- Stage + card -------------------------------------------------------- */

.stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 28px 18px;
}

.panel {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 28px 24px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(180, 255, 57, 0.05), rgba(180, 255, 57, 0) 38%),
        var(--card);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 30px 70px rgba(0, 0, 0, 0.6);
    animation: panel-in 0.7s var(--ease) both;
}

@keyframes panel-in {
    from { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

/* Light that travels along the card border. */
.panel::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--angle, 0deg),
        transparent 0deg, transparent 300deg,
        rgba(180, 255, 57, 0.55) 340deg, transparent 360deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    animation: border-spin 6s linear infinite;
    pointer-events: none;
}

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

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

.panel__head {
    position: relative;
    text-align: center;
}

.logo {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    border-radius: 14px;
    color: #0a1206;
    background: linear-gradient(135deg, var(--lime), var(--lime-2));
    animation:
        logo-in 0.6s var(--ease) 0.08s both,
        logo-pulse 3.4s ease-in-out 1s infinite;
}

@keyframes logo-in {
    from { opacity: 0; transform: scale(0.6) rotate(-12deg); }
    to   { opacity: 1; transform: none; }
}

@keyframes logo-pulse {
    0%, 100% { box-shadow: 0 10px 28px rgba(180, 255, 57, 0.22); }
    50%      { box-shadow: 0 10px 38px rgba(180, 255, 57, 0.45); }
}

.panel__head h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.02em;
    animation: fade-up 0.6s var(--ease) 0.14s both;
}

.panel__head h1 span {
    color: var(--lime);
}

.panel__head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13.5px;
    animation: fade-up 0.6s var(--ease) 0.2s both;
}

@keyframes fade-up {
    from { opacity: 0; transform: translate3d(0, 8px, 0); }
    to   { opacity: 1; transform: none; }
}

/* --- Progress ------------------------------------------------------------ */

.progress {
    position: relative;
    height: 4px;
    margin: 20px 0 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    animation: fade-up 0.6s var(--ease) 0.26s both;
}

.progress__bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--lime-2), var(--lime));
    box-shadow: 0 0 14px rgba(180, 255, 57, 0.6);
    transition: width 0.6s var(--ease);
}

.progress__bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: bar-shine 2.2s ease-in-out infinite;
}

@keyframes bar-shine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(200%); }
}

.progress.is-half .progress__bar { width: 50%; }
.progress.is-full .progress__bar { width: 100%; }

/* --- Tasks --------------------------------------------------------------- */

.flow {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.task {
    padding: 15px 15px 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    background: var(--card-2);
    transition:
        border-color 0.3s ease,
        opacity 0.3s ease,
        transform 0.3s var(--ease),
        box-shadow 0.3s ease;
}

.task:nth-child(1) { animation: fade-up 0.6s var(--ease) 0.3s both; }
.task:nth-child(2) { animation: fade-up 0.6s var(--ease) 0.38s both; }

.task.is-done {
    border-color: rgba(180, 255, 57, 0.3);
}

.task.is-muted {
    opacity: 0.5;
    transform: scale(0.985);
}

.task.is-muted:hover {
    opacity: 0.8;
}

.task__top {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 13px;
}

.task__num {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--lime-dim);
    color: var(--lime);
    font-size: 13px;
    font-weight: 700;
    transition: background 0.3s ease, color 0.3s ease, transform 0.4s var(--ease);
}

.task.is-done .task__num {
    background: var(--lime);
    color: #0a1206;
    transform: rotate(360deg);
}

.task__title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.task__title strong {
    font-size: 14.5px;
    font-weight: 650;
}

.task__title span {
    color: var(--dim);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 4px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    color: var(--dim);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    animation: chip-in 0.35s var(--ease);
}

@keyframes chip-in {
    from { opacity: 0; transform: translate3d(0, -4px, 0) scale(0.9); }
    to   { opacity: 1; transform: none; }
}

.chip--todo {
    border-color: rgba(180, 255, 57, 0.3);
    background: var(--lime-dim);
    color: var(--lime);
    animation: chip-in 0.35s var(--ease), chip-blink 2.4s ease-in-out 0.4s infinite;
}

@keyframes chip-blink {
    0%, 100% { box-shadow: 0 0 0 0 rgba(180, 255, 57, 0); }
    50%      { box-shadow: 0 0 0 4px rgba(180, 255, 57, 0.12); }
}

.chip--ok {
    border-color: rgba(180, 255, 57, 0.45);
    background: var(--lime);
    color: #0a1206;
}

.chip--bad {
    border-color: rgba(255, 107, 107, 0.4);
    background: rgba(255, 107, 107, 0.12);
    color: var(--err);
}

/* --- Input --------------------------------------------------------------- */

.input {
    position: relative;
    margin-bottom: 10px;
}

.input__at {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--dim);
    font-weight: 600;
    pointer-events: none;
    transition: color 0.2s ease;
}

.input:focus-within .input__at {
    color: var(--lime);
}

input[type="text"] {
    width: 100%;
    height: 46px;
    padding: 0 14px 0 32px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    background: #080d08;
    color: var(--text);
    font: inherit;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

input[type="text"]::placeholder {
    color: #4e5c48;
}

input[type="text"]:focus {
    border-color: var(--lime);
    background: #0a110a;
    box-shadow: 0 0 0 3px rgba(180, 255, 57, 0.16);
}

input.is-error {
    border-color: var(--err);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.14);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(5px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(2px); }
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 46px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    transition:
        transform 0.18s var(--ease),
        box-shadow 0.25s ease,
        filter 0.2s ease,
        opacity 0.2s ease;
}

.btn svg {
    transition: transform 0.25s var(--ease);
}

.btn:hover svg {
    transform: translate3d(2px, -2px, 0);
}

.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn--join,
.btn--main {
    color: #0a1206;
    background: linear-gradient(135deg, var(--lime), var(--lime-2));
    box-shadow: 0 10px 26px rgba(180, 255, 57, 0.2);
}

.btn--join:hover,
.btn--main:hover:not([disabled]) {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(180, 255, 57, 0.34);
    filter: brightness(1.05);
}

.btn--join:active,
.btn--main:active:not([disabled]) {
    transform: translateY(1px) scale(0.99);
    box-shadow: 0 6px 16px rgba(180, 255, 57, 0.22);
}

/* Light sweeping across the primary buttons. */
.btn--join::after,
.btn--main::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: translateX(-180%) skewX(-18deg);
    animation: sweep 4.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes sweep {
    0%, 62% { transform: translateX(-180%) skewX(-18deg); }
    88%     { transform: translateX(320%) skewX(-18deg); }
    100%    { transform: translateX(320%) skewX(-18deg); }
}

.btn--copy {
    width: auto;
    height: 40px;
    border-color: rgba(180, 255, 57, 0.35);
    background: transparent;
    color: var(--lime);
    font-size: 13.5px;
}

.btn--copy:hover {
    background: var(--lime-dim);
    transform: translateY(-1px);
}

.btn--copy:active {
    transform: translateY(1px);
}

.btn.is-loading {
    color: transparent;
}

.btn.is-loading::after {
    animation: none;
    opacity: 0;
}

.btn.is-loading::before {
    content: '';
    position: absolute;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(10, 18, 6, 0.3);
    border-top-color: #0a1206;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Messages and key ---------------------------------------------------- */

.msg {
    margin: 14px 0 0;
    text-align: center;
    font-size: 13.5px;
    color: var(--muted);
}

.msg:empty {
    margin: 0;
}

.msg.is-error {
    color: var(--err);
    animation: fade-up 0.3s var(--ease);
}

.msg.is-ok {
    color: var(--lime);
    animation: fade-up 0.3s var(--ease);
}

.key {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding: 15px;
    border: 1px solid rgba(180, 255, 57, 0.35);
    border-radius: var(--radius-sm);
    background: rgba(180, 255, 57, 0.07);
    animation: key-in 0.55s var(--ease) both;
}

@keyframes key-in {
    from { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.key__label {
    color: var(--lime);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.key__row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.key__row code {
    flex: 1 1 auto;
    padding: 11px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #080d08;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 14px;
    letter-spacing: 0.06em;
    word-break: break-all;
}

.key__hint {
    color: var(--dim);
    font-size: 12px;
}

.fine {
    margin: 18px 0 0;
    text-align: center;
    color: var(--dim);
    font-size: 11.5px;
    animation: fade-up 0.6s var(--ease) 0.46s both;
}

/* --- Small screens ------------------------------------------------------- */

@media (max-width: 420px) {
    .panel {
        padding: 24px 18px 18px;
    }

    .key__row {
        flex-direction: column;
        align-items: stretch;
    }

    .btn--copy {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
