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

:root {
    --bg-glass: rgba(15, 15, 30, 0.65);
    --bg-glass-light: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.4);
    --success: #00e676;
    --danger: #ff5252;
    --radius: 20px;
    --radius-sm: 12px;
}

html,
body {
    height: 100%;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a1a;
    color: var(--text-primary);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ── Background ───────────────────────────────── */
.bg-blur {
    position: fixed;
    inset: 0;
    background: url('/static/bg.jpg?v=3') center/cover no-repeat;
    filter: blur(6px) brightness(0.6);
    transform: scale(1.05);
    z-index: 0;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(10, 10, 26, 0.3) 0%,
            rgba(10, 10, 26, 0.55) 100%);
    z-index: 1;
}

/* ── Screens ──────────────────────────────────── */
.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Glassmorphic Card ────────────────────────── */
.card {
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 56px 20px;
    width: 100%;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ── Typography ───────────────────────────────── */
.emoji-hero {
    font-size: 56px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.final-steps-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 14px;
    letter-spacing: 0.3px;
    animation: badgeGlow 2s ease-in-out infinite;
}

@keyframes badgeGlow {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(255, 215, 0, 0.2);
    }

    50% {
        box-shadow: 0 0 14px rgba(255, 215, 0, 0.5);
    }
}

.phone-number {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    margin-top: 8px;
    letter-spacing: 1px;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6c63ff 0%, #5a52d5 100%);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 28px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass-light);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-icon {
    font-size: 20px;
}

.btn-code-link {
    margin-bottom: 20px;
    text-decoration: none;
    font-size: 15px;
    background: linear-gradient(135deg, #0288d1 0%, #01579b 100%);
    box-shadow: 0 4px 15px rgba(2, 136, 209, 0.4);
}

.btn-code-link:hover {
    box-shadow: 0 6px 20px rgba(2, 136, 209, 0.6);
}

.pointer-hand {
    font-size: 18px;
    display: inline-block;
}

.pointer-hand.right {
    animation: pointRight 1s infinite alternate;
}

.pointer-hand.left {
    animation: pointLeft 1s infinite alternate;
}

@keyframes pointRight {
    0% {
        transform: translateX(-4px);
    }

    100% {
        transform: translateX(4px);
    }
}

@keyframes pointLeft {
    0% {
        transform: translateX(4px);
    }

    100% {
        transform: translateX(-4px);
    }
}

/* ── Loading Screen ───────────────────────────── */
.loader-container {
    text-align: center;
}

.loader-icon {
    font-size: 48px;
    margin-bottom: 32px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

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

    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }
}

.loader-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 240px;
    margin: 0 auto 24px;
}

.loader-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.loader-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    border-radius: 3px;
    animation: loadBar 1s ease-out forwards;
}

@keyframes loadBar {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

.loader-text {
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* ── Spinner ──────────────────────────────────── */
.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 24px;
    border: 3px solid var(--bg-glass-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Video Grid Loading ───────────────────────── */
.screen-fullgrid {
    flex-direction: column;
    padding: 0;
    background: #0a0a0f;
    align-items: stretch;
    justify-content: flex-start;
}

.grid-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px 10px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.grid-title {
    letter-spacing: 0.3px;
}

.grid-dots span {
    animation: dotBlink 1.2s infinite;
    font-size: 18px;
    font-weight: 900;
}

.grid-dots span:nth-child(1) {
    animation-delay: 0s;
}

.grid-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.grid-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBlink {

    0%,
    80%,
    100% {
        opacity: 0.2;
    }

    40% {
        opacity: 1;
    }
}

.video-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 8px;
    overflow: hidden;
    align-content: start;
}

.video-thumb {
    aspect-ratio: 9/13;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.85) translateY(16px);
    animation: thumbPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Unique gradient per variant */
.vt-1 {
    background: linear-gradient(160deg, #1a0533 0%, #6d1a6b 60%, #b83280 100%);
}

.vt-2 {
    background: linear-gradient(160deg, #0d1b3e 0%, #1a3a6b 60%, #2d6abf 100%);
}

.vt-3 {
    background: linear-gradient(160deg, #0d2e1a 0%, #1a5c33 60%, #27ae60 100%);
}

.vt-4 {
    background: linear-gradient(160deg, #2e1a00 0%, #7a3d00 60%, #d4621a 100%);
}

.vt-5 {
    background: linear-gradient(160deg, #1a001a 0%, #4a004a 60%, #990099 100%);
}

.vt-6 {
    background: linear-gradient(160deg, #001a2e 0%, #00416a 60%, #0077b6 100%);
}

/* Scan-line shimmer */
.video-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.07) 50%,
            transparent 100%);
    transform: translateX(-100%);
    animation: scanLine 2.5s ease-in-out infinite;
    animation-delay: inherit;
}

/* Gradient overlay at bottom */
.video-thumb::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
}

.vt-play {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    padding-left: 3px;
    z-index: 1;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.vt-dur {
    position: absolute;
    bottom: 6px;
    right: 7px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 1px 4px;
    border-radius: 3px;
    z-index: 2;
    letter-spacing: 0.3px;
}

.vt-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 14px;
    z-index: 2;
}

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

@keyframes scanLine {
    0% {
        transform: translateX(-100%);
    }

    60%,
    100% {
        transform: translateX(200%);
    }
}

.grid-footer {
    padding: 10px 16px 20px;
    flex-shrink: 0;
}

.grid-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.grid-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff4081, #e040fb, #7c4dff);
    border-radius: 2px;
    animation: gridLoad 4s linear forwards;
}

@keyframes gridLoad {
    0% {
        width: 0%;
    }

    100% {
        width: 95%;
    }
}

.grid-status {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    letter-spacing: 0.3px;
}

/* ── OTP Display ──────────────────────────────── */
.otp-display {
    margin-bottom: 24px;
}

.otp-digits {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.otp-digit {
    width: 44px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-light);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-sm);
    font-size: 24px;
    font-weight: 700;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.otp-digit.filled {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.1);
}

.otp-digit.current {
    border-color: var(--accent);
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        border-color: var(--accent);
    }

    50% {
        border-color: transparent;
    }
}

/* ── Dial Pad ─────────────────────────────────── */
.dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 280px;
    margin: 0 auto 20px;
}

.dial-btn {
    aspect-ratio: 1.6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.dial-btn:active {
    background: rgba(108, 99, 255, 0.2);
    border-color: var(--accent);
    transform: scale(0.93);
}

.dial-btn-empty {
    visibility: hidden;
}

.dial-btn-delete {
    font-size: 20px;
    color: var(--text-secondary);
}

.delete-icon {
    color: var(--danger);
    font-size: 20px;
}

.otp-digit.verifying {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.2);
    animation: blink 0.4s ease-in-out infinite;
}

/* ── 2FA Input ────────────────────────────────── */
.input-group {
    margin-bottom: 20px;
}

.input {
    width: 100%;
    padding: 16px;
    background: var(--bg-glass-light);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease;
}

.input:focus {
    border-color: var(--accent);
}

.input::placeholder {
    color: var(--text-secondary);
}

/* ── Success ──────────────────────────────────── */
.success-check {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
}

.checkmark {
    width: 72px;
    height: 72px;
}

.checkmark-circle {
    stroke: var(--success);
    stroke-width: 2;
    stroke-dasharray: 160;
    stroke-dashoffset: 160;
    animation: circleAnim 0.6s ease-out 0.2s forwards;
}

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

.checkmark-check {
    stroke: var(--success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkAnim 0.4s ease-out 0.6s forwards;
}

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

.session-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
    max-height: 120px;
    overflow-y: auto;
    word-break: break-all;
}

.session-box code {
    font-size: 12px;
    color: var(--success);
    line-height: 1.6;
    font-family: 'Courier New', monospace;
}

/* ── Toast ────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--danger);
    color: #fff;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 100;
    transition: transform 0.35s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(255, 82, 82, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.hidden {
    transform: translateX(-50%) translateY(100px);
}