@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

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

:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --accent: #FD79A8;
    --success: #00B894;
    --danger: #E17055;
    --bg: #F0F2F5;
    --bg-card: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --text-muted: #B2BEC3;
    --border: #DFE6E9;
    --radius: 20px;
    --radius-sm: 12px;
    --input-bg: #FFFFFF;
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --bg-card: #16213e;
    --text: #e0e0e0;
    --text-light: #a0a0b0;
    --text-muted: #6a6a80;
    --border: #2a2a4a;
    --input-bg: #1e2a45;
}

[data-theme="dark"] .join-card {
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

[data-theme="dark"] .form-group input[type="text"] {
    background: var(--input-bg);
    color: var(--text);
}

[data-theme="dark"] .stats-card {
    background: linear-gradient(135deg, rgba(108,92,231,0.15), rgba(253,121,168,0.15));
    border-color: rgba(108,92,231,0.3);
}

.join-top-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.lang-select {
    padding: 6px 8px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.lang-select:focus {
    border-color: var(--primary);
}

[data-theme="dark"] .lang-select {
    background: var(--input-bg);
}

#joinBgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.join-root { width: 100%; max-width: 440px; position: relative; z-index: 1; }

.join-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    padding: 40px 32px;
    text-align: center;
}

.join-logo {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.join-card h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
}

.join-desc {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 28px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-light);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 17px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input[type="text"]:focus { border-color: var(--primary); }

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
}
.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.hp-field { position: absolute; left: -9999px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-lg {
    width: 100%;
    padding: 16px 28px;
    font-size: 18px;
    margin-top: 8px;
    min-height: 56px;
}

.join-status {
    margin-top: 20px;
    padding: 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 16px;
    transition: background 0.4s, color 0.4s, border-color 0.4s, box-shadow 0.4s, transform 0.3s;
    border: 2px solid transparent;
    text-align: center;
}
.join-status:empty { display: none; }

.status-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.pulse-icon {
    display: inline-block;
    animation: pulseIcon 1.2s ease-in-out infinite;
}

.bounce-icon {
    display: inline-block;
    animation: bounceIcon 0.6s ease-in-out infinite alternate;
}

.join-status.success {
    background: rgba(0,184,148,0.12);
    color: var(--success);
    border-color: rgba(0,184,148,0.3);
    box-shadow: 0 0 15px rgba(0,184,148,0.15);
}

.join-status.connecting {
    background: rgba(108,92,231,0.1);
    color: var(--primary);
    border-color: rgba(108,92,231,0.3);
    animation: statusPulse 2s ease-in-out infinite;
}

.join-status.reconnecting {
    background: rgba(253,203,110,0.15);
    color: #e67e22;
    border-color: rgba(253,203,110,0.4);
    animation: statusPulse 1.5s ease-in-out infinite;
}

.join-status.approved {
    background: linear-gradient(135deg, rgba(108,92,231,0.12), rgba(253,121,168,0.12));
    color: var(--primary);
    border-color: rgba(108,92,231,0.4);
    box-shadow: 0 0 20px rgba(108,92,231,0.2);
    animation: statusGlow 2s ease-in-out infinite;
}

.join-status.selected {
    background: linear-gradient(135deg, rgba(253,203,110,0.2), rgba(253,121,168,0.15));
    color: #e67e22;
    border-color: rgba(253,203,110,0.5);
    box-shadow: 0 0 25px rgba(253,203,110,0.3);
    animation: statusGlow 1s ease-in-out infinite;
}

.join-status.go {
    background: linear-gradient(135deg, rgba(0,184,148,0.2), rgba(85,239,196,0.2));
    color: var(--success);
    border-color: rgba(0,184,148,0.5);
    box-shadow: 0 0 30px rgba(0,184,148,0.3);
    animation: statusGlow 0.5s ease-in-out infinite;
    transform: scale(1.03);
}

.join-status.error {
    background: rgba(225,112,85,0.12);
    color: var(--danger);
    border-color: rgba(225,112,85,0.4);
    box-shadow: 0 0 15px rgba(225,112,85,0.15);
}

.status-flash {
    animation: flashAnim 0.6s ease-out !important;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes statusGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(108,92,231,0.15); }
    50% { box-shadow: 0 0 30px rgba(108,92,231,0.35); }
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes bounceIcon {
    0% { transform: translateY(0); }
    100% { transform: translateY(-6px); }
}

@keyframes flashAnim {
    0% { transform: scale(1); }
    30% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.stats-card {
    margin-top: 20px;
    background: linear-gradient(135deg, rgba(108,92,231,0.08), rgba(253,121,168,0.08));
    border: 2px solid rgba(108,92,231,0.2);
    border-radius: var(--radius-sm);
    padding: 20px;
}
.stats-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 14px;
    text-align: center;
}
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}
.stat-item { text-align: center; }
.stat-value {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    word-break: break-word;
}
.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    margin-top: 2px;
}
