body {
    margin: 0;
    background-color: black;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* =========================
   GLOBAL RESET
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =========================
   CANVAS BACKGROUND
========================= */
#matrix-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* =========================
   MAIN WRAPPER
========================= */
.ui-wrapper {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================
   TOOL CONTAINER
========================= */
.tool-box {
    width: 440px;
    padding: 20px 20px 40px 20px;
    border-radius: 20px;
    text-align: center;

    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
        linear-gradient(90deg, rgba(19, 122, 9, 0.25), rgba(7, 122, 7, 0.25));

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    border: 1px solid rgba(30, 255, 30, 0.35);
    box-shadow:
        0 0 25px rgba(19, 122, 9, 0.35),
        inset 0 0 18px rgba(19, 122, 9, 0.25);
    animation: fadeUp 0.8s ease;
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.btn-back {
    background: transparent;
    border: 1px solid #0f0;
    color: #0f0;
    border-radius: 8px;
    padding: 5px 15px;
    font-weight: 500;
    transition: 0.3s;
}

.btn-back:hover {
    background: #0f0;
    color: #000;
}

/* =========================
   TITLES
========================= */
.tool-title {
    font-size: 22px;
    font-weight: 700;
    color: #eaffea;
    text-shadow: 0 0 12px rgba(30, 255, 30, 0.6);
    margin-bottom: 8px;
}

.tool-subtitle {
    font-size: 14px;
    color: #9fe69f;
    margin-bottom: 20px;
    line-height: 1.5;
}

#syncModal {
    background-color: #000 !important;

}

/* =========================
   INPUT
========================= */
.custom-input {
    height: 52px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid rgba(30, 255, 30, 0.45);
    background: rgba(0, 0, 0, 0.45);
    color: #eaffea;
    font-size: 15px;

    box-shadow:
        inset 0 0 10px rgba(19, 122, 9, 0.4),
        0 0 10px rgba(19, 122, 9, 0.2);

    transition: all 0.25s ease;
}

.custom-input::placeholder {
    color: #88cc88;
}

.custom-input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.6);
    border-color: #2aff2a;
    box-shadow:
        0 0 0 3px rgba(30, 255, 30, 0.25),
        inset 0 0 12px rgba(30, 255, 30, 0.5);
    color: #ffffff;
}

/* =========================
   BUTTON
========================= */
.btn {
    position: relative;
    overflow: hidden;

    height: 54px;
    margin-top: 8px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    color: #0d2b0d;

    background: linear-gradient(180deg, #1a8f1a, #157815);

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.18),
        inset 0 1px 3px rgba(255, 255, 255, 0.25);

    animation: zoomPulse 2.8s ease-in-out infinite;
}

/* Shine layer */
.btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 120%;
    height: 100%;
    background: linear-gradient(120deg,
            transparent,
            rgba(255, 255, 255, 0.45),
            transparent);
    transform: skewX(-20deg);
    animation: shine 3.2s ease-in-out infinite;
}

/* Giữ chữ nổi */
.btn span {
    position: relative;
    z-index: 1;
}

/* Zoom to → bé */
@keyframes zoomPulse {
    0% {
        transform: scale(1);
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.18),
            inset 0 1px 3px rgba(255, 255, 255, 0.25);
    }

    40% {
        transform: scale(1.02);
        box-shadow:
            0 14px 32px rgba(0, 0, 0, 0.28),
            inset 0 2px 6px rgba(255, 255, 255, 0.35);
    }

    100% {
        transform: scale(1);
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.18),
            inset 0 1px 3px rgba(255, 255, 255, 0.25);
    }
}

/* Shine chạy ngang */
@keyframes shine {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Modal background & style */
.sync-modal {
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.05),
            rgba(0, 0, 0, 0.05)),
        linear-gradient(90deg, #137a09, #077a07);
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6);
    color: #fff;
    font-family: "Segoe UI", sans-serif;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    overflow: hidden;
}

/* Header */
.sync-modal .modal-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.sync-modal .modal-header .modal-title {
    font-size: 1.6rem;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
    color: #fff;
}

/* Body text */
.sync-modal .modal-body p {
    font-size: 1.1rem;
}

/* Progress bar */
.progress-custom {
    height: 30px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-custom .progress-bar {
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
    background: linear-gradient(90deg, #ffd700, #4efb4e);
    transition: width 0.2s ease-in-out;
}

/* Footer button */
.sync-modal .modal-footer .btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 0.4rem 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sync-modal .modal-footer .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Hover modal */
.sync-modal:hover {
    transform: scale(1.01);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.7);
}

/* Status text */
#syncStatus {
    font-style: italic;
    color: #f0f0f0;
}

.header-loading {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    font-weight: 700;
    font-size: 16px;
    color: #ffdb00;
    border: 1px solid #ffdb00;
    box-shadow: 0 0 10px #ffdb00;
    padding: 12px 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    user-select: none;
}

.header-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg,
            transparent,
            rgba(255, 219, 0, 0.6),
            transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}


.top-info {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Central robot image */
.robot-img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px #ff0000);
    user-select: none;
    animation: pulse 2s infinite;
}

/* Middle images and scan container */
.middle-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: stretch;
    margin-bottom: 20px;
    grid-template-columns: repeat(2, 1fr);
}

.middle-image {
    border-radius: 10px;
    box-shadow: 0 0 15px #0f0;
    border: 2px solid #0f0;
    user-select: none;
    object-fit: cover;
}

.middle-image img {
    border-radius: 10px;
    box-shadow: 0 0 15px #0f0;
    user-select: none;
    object-fit: cover;
}

/* Scanning text box */
.scan-box {
    border-radius: 10px;
    border: 2px solid #0f0;
    box-shadow: 0 0 15px #0f0 inset;
    user-select: none;
    position: relative;
    overflow: hidden;
}


/* Separator line */
.separator {
    height: 3px;
    border-radius: 10px;
    background: linear-gradient(90deg, #0f0, #ff0, #0f0);
    box-shadow: 0 0 20px #0f0, 0 0 40px #ff0;
    margin: 10px 0 5px 0;
}

.scan-box {
    background: linear-gradient(90deg, #137a09, #0fa30f, #077a07);
    background-size: 200% 200%;
    animation: gradientShift 2s ease infinite;
    color: #fff;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.scan-title {
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 1px;
    margin-bottom: 10px;

}

.scan-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
}

.scan-row strong {
    font-weight: 700;
}

.scan-status {
    margin-top: 5px;
    text-align: center;
    background: rgba(3, 3, 0, 0.5);
    padding: 8px 0;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
    color: #ffd700;
    text-shadow: 0 0 8px #ffd700;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Responsive */
@media (max-width: 576px) {
    .sync-modal .modal-header .modal-title {
        font-size: 1.3rem;
    }

    .sync-modal .modal-body p,
    .sync-modal .modal-footer .btn {
        font-size: 0.9rem;
    }

    .progress-custom {
        height: 22px;
    }
}