/* =============================================
   MODAL ĐĂNG KÝ
   ============================================= */

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

/* Chỉ áp dụng layout center cho trang moda.html standalone */

body.modal-standalone {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #1a0e08;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

input,
button {
    outline: none;
}

/* ── OVERLAY ───────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 999;
}

/* ── MODAL BOX ─────────────────────────────── */

.modal-box {
    position: relative;
    width: 520px;
    max-width: 100%;
    background: linear-gradient(180deg, #2a1c10 0%, #1e1208 60%, #1a100a 100%);
    border-radius: 12px;
    border: 2px solid #8c6d28;
    box-shadow: 0 0 0 1px #4a3810, 0 12px 50px rgba(0, 0, 0, 0.85);
    overflow: hidden;
}

/* ── HEADER ────────────────────────────────── */

.modal-header {
    position: relative;
    width: 100%;
    height: 68px;
    background: linear-gradient(180deg, #1c1306 0%, #120d04 100%);
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Họa tiết ca-rô full header */

.modal-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.09) 0, rgba(255, 255, 255, 0.09) 1.5px, transparent 1.5px, transparent 22px), repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.09) 0, rgba(255, 255, 255, 0.09) 1.5px, transparent 1.5px, transparent 22px);
    pointer-events: none;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.header-spade {
    color: #c9a84c;
    font-size: 24px;
    line-height: 1;
    filter: drop-shadow(0 0 5px rgba(201, 168, 76, 0.7));
}

.header-title {
    color: #e8c96a;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(232, 201, 106, 0.55), 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* ── NÚT X ─────────────────────────────────── */

.modal-close {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 56px;
    height: 56px;
    background: linear-gradient(145deg, #d94030 0%, #8c1a10 100%);
    border: none;
    border-radius: 0 10px 0 16px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    line-height: 1;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.5);
    transition: filter 0.15s;
}

.modal-close:hover {
    filter: brightness(1.15);
}

/* ── ĐƯỜNG KẺ VÀNG ──────────────────────────── */

.header-divider {
    width: 100%;
    height: 2px;
    background: linear-gradient( 90deg, transparent 0%, #6a4e18 8%, #d4a030 28%, #f5e070 50%, #d4a030 72%, #6a4e18 92%, transparent 100%);
    box-shadow: 0 0 8px 1px rgba(230, 180, 40, 0.45);
}

/* ── BODY ──────────────────────────────────── */

.modal-body {
    padding: 30px 42px 36px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── INPUT GROUP ───────────────────────────── */

.input-group {
    width: 100%;
    height: 52px;
    background: rgba(12, 7, 3, 0.78);
    border: 1px solid #3e2c1a;
    border-radius: 26px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    transition: border-color 0.2s;
}

.input-group:focus-within {
    border-color: #7a5c28;
}

.input-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.modal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #b08a5a;
    font-size: 16px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.modal-input::placeholder {
    color: #6b4e35;
}

/* ── CAPTCHA ROW ───────────────────────────── */

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

.captcha-input {
    flex: 1;
    min-width: 0;
}

.captcha-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.captcha-wrap canvas {
    border-radius: 6px;
    border: 1px solid #9a8060;
    display: block;
}

.captcha-refresh {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: transform 0.35s;
}

.captcha-refresh svg {
    width: 24px;
    height: 24px;
}

.captcha-refresh:hover {
    transform: rotate(180deg);
}

/* ── NÚT ĐĂNG KÝ ───────────────────────────── */

.btn-dangky {
    width: 220px;
    height: 52px;
    margin: 6px auto 0;
    display: block;
    background: linear-gradient(180deg, #f7d44a 0%, #e8a818 45%, #c87c10 100%);
    border: none;
    border-radius: 26px;
    color: #3a2005;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 3px;
    cursor: pointer;
    box-shadow: 0 4px 0 #8a5008, 0 6px 16px rgba(0, 0, 0, 0.55);
    transition: filter 0.15s, transform 0.1s, box-shadow 0.1s;
    text-shadow: 0 1px 0 rgba(255, 255, 200, 0.3);
}

.btn-dangky:hover {
    filter: brightness(1.08);
}

.btn-dangky:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #8a5008, 0 2px 8px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    .modal-overlay {
        align-items: center;
        padding: 12px 10px;
    }
    .modal-box {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 24px);
        margin: 0 auto;
    }
    .modal-header {
        height: 62px;
    }
    .header-inner {
        gap: 10px;
    }
    .header-title {
        font-size: 21px;
        letter-spacing: 2.5px;
    }
    .modal-close {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    .modal-body {
        padding: 20px 16px 22px;
        gap: 12px;
        overflow-y: auto;
        max-height: calc(100dvh - 110px);
    }
    .input-group {
        height: 48px;
        padding: 0 14px;
        gap: 10px;
    }
    .btn-dangky {
        width: 100%;
        height: 50px;
        margin-top: 2px;
        letter-spacing: 2px;
    }
    .captcha-row {
        flex-wrap: nowrap;
        gap: 8px;
    }
    .captcha-input {
        width: auto;
        flex: 0 1 48%;
        min-width: 0;
    }
    .captcha-wrap {
        width: auto;
        flex: 1 1 auto;
        justify-content: flex-start;
        gap: 6px;
    }
}

@media (max-width: 420px) {
    .modal-overlay {
        padding: 10px 8px;
    }
    .modal-box {
        width: calc(100vw - 16px);
        border-radius: 10px;
    }
    .modal-header {
        height: 58px;
    }
    .header-title {
        font-size: 18px;
        letter-spacing: 2px;
    }
    .header-spade {
        font-size: 18px;
    }
    .modal-body {
        padding: 16px 12px 18px;
        gap: 10px;
    }
    .input-group {
        height: 46px;
        border-radius: 23px;
    }
    .modal-input {
        font-size: 15px;
    }
}