/* ── Reset & Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Noto Sans Thai', sans-serif;
    background: #0a0f1a;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* ── Loading Screen ── */
#loadingScreen {
    position: fixed; inset: 0; z-index: 9999;
    background: radial-gradient(ellipse at 50% 38%, #0d2240 0%, #050d1a 100%);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; transition: opacity 0.9s ease;
}
#loadingScreen.ls-out { opacity: 0; pointer-events: none; }

.ls-orb {
    position: absolute; border-radius: 50%;
    filter: blur(70px);
    animation: ls-orb-drift 9s ease-in-out infinite;
    pointer-events: none;
}
.ls-orb-1 {
    width: 480px; height: 480px;
    background: radial-gradient(circle, rgba(26,95,204,0.32) 0%, transparent 70%);
    top: -130px; left: -100px;
}
.ls-orb-2 {
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(74,158,255,0.22) 0%, transparent 70%);
    bottom: -90px; right: -70px;
    animation-delay: -4.5s;
}
.ls-corner {
    position: absolute; width: 44px; height: 44px;
    border: 1.5px solid rgba(74,158,255,0.55);
}
.ls-tl { top: 22px; left: 22px; border-right: none; border-bottom: none; }
.ls-tr { top: 22px; right: 22px; border-left: none; border-bottom: none; }
.ls-bl { bottom: 22px; left: 22px; border-right: none; border-top: none; }
.ls-br { bottom: 22px; right: 22px; border-left: none; border-top: none; }
.ls-scan {
    position: absolute; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(74,158,255,0.5), rgba(135,206,235,0.7), rgba(74,158,255,0.5), transparent);
    animation: ls-scan 5s linear infinite;
    pointer-events: none;
}
.ls-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 28px;
}
.ls-logo-wrap {
    position: relative; display: inline-block; overflow: hidden;
    animation: logo-float 4.5s ease-in-out infinite;
    filter: drop-shadow(0 0 18px rgba(74,158,255,0.5)) drop-shadow(0 0 36px rgba(74,158,255,0.2));
}
.ls-logo-wrap::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 25%, rgba(255,255,255,0.15) 42%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,0.15) 58%, transparent 75%);
    background-size: 300% 100%;
    -webkit-mask-image: url('../images/logo.png');
    mask-image: url('../images/logo.png');
    -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    animation: ls-shimmer 3.2s ease-in-out infinite;
    pointer-events: none;
}
.ls-logo { display: block; max-width: 400px; }
.ls-bar-track {
    width: 380px; height: 8px;
    background: rgba(135,206,235,0.08);
    border: 1px solid rgba(135,206,235,0.22);
    border-radius: 99px; overflow: hidden;
    box-shadow: 0 0 14px rgba(74,144,226,0.12);
}
.ls-bar-fill {
    height: 100%; width: 0%; border-radius: 99px;
    background: linear-gradient(90deg, #1246a8, #2e7fff, #87ceeb);
    box-shadow: 0 0 10px rgba(74,158,255,0.8), 0 0 22px rgba(74,158,255,0.35);
    transition: width 0.12s linear;
    position: relative; overflow: hidden;
}
.ls-bar-shine {
    position: absolute; top: 0; left: 0; width: 38%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.65), transparent);
    animation: ls-bar-shine 1.6s ease-in-out infinite;
}
.ls-info { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ls-percent {
    font-size: 18px; font-weight: 600; color: #87ceeb;
    text-shadow: 0 0 12px rgba(74,158,255,0.6);
    font-family: 'Courier New', monospace;
}
.ls-label { font-size: 13px; color: rgba(135,206,235,0.65); letter-spacing: 2px; }

@keyframes ls-orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.1); }
}
@keyframes ls-scan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}
@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes ls-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes ls-bar-shine {
    0% { left: -38%; }
    100% { left: 138%; }
}

/* ── Background ── */
.reg-bg {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0a0f1a 0%, #0f172a 50%, #0a0f1a 100%);
    z-index: -1;
}
.reg-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(37,99,235,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(59,130,246,0.06) 0%, transparent 50%);
}

/* ── Container ── */
.reg-container {
    width: 100%;
    max-width: 1000px;
    padding: 20px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Card ── */
.reg-card {
    background: linear-gradient(145deg, #0f172a 0%, #0e1d35 100%);
    border: 1px solid rgba(59,130,246,0.15);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.5),
        0 0 40px rgba(37,99,235,0.1);
    max-width: 1000px;
    width: 100%;
}

/* ── Logo ── */
.reg-logo {
    text-align: center;
    margin-bottom: 24px;
}
.reg-logo img {
    height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(59,130,246,0.4));
}

/* ── Title ── */
.reg-title {
    text-align: center;
    color: #f1f5f9;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 0 30px rgba(59,130,246,0.3);
}
.reg-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 32px;
}

/* ── Form ── */
.reg-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Form Grid ── */
.reg-form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* ── Full Width Field ── */
.reg-field-full {
    width: 100%;
}

/* ── Row for Gender & Birthdate ── */
.reg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .reg-row {
        grid-template-columns: 1fr;
    }
}

/* ── Half Field ── */
.reg-field-half {
    margin: 0;
}

/* ── Field ── */
.reg-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.reg-label {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
}

/* ── Input ── */
.reg-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.reg-icon {
    position: absolute;
    left: 14px;
    color: #475569;
    font-size: 14px;
    pointer-events: none;
    transition: color 0.3s;
}
.reg-input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 14px 14px 14px 42px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
}
.reg-input::placeholder {
    color: #475569;
}
.reg-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.reg-input:focus + .reg-icon,
.reg-input:focus ~ .reg-icon {
    color: #3b82f6;
}

/* ── Password Strength Indicator ── */
.reg-strength-bar {
    width: 100%;
    height: 4px;
    background: #334155;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.reg-strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}
.reg-strength-fill.weak {
    width: 33%;
    background: #ef4444;
}
.reg-strength-fill.medium {
    width: 66%;
    background: #f59e0b;
}
.reg-strength-fill.strong {
    width: 100%;
    background: #10b981;
}
.reg-strength-text {
    font-size: 11px;
    margin-top: 4px;
    min-height: 16px;
}
.reg-strength-text.weak {
    color: #fca5a5;
}
.reg-strength-text.medium {
    color: #fcd34d;
}
.reg-strength-text.strong {
    color: #6ee7b7;
}

/* ── CAPTCHA ── */
.reg-captcha-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.reg-captcha-img {
    width: 150px;
    height: 50px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
}
.reg-captcha-refresh {
    width: 50px;
    height: 50px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.reg-captcha-refresh:hover {
    background: #334155;
    color: #94a3b8;
    border-color: #475569;
}
.reg-captcha-refresh:active {
    transform: scale(0.95);
}
.reg-captcha-refresh i {
    font-size: 20px;
}

/* ── Gender ── */
.reg-gender-wrap {
    display: flex;
    gap: 12px;
}
.reg-gender-option {
    flex: 1;
    cursor: pointer;
}
.reg-gender-option input {
    display: none;
}
.reg-gender-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    color: #64748b;
    font-size: 14px;
    transition: all 0.3s;
}
.reg-gender-option input:checked + .reg-gender-label {
    background: rgba(59,130,246,0.1);
    border-color: #3b82f6;
    color: #3b82f6;
}
.reg-gender-option:hover .reg-gender-label {
    border-color: #475569;
}

/* ── Birthdate Select ── */
.reg-birth-wrap {
    display: flex;
    gap: 10px;
}
.reg-select {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
}
.reg-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.reg-select option {
    background: #0f172a;
    color: #e2e8f0;
}

/* ── Terms ── */
.reg-terms-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}
.reg-terms-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #3b82f6;
    cursor: pointer;
}
.reg-terms-text {
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}
.reg-terms-link {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    transition: color 0.3s;
}
.reg-terms-link:hover {
    color: #60a5fa;
}

/* ── Submit Button ── */
.reg-submit {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 14px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}
.reg-submit-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 20px rgba(37,99,235,0.3);
}
.reg-submit-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(37,99,235,0.4);
}
.reg-submit-secondary {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 4px 20px rgba(71,85,105,0.3);
}
.reg-submit-secondary:hover {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(71,85,105,0.4);
}
.reg-submit:active:not(:disabled) {
    transform: translateY(0);
}
.reg-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Buttons Container ── */
.reg-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── Error Message ── */
.reg-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px;
    padding: 12px;
    color: #fca5a5;
    font-size: 13px;
    text-align: center;
}
.reg-error.hidden {
    display: none;
}

/* ── Footer ── */
.reg-footer {
    text-align: center;
    margin-top: 24px;
}
.reg-footer-sep {
    color: #334155;
    margin: 0 8px;
}
.reg-back-link {
    color: #64748b;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s;
}
.reg-back-link:hover {
    color: #94a3b8;
}

/* ── Modal ── */
.reg-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.reg-modal.hidden {
    display: none;
}
.reg-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}
.reg-modal-content {
    position: relative;
    background: linear-gradient(145deg, #0f172a 0%, #0e1d35 100%);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0,0,0,0.6);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ── Modal Header ── */
.reg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(59,130,246,0.15);
}
.reg-modal-header h2 {
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.reg-modal-header h2 i {
    color: #3b82f6;
}
.reg-modal-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s;
}
.reg-modal-close:hover {
    color: #94a3b8;
}

/* ── Modal Body ── */
.reg-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.reg-terms-content {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.7;
}
.reg-terms-content h3 {
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 8px;
}
.reg-terms-content h3:first-child {
    margin-top: 0;
}
.reg-terms-content p {
    color: #94a3b8;
    margin-bottom: 12px;
}

/* ── Modal Footer ── */
.reg-modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(59,130,246,0.15);
}
.reg-modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}
.reg-modal-btn-accept {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
}
.reg-modal-btn-accept:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.reg-modal-btn-decline {
    background: #334155;
    color: #94a3b8;
}
.reg-modal-btn-decline:hover {
    background: #475569;
    color: #e2e8f0;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .reg-container {
        padding: 16px;
    }
    .reg-card {
        padding: 30px 20px;
    }
    .reg-title {
        font-size: 24px;
    }
    .reg-birth-wrap {
        flex-direction: column;
    }
    .reg-modal-content {
        max-height: 90vh;
    }
}
