:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-light: #60a5fa;
    --blue-soft: #eff6ff;
    --bg: #f4f7fc;
    --surface: #ffffff;
    --surface-alt: #f8faff;
    --text: #172033;
    --text-secondary: #64748b;
    --border: #dbe3ef;
    --shadow: 0 20px 50px rgba(37, 99, 235, 0.12);
    --danger: #dc2626;
    --success: #16a34a;
    --radius: 18px;
    --transition: 0.25s ease;
}

[data-theme="dark"] {
    --blue: #3b82f6;
    --blue-dark: #2563eb;
    --blue-light: #60a5fa;
    --blue-soft: #172554;
    --bg: #050914;
    --surface: #0b1220;
    --surface-alt: #111a2b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #1e3a5f;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --danger: #f87171;
    --success: #4ade80;
}

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

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 18px;
    background:
        radial-gradient(circle at 10% 10%, rgba(37, 99, 235, 0.12), transparent 28%),
        radial-gradient(circle at 90% 90%, rgba(37, 99, 235, 0.1), transparent 30%),
        var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    transition:
        background-color var(--transition),
        color var(--transition);
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(2px);
}

body::before {
    width: 260px;
    height: 260px;
    top: -100px;
    right: -80px;
    background: rgba(37, 99, 235, 0.12);
    animation: floatOne 8s ease-in-out infinite;
}

body::after {
    width: 220px;
    height: 220px;
    bottom: -100px;
    left: -70px;
    background: rgba(59, 130, 246, 0.1);
    animation: floatTwo 10s ease-in-out infinite;
}

.container {
    width: 100%;
    max-width: 430px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: containerIn 0.6s ease both;
}

.box {
    width: 100%;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition:
        background-color var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
    animation: boxIn 0.5s ease both;
}

.box:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 60px rgba(37, 99, 235, 0.16);
}

.box h2 {
    margin-bottom: 24px;
    color: var(--text);
    font-size: 25px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.box h2::after {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    margin: 12px auto 0;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
}

.box input:not([type="hidden"]) {
    width: 100%;
    height: 52px;
    margin-bottom: 14px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--surface-alt);
    color: var(--text);
    font-size: 15px;
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        background-color var(--transition),
        transform var(--transition);
}

.box input:not([type="hidden"])::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

.box input:not([type="hidden"]):hover {
    border-color: var(--blue-light);
}

.box input:not([type="hidden"]):focus {
    border-color: var(--blue);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.box button {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 12px;
    padding: 0 20px;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        filter var(--transition),
        opacity var(--transition);
}

.box button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.34);
    filter: brightness(1.05);
}

.box button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.22);
}

.box button:focus-visible {
    outline: 3px solid rgba(96, 165, 250, 0.45);
    outline-offset: 3px;
}

.box button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
    transform: none;
}

#codigo {
    text-align: center;
    font-size: 23px !important;
    font-weight: 700;
    letter-spacing: 6px;
    text-transform: uppercase;
}

#codigo::placeholder {
    letter-spacing: 5px;
}

.password-box {
    position: relative;
    width: 100%;
}

.password-box input {
    padding-right: 52px !important;
}

.password-box i {
    position: absolute;
    top: 50%;
    right: 17px;
    z-index: 2;
    color: var(--text-secondary);
    font-size: 17px;
    cursor: pointer;
    transform: translateY(-50%);
    transition:
        color var(--transition),
        transform var(--transition);
}

.password-box i:hover {
    color: var(--blue);
    transform: translateY(-50%) scale(1.08);
}

.password-box + .password-box {
    margin-top: 2px;
}

#timer {
    display: block;
    min-height: 18px;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    line-height: 18px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 10, 24, 0.65);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    animation: modalOverlayIn 0.25s ease both;
}

.modal-box {
    width: 100%;
    max-width: 390px;
    padding: 30px 26px 26px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.28);
    animation: modalIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal-box i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    font-size: 27px;
    animation: iconPop 0.5s 0.1s ease both;
}

.modal-box p {
    margin-bottom: 22px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

.modal-box button {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
    transition:
        transform var(--transition),
        box-shadow var(--transition);
}

.modal-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.35);
}

.modal-box.error {
    border-top: 4px solid var(--danger);
}

.modal-box.error i {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.modal-box.success {
    border-top: 4px solid var(--success);
}

.modal-box.success i {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

@keyframes containerIn {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes boxIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes iconPop {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-15deg);
    }

    70% {
        transform: scale(1.08) rotate(3deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes floatOne {
    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-20px, 25px);
    }
}

@keyframes floatTwo {
    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(20px, -20px);
    }
}

@media (max-width: 600px) {
    body {
        padding: 20px 14px;
    }

    .container {
        max-width: 100%;
    }

    .box {
        padding: 27px 22px;
        border-radius: 16px;
    }

    .box h2 {
        font-size: 22px;
        margin-bottom: 21px;
    }

    .box input:not([type="hidden"]) {
        height: 50px;
        font-size: 14px;
    }

    .box button {
        min-height: 50px;
        font-size: 14px;
    }

    #codigo {
        font-size: 21px !important;
        letter-spacing: 5px;
    }

    .modal-box {
        max-width: 100%;
        padding: 27px 21px 22px;
        border-radius: 16px;
    }
}

@media (max-width: 380px) {
    body {
        padding: 14px 10px;
    }

    .box {
        padding: 23px 17px;
    }

    .box h2 {
        font-size: 20px;
    }

    #codigo {
        font-size: 19px !important;
        letter-spacing: 4px;
    }

    .modal-overlay {
        padding: 12px;
    }
}

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