/* ============ 全局样式 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

.container {
    max-width: 420px;
    margin: 60px auto;
    padding: 20px;
}

/* ============ 按钮 ============ */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: 2px solid #4a90d9;
    background: #4a90d9;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    background: #357abd;
    border-color: #357abd;
}

.btn-primary {
    background: #4CAF50;
    border-color: #4CAF50;
}

.btn-primary:hover {
    background: #388E3C;
    border-color: #388E3C;
}

.btn-danger {
    background: #f44336;
    border-color: #f44336;
}

.btn-danger:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

.btn-outline {
    background: transparent;
    color: #4a90d9;
}

.btn-outline:hover {
    background: rgba(74, 144, 217, 0.1);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 40px;
    font-size: 18px;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============ 表单 ============ */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 14px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: rgba(74, 144, 217, 0.3);
    color: #fff;
    font-weight: 600;
}

.auth-form {
    display: none;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 32px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 28px;
    color: #fff;
    font-weight: 500;
}

.form-group {
    margin-bottom: 16px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 15px;
    transition: border-color 0.3s;
    outline: none;
}

.form-group input:focus {
    border-color: #4a90d9;
    background: rgba(255,255,255,0.1);
}

.form-group input::placeholder {
    color: #666;
}

.error-msg {
    color: #f44336;
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.auth-form .btn {
    width: 100%;
    margin-top: 8px;
}

/* ============ 统一弹窗 ============ */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.custom-modal {
    background: linear-gradient(145deg, #1e2a3a, #253548);
    border-radius: 20px;
    padding: 32px 28px 24px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.12);
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: slideUp 0.25s ease;
}

.custom-modal .modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.custom-modal h2 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 8px;
    font-weight: 600;
}

.custom-modal p {
    color: #aaa;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-line;
}

.custom-modal .modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.custom-modal .modal-buttons .btn {
    min-width: 90px;
    padding: 10px 24px;
    font-size: 14px;
}

.custom-modal .btn-cancel {
    background: transparent;
    border-color: rgba(255,255,255,0.2);
    color: #aaa;
}

.custom-modal .btn-cancel:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.3);
}

/* ============ 游戏结果弹窗（保留兼容） ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #1e2a3a;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 400px;
    width: 90%;
}

.modal h2 {
    color: #fff;
    margin-bottom: 12px;
}

.modal p {
    color: #aaa;
    margin-bottom: 24px;
}

/* ============ Spinner ============ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ 主题动画工具（供各游戏页复用） ============ */
@keyframes auroraShift {
    0%   { background-position: 0% 0%, 100% 100%, 50% 0%, 0% 100%; }
    50%  { background-position: 100% 50%, 0% 50%, 50% 100%, 100% 0%; }
    100% { background-position: 0% 0%, 100% 100%, 50% 0%, 0% 100%; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
    body[class*="theme-"]::before,
    body[class*="theme-"]::after { animation: none !important; }
    body[class*="theme-"] .game-card,
    body[class*="theme-"] .game-icon,
    body[class*="theme-"] .home-header,
    body[class*="theme-"] .lobby-header,
    body[class*="theme-"] .match-card,
    body[class*="theme-"] .info-card,
    body[class*="theme-"] .flight-header,
    body[class*="theme-"] .lobby-panel,
    body[class*="theme-"] .waiting-panel,
    body[class*="theme-"] .color-option,
    body[class*="theme-"] .game-header { animation: none !important; }
}
