/* ============================================================
   联机五子棋 - 样式表（重构版）
   模块：基础 / 主题 / 通用组件 / 登录 / 大厅 / 游戏 / 等待 / 编辑资料 / 响应式
   ============================================================ */

/* ========== 1. 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 输入框内容允许选中 */
input, textarea, [contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
}

html, body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    transition: background 0.6s ease;
    background: var(--bg-body, #1a1a2e);
    color: var(--text-primary, #fff);
}

.hidden {
    display: none !important;
}

.required {
    color: #ff4d6d;
    font-weight: 700;
    margin-left: 2px;
}

/* ========== 2. 主题变量（仅影响游戏页面棋盘区域） ========== */
body[data-theme="wood"] {
    --bg-body: linear-gradient(135deg, #8b6f47 0%, #6b4f2a 100%);
    --bg-container: rgba(255, 248, 235, 0.85);
    --border-container: rgba(139, 111, 71, 0.3);
    --text-primary: #3d2b1f;
    --text-secondary: #6b4f2a;
    --bg-status: rgba(212, 180, 140, 0.4);
    --border-status: rgba(139, 111, 71, 0.25);
    --bg-board: #d4b48c;
    --border-board: rgba(139, 111, 71, 0.4);
    --board-line: #5c4033;
    --bg-chat: rgba(255, 248, 235, 0.6);
    --border-chat: rgba(139, 111, 71, 0.2);
    --bg-input: rgba(255, 255, 255, 0.7);
    --border-input: rgba(139, 111, 71, 0.3);
    --text-input: #3d2b1f;
    --placeholder-input: rgba(61, 43, 31, 0.4);
    --btn-send-bg: #8b6f47;
    --btn-send-text: #fff;
}

body[data-theme="dark"] {
    --bg-body: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    --bg-container: rgba(45, 45, 45, 0.9);
    --border-container: rgba(255, 255, 255, 0.08);
    --text-primary: #e0e0e0;
    --text-secondary: #999;
    --bg-status: rgba(60, 60, 60, 0.6);
    --border-status: rgba(255, 255, 255, 0.08);
    --bg-board: #2d2d2d;
    --border-board: rgba(255, 255, 255, 0.1);
    --board-line: #666;
    --bg-chat: rgba(40, 40, 40, 0.6);
    --border-chat: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(30, 30, 30, 0.8);
    --border-input: rgba(255, 255, 255, 0.12);
    --text-input: #e0e0e0;
    --placeholder-input: rgba(224, 224, 224, 0.3);
    --btn-send-bg: #555;
    --btn-send-text: #fff;
}

body[data-theme="deep"] {
    --bg-body: linear-gradient(135deg, #0f1923 0%, #1a2332 50%, #0d1520 100%);
    --bg-container: rgba(26, 35, 50, 0.85);
    --border-container: rgba(100, 149, 237, 0.2);
    --text-primary: #e0e8f0;
    --text-secondary: #8fa4bd;
    --bg-status: rgba(30, 45, 65, 0.6);
    --border-status: rgba(100, 149, 237, 0.2);
    --bg-board: #1a2332;
    --border-board: rgba(100, 149, 237, 0.3);
    --board-line: #4a6a8a;
    --bg-chat: rgba(20, 30, 45, 0.6);
    --border-chat: rgba(100, 149, 237, 0.15);
    --bg-input: rgba(15, 25, 40, 0.8);
    --border-input: rgba(100, 149, 237, 0.25);
    --text-input: #e0e8f0;
    --placeholder-input: rgba(224, 232, 240, 0.3);
    --btn-send-bg: #4a90d9;
    --btn-send-text: #fff;
}

body[data-theme="sakura"] {
    --bg-body: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
    --bg-container: rgba(255, 255, 255, 0.8);
    --border-container: rgba(244, 143, 177, 0.3);
    --text-primary: #4a2030;
    --text-secondary: #8d4e5e;
    --bg-status: rgba(255, 182, 193, 0.4);
    --border-status: rgba(244, 143, 177, 0.25);
    --bg-board: #f5d6c6;
    --border-board: rgba(244, 143, 177, 0.4);
    --board-line: #8d4e5e;
    --bg-chat: rgba(255, 255, 255, 0.6);
    --border-chat: rgba(244, 143, 177, 0.2);
    --bg-input: rgba(255, 255, 255, 0.8);
    --border-input: rgba(244, 143, 177, 0.3);
    --text-input: #4a2030;
    --placeholder-input: rgba(74, 32, 48, 0.4);
    --btn-send-bg: #ec407a;
    --btn-send-text: #fff;
}

body[data-theme="jade"] {
    --bg-body: linear-gradient(135deg, #3d5c50 0%, #2a4a3e 100%);
    --bg-container: rgba(232, 245, 233, 0.85);
    --border-container: rgba(91, 140, 122, 0.3);
    --text-primary: #1b3a2e;
    --text-secondary: #3d6b5a;
    --bg-status: rgba(91, 140, 122, 0.25);
    --border-status: rgba(91, 140, 122, 0.25);
    --bg-board: #5b8c7a;
    --border-board: rgba(27, 58, 46, 0.4);
    --board-line: #1b3a2e;
    --bg-chat: rgba(232, 245, 233, 0.6);
    --border-chat: rgba(91, 140, 122, 0.2);
    --bg-input: rgba(255, 255, 255, 0.7);
    --border-input: rgba(91, 140, 122, 0.3);
    --text-input: #1b3a2e;
    --placeholder-input: rgba(27, 58, 46, 0.4);
    --btn-send-bg: #2e7d5b;
    --btn-send-text: #fff;
}

body[data-theme="sunset"] {
    --bg-body: linear-gradient(135deg, #ff7e5f 0%, #feb47b 50%, #ff9a8b 100%);
    --bg-container: rgba(255, 248, 240, 0.85);
    --border-container: rgba(232, 140, 100, 0.3);
    --text-primary: #4a2010;
    --text-secondary: #8b4513;
    --bg-status: rgba(232, 196, 160, 0.5);
    --border-status: rgba(232, 140, 100, 0.25);
    --bg-board: #e8c4a0;
    --border-board: rgba(139, 69, 19, 0.4);
    --board-line: #6b3410;
    --bg-chat: rgba(255, 248, 240, 0.6);
    --border-chat: rgba(232, 140, 100, 0.2);
    --bg-input: rgba(255, 255, 255, 0.75);
    --border-input: rgba(232, 140, 100, 0.3);
    --text-input: #4a2010;
    --placeholder-input: rgba(74, 32, 16, 0.4);
    --btn-send-bg: #e67e22;
    --btn-send-text: #fff;
}

/* ========== 3. 非游戏页面统一背景（登录/大厅/等待） ========== */
body.glass-bg {
    background: #1a1a2e;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body.glass-bg::before,
body.glass-bg::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
}

body.glass-bg::before {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(102,126,234,0.4), transparent 70%);
    top: -100px;
    left: -100px;
    animation: floatOrb1 18s ease-in-out infinite;
}

body.glass-bg::after {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(240,147,251,0.35), transparent 70%);
    bottom: -80px;
    right: -80px;
    animation: floatOrb2 22s ease-in-out infinite;
}

@keyframes floatOrb1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, 40px) scale(1.15); }
}

@keyframes floatOrb2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-50px, -30px) scale(1.1); }
}

/* ========== 4. 通用组件 ========== */

/* 按钮 */
.btn-primary, .btn-secondary {
    padding: 11px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.18);
}

.btn-block {
    width: 100%;
    margin-top: 4px;
}

/* 表单 */
.form-group {
    margin-bottom: 10px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
}

.form-group input:focus {
    border-color: rgba(102,126,234,0.6);
    background: rgba(255,255,255,0.15);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-group input::placeholder {
    color: rgba(255,255,255,0.45);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: rgba(25,25,45,0.92);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    padding: 28px 24px 20px;
    max-width: 380px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
    font-size: 56px;
    margin-bottom: 10px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.modal-title.win { color: #4caf50; }
.modal-title.lose { color: #f44336; }
.modal-title.draw { color: #ff9800; }

.modal-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 16px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.modal-actions button:active {
    transform: scale(0.97);
}

.modal-actions .btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.modal-actions .btn-primary.waiting {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.modal-actions .btn-secondary {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.2);
}

/* 结果模态框战绩 */
.result-stats {
    margin: 16px 0;
    padding: 12px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
}

.result-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.result-stat-row span:first-child {
    font-weight: 600;
    color: #fff;
}

/* 弹幕通知 */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(30,30,40,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.5s forwards;
    max-width: 90vw;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    pointer-events: auto;
}

.toast.warning {
    background: rgba(180,60,60,0.85);
    border-color: rgba(255,150,150,0.3);
}

.toast.success {
    background: rgba(60,140,80,0.85);
    border-color: rgba(150,255,180,0.3);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toast-close:hover { opacity: 1; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* 键盘焦点 */
button:focus-visible, input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== 5. 登录页 ========== */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.auth-container::before,
.auth-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
}

.auth-container::before {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(102,126,234,0.5), transparent 70%);
    top: -100px;
    left: -100px;
    animation: floatOrb1 15s ease-in-out infinite;
}

.auth-container::after {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(240,147,251,0.4), transparent 70%);
    bottom: -80px;
    right: -80px;
    animation: floatOrb2 18s ease-in-out infinite;
}

.auth-card {
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    padding: 36px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
    animation: authFadeIn 0.5s ease;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-logo {
    font-size: 52px;
    text-align: center;
    margin-bottom: 6px;
    animation: bounce 2s infinite;
}

.auth-title {
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.auth-title .pink {
    background: linear-gradient(135deg, #e74c3c, #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    margin-bottom: 22px;
}

.auth-tabs {
    display: flex;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 22px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.auth-tab.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.auth-form .form-group label {
    color: rgba(255,255,255,0.8);
}

.auth-form .form-group input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
}

.auth-form .form-group input:focus {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.4);
}

/* 密码输入框包裹（含眼睛按钮） */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 42px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    transition: opacity 0.2s;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
}

.toggle-password:hover {
    opacity: 1;
}

.toggle-password.active {
    opacity: 0.9;
}

.auth-form .btn-block {
    padding: 13px;
    font-size: 15px;
    margin-top: 6px;
}

/* ========== 6. 大厅页 ========== */
.lobby-container {
    position: relative;
    z-index: 1;
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 用户信息卡 */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(20,20,40,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid rgba(20,20,40,0.8);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.user-account {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
    font-family: "Courier New", monospace;
    letter-spacing: 1px;
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 2px;
}

.stat-label { opacity: 0.7; }
.stat-value { font-weight: 600; }
.win-rate { color: #ffd700; font-weight: 700; }
.stat-divider { opacity: 0.3; }

.logout-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
    font-family: inherit;
}

.logout-btn:hover {
    background: rgba(255,80,80,0.2);
    border-color: rgba(255,100,100,0.4);
    color: #ff8080;
}

/* 大厅标题 */
.lobby-header {
    text-align: center;
    margin-bottom: 24px;
}

.lobby-header h1 {
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.lobby-header .pink { color: #ff99bb; }

.lobby-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

/* 大厅按钮组 */
.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lobby-action-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    text-align: left;
    position: relative;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.lobby-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

.lobby-action-btn:hover::before { left: 100%; }

.lobby-action-btn:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.lobby-action-btn:active { transform: translateY(0); }

/* 随机匹配按钮特殊样式 */
.lobby-action-btn.random {
    background: linear-gradient(135deg, rgba(243,156,18,0.25), rgba(230,126,34,0.25));
    border-color: rgba(243,156,18,0.4);
}
.lobby-action-btn.random:hover {
    background: linear-gradient(135deg, rgba(243,156,18,0.35), rgba(230,126,34,0.35));
    border-color: rgba(243,156,18,0.55);
}

/* 匹配中动画 */
.matching-icon {
    display: inline-block;
    animation: diceRoll 1.5s ease-in-out infinite;
}
@keyframes diceRoll {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-15deg) scale(1.1); }
    50% { transform: rotate(15deg) scale(1); }
    75% { transform: rotate(-10deg) scale(1.05); }
}
.matching-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
}

.matching-timer {
    font-size: 15px;
    color: rgba(255,255,255,0.7);
    margin: 8px 0 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}
.matching-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    animation: dotBounce 1.4s ease-in-out infinite both;
}
.matching-dots span:nth-child(1) { animation-delay: -0.32s; }
.matching-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.action-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
}

.action-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    display: block;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.action-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    display: block;
    margin-top: 2px;
}

/* ========== 7. 游戏页 ========== */
.game-container {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 游戏页整体毛玻璃卡片容器 */
.game-card {
    background: rgba(20,20,40,0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
    width: 100%;
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.header h1 .pink { color: #ff99bb; }

.room-badge {
    border-radius: 30px;
    padding: 7px 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
}

.room-badge strong { font-weight: 600; letter-spacing: 1px; }

.music-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.music-btn:hover { transform: scale(1.1); }
.music-btn.off { opacity: 0.4; }

/* 主题选择器 */
.theme-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 8px 12px;
}

.theme-selector .label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
}

.theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

.theme-btn:hover { transform: scale(1.1); border-color: rgba(255,255,255,0.5); }
.theme-btn.active { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,0.4); }

/* 玩家信息栏 */
.players-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 14px;
    background: rgba(20,20,40,0.55);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
}

.player-info-card {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.player-info-card.white {
    flex-direction: row;
    justify-content: flex-end;
}

.player-avatar {
    font-size: 22px;
    flex-shrink: 0;
}

.player-detail { min-width: 0; }

.player-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.player-rate {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    margin-top: 1px;
}

.vs-badge {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: rgba(231,76,60,0.3);
    padding: 4px 8px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
}

/* 观战者栏 */
.spectators-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(155,89,182,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 12px;
}

.spectators-label {
    font-weight: 600;
    color: #e8d5f0;
    flex-shrink: 0;
}

.spectators-list {
    color: rgba(255,255,255,0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 准备栏 */
.ready-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(20,20,40,0.55);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ready-player {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #fff;
}

.ready-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #999;
    transition: background 0.3s, box-shadow 0.3s;
}

.ready-dot.ready {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76,175,80,0.6);
}

.ready-status {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
}

.ready-status.ready {
    color: #4caf50;
    background: rgba(76,175,80,0.12);
}

.ready-vs {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
}

.btn-ready {
    padding: 8px 24px;
    border: none;
    border-radius: 20px;
    background: rgba(46,204,113,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-ready:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(76,175,80,0.3); }
.btn-ready.cancel { background: rgba(255,152,0,0.4); }

/* 状态栏 */
.status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    border-radius: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
    align-items: center;
    background: rgba(20,20,40,0.55);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #fff;
}

.status-item .label { font-weight: 300; color: rgba(255,255,255,0.6); }
.status-item .value { font-weight: 500; }

.status-timer {
    margin-left: auto;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
}

.status-timer.warning { animation: pulse 1s ease-in-out infinite; color: #ff6b6b; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 棋盘 */
.board-wrapper {
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
    background: var(--bg-board, #d4b48c);
    border: 2px solid var(--border-board, rgba(139,111,71,0.6));
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

#boardCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    cursor: pointer;
    touch-action: none;
}

/* 底部区域（聊天+操作按钮） */
.bottom-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-box {
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(20,20,40,0.55);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
}

.chat-box .messages {
    height: 70px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.8;
    scrollbar-width: thin;
    margin-bottom: 8px;
    color: rgba(255,255,255,0.85);
}

.chat-box .messages::-webkit-scrollbar { width: 4px; }
.chat-box .messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.chat-box .messages .msg-system { font-style: italic; color: rgba(255,255,255,0.5); }
.chat-box .messages > div { word-break: break-word; overflow-wrap: break-word; }

.chat-input-row {
    display: flex;
    gap: 8px;
}

.chat-input-row input {
    flex: 1;
    border-radius: 20px;
    padding: 9px 16px;
    font-size: 13px;
    outline: none;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    transition: border 0.2s, background 0.2s;
    font-family: inherit;
}

.chat-input-row input:focus { border-color: rgba(102,126,234,0.6); background: rgba(255,255,255,0.15); }
.chat-input-row input::placeholder { color: rgba(255,255,255,0.4); }

.chat-input-row button {
    padding: 9px 18px;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    background: rgba(102,126,234,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    transition: opacity 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.chat-input-row button:hover { opacity: 0.85; }

/* 操作按钮 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-buttons .row {
    display: flex;
    gap: 8px;
}

.action-buttons button {
    flex: 1;
    padding: 9px 0;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-family: inherit;
}

.action-buttons button:hover { background: rgba(255,255,255,0.18); }

.action-buttons button.primary {
    background: rgba(231,76,60,0.4);
    border-color: rgba(255,255,255,0.2);
}

.action-buttons button.primary:hover { background: rgba(231,76,60,0.55); }

/* ========== 8. 等待页 ========== */
.waiting-container {
    position: relative;
    z-index: 1;
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.waiting-content {
    text-align: center;
    background: rgba(20,20,40,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 32px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.waiting-icon {
    font-size: 52px;
    margin-bottom: 12px;
    animation: bounce 2s ease-in-out infinite;
}

.waiting-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.waiting-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 24px;
}

.room-code-box {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.room-code-label {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.room-code-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.room-code-text {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 5px;
    color: #ffd700;
    font-family: "Courier New", monospace;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.copy-btn:hover {
    border-color: rgba(102,126,234,0.6);
    background: rgba(102,126,234,0.15);
}

.copy-btn.copied {
    border-color: #4caf50;
    color: #4caf50;
}

.waiting-player-info {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.player-tag {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
}

.waiting-actions {
    display: flex;
    justify-content: center;
}

/* ========== 9. 编辑个人资料模态框 ========== */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.profile-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    border: 3px solid rgba(255,255,255,0.25);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    overflow: hidden;
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-upload-row {
    display: flex;
    gap: 6px;
}

.btn-avatar-upload {
    display: inline-block;
    padding: 7px 14px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-avatar-upload:hover {
    background: rgba(255,255,255,0.2);
}

.avatar-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.avatar-preset {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255,255,255,0.08);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.avatar-preset:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.08);
}

.avatar-preset.active {
    border-color: #667eea;
    background: rgba(102,126,234,0.25);
    box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}

/* 账号显示（只读） */
.profile-account {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    font-family: "Courier New", monospace;
    letter-spacing: 2px;
    user-select: text;
    -webkit-user-select: text;
    cursor: default;
}

/* ========== 10. 响应式 ========== */

/* 平板及以下（≤900px） */
@media (max-width: 900px) {
    .game-container {
        padding: 12px;
    }

    .board-wrapper {
        max-width: 100%;
    }

    .player-name {
        max-width: 80px;
    }
}

/* 手机端（≤600px） */
@media (max-width: 600px) {
    /* 游戏页卡片移动端适配 */
    .game-card {
        padding: 14px;
        border-radius: 16px;
    }

    /* 登录页 */
    .auth-card {
        padding: 28px 20px;
        margin: 10px;
    }

    .auth-logo { font-size: 44px; }
    .auth-title { font-size: 22px; }

    /* 大厅页 */
    .lobby-container {
        padding: 20px 14px;
    }

    .user-card {
        padding: 12px 14px;
        gap: 10px;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .user-name { font-size: 15px; }
    .user-stats { font-size: 10px; gap: 4px; }

    .lobby-header h1 { font-size: 26px; }

    .lobby-action-btn {
        padding: 15px 16px;
        gap: 12px;
    }

    .action-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .action-title { font-size: 15px; }
    .action-desc { font-size: 11px; }

    /* 游戏页 */
    .game-container {
        padding: 10px;
    }

    .header h1 { font-size: 19px; }
    .room-badge { padding: 6px 14px; font-size: 13px; }

    .players-bar {
        padding: 8px 10px;
        gap: 6px;
    }

    .player-name {
        font-size: 12px;
        max-width: 65px;
    }

    .player-rate { font-size: 9px; }
    .vs-badge { font-size: 10px; padding: 3px 6px; }

    .status-bar {
        padding: 8px 10px;
        gap: 8px;
    }

    .status-item .label { font-size: 11px; }
    .status-item .value { font-size: 12px; }
    .status-timer { font-size: 12px; padding: 3px 10px; }

    .board-wrapper { padding: 8px; }

    .chat-box .messages { height: 60px; }

    .action-buttons button {
        padding: 8px 0;
        font-size: 12px;
    }

    .theme-selector {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .theme-selector .label { flex-shrink: 0; }
    .theme-btn { flex-shrink: 0; }

    /* 等待页 */
    .waiting-container {
        padding: 20px 14px;
    }

    .waiting-content {
        padding: 24px 18px;
    }

    .room-code-text {
        font-size: 22px;
        letter-spacing: 3px;
    }

    /* 模态框 */
    .modal-box {
        padding: 24px 20px 18px;
        width: 92%;
    }

    .modal-icon { font-size: 44px; }
    .modal-title { font-size: 20px; }

    .avatar-presets {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* 极小屏幕（≤380px） */
@media (max-width: 380px) {
    .game-container { padding: 8px; }
    .header h1 { font-size: 17px; }
    .player-name { max-width: 50px; font-size: 11px; }
    .player-rate { display: none; }
    .status-item .label { display: none; }
    .lobby-action-btn { padding: 13px 14px; }
    .action-icon { width: 36px; height: 36px; font-size: 20px; }
    .avatar-presets { grid-template-columns: repeat(4, 1fr); }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn-primary, .btn-secondary, .btn-ready,
    .theme-btn, .music-btn, .copy-btn, .auth-tab,
    .lobby-action-btn, .logout-btn, .avatar-preset,
    .btn-avatar-upload, .chat-input-row button,
    .action-buttons button, .toast-close {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    canvas { touch-action: none; }
}

/* ========== 11. 补充样式（HTML中用到但前面未定义的class） ========== */

/* 通用容器类（lobby/waiting/game都有） */
.container {
    width: 100%;
}

/* 大厅卡片容器（包裹user-card/header/actions） */
.lobby-card {
    background: rgba(20,20,40,0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* 玩家信息卡 - 黑棋（默认左对齐） */
.player-info-card.black {
    justify-content: flex-start;
}

/* 主题按钮勾选标记 */
.theme-btn .check {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.theme-btn.active .check {
    opacity: 1;
}

/* 聊天消息 - 玩家自己 */
.msg-player {
    color: #ffd700;
    font-weight: 500;
}

/* 聊天消息 - 对方 */
.msg-other {
    color: #87ceeb;
}

/* 结果模态框 - 比分 */
.modal-score {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    padding: 8px 14px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    margin-bottom: 10px;
}

/* 结果模态框 - 再来一局信息 */
.modal-rematch-info {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    padding: 6px 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    margin-bottom: 12px;
}

/* 确认模态框 */
.confirm-box {
    max-width: 340px;
}

/* 弹幕 - 错误类型 */
.toast.error {
    background: rgba(180,60,60,0.85);
    border-color: rgba(255,150,150,0.3);
}

/* 大厅卡片内的子元素间距 */
.lobby-card .user-card {
    margin-bottom: 16px;
}

.lobby-card .lobby-header {
    margin-bottom: 18px;
}

/* 等待页按钮 */
.waiting-actions .btn-secondary {
    padding: 10px 24px;
}

/* 结果模态框战绩行 */
.result-stat-row + .result-stat-row {
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ========== 账号安全相关样式 ========== */
.forgot-password-link {
    text-align: center;
    margin-top: 12px;
}
.forgot-password-link a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}
.forgot-password-link a:hover {
    color: rgba(255,255,255,0.9);
}
.security-question-display {
    padding: 10px 14px;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.1);
}
.profile-section-divider {
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    margin: 16px 0 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
    cursor: pointer;
}
.form-group select:focus {
    border-color: rgba(102,126,234,0.6);
    background: rgba(255,255,255,0.15);
}
.form-group select option {
    background: #2a2a3e;
    color: #fff;
}

/* 个人资料安全选项 */
.profile-security-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.profile-security-options .btn-block {
    margin-top: 0;
}

/* 个人资料UID */
.profile-uid {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
}

/* 个人资料菜单列表 */
.profile-menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-menu-item:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.profile-menu-label {
    flex: 1;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.profile-menu-value {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-right: 8px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-arrow {
    font-size: 18px;
    color: rgba(255,255,255,0.3);
    font-weight: bold;
}

/* 头像选择弹窗 - 大预览 */
.avatar-preview-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 16px;
    border: 3px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    overflow: hidden;
}

.avatar-preview-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* 弹窗描述 */
.modal-desc {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
    margin-top: -8px;
}

/* ========== 排行榜样式 ========== */
.leaderboard-section {
    margin-top: 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.leaderboard-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.leaderboard-rule {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.06);
    padding: 4px 10px;
    border-radius: 20px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaderboard-loading,
.leaderboard-empty {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.4);
    font-size: 13px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    transition: background 0.2s;
    gap: 10px;
}

.leaderboard-item:hover {
    background: rgba(255,255,255,0.08);
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,165,0,0.08));
    border: 1px solid rgba(255,215,0,0.25);
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, rgba(192,192,192,0.12), rgba(169,169,169,0.06));
    border: 1px solid rgba(192,192,192,0.2);
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, rgba(205,127,50,0.12), rgba(184,115,51,0.06));
    border: 1px solid rgba(205,127,50,0.2);
}

.leaderboard-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
}

.leaderboard-item.rank-1 .leaderboard-rank {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #5c4033;
}

.leaderboard-item.rank-2 .leaderboard-rank {
    background: linear-gradient(135deg, #c0c0c0, #a9a9a9);
    color: #333;
}

.leaderboard-item.rank-3 .leaderboard-rank {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: #fff;
}

.leaderboard-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.15);
}

.leaderboard-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.leaderboard-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.leaderboard-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.leaderboard-winrate {
    font-size: 14px;
    font-weight: 700;
    color: #4caf50;
}

.leaderboard-record {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}

/* 自己的排名高亮 */
.leaderboard-item.is-me {
    background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(118,75,162,0.1));
    border: 1px solid rgba(102,126,234,0.4);
}

.leaderboard-item.is-me .leaderboard-name {
    color: #a8b8ff;
}

.me-tag {
    display: inline-block;
    font-size: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 600;
    vertical-align: middle;
}

/* 200名之后自己的排名 */
.leaderboard-item.my-rank {
    background: linear-gradient(135deg, rgba(255,165,0,0.15), rgba(255,140,0,0.08));
    border: 1px solid rgba(255,165,0,0.35);
}

.leaderboard-item.my-rank .leaderboard-rank {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
    color: #fff;
}

/* 分隔线 */
.leaderboard-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    color: rgba(255,255,255,0.25);
    font-size: 14px;
    letter-spacing: 4px;
}

/* 排行榜响应式 */
@media (max-width: 480px) {
    .leaderboard-section {
        padding: 12px;
    }
    .leaderboard-header h3 {
        font-size: 14px;
    }
    .leaderboard-rule {
        font-size: 10px;
        padding: 3px 8px;
    }
    .leaderboard-item {
        padding: 8px 10px;
        gap: 8px;
    }
    .leaderboard-rank {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    .leaderboard-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    .leaderboard-name {
        font-size: 13px;
    }
    .leaderboard-winrate {
        font-size: 13px;
    }
}

/* ========== 排行榜按钮（和创建房间等一样的大按钮） ========== */
.lobby-action-btn.leaderboard {
    background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,165,0,0.08));
    border: 1px solid rgba(255,215,0,0.25);
}

.lobby-action-btn.leaderboard .action-icon {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #5c4033;
}

.lobby-action-btn.leaderboard:hover {
    background: linear-gradient(135deg, rgba(255,215,0,0.25), rgba(255,165,0,0.12));
    border-color: rgba(255,215,0,0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255,165,0,0.2);
}

/* ========== 排行榜模态框 ========== */
.leaderboard-modal-box {
    max-width: 420px;
    padding: 24px 20px 16px;
}

.leaderboard-modal-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.leaderboard-modal-header .modal-title {
    margin-bottom: 6px;
}

.leaderboard-modal-list {
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding-right: 4px;
}

.leaderboard-modal-list::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-modal-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
}

.leaderboard-modal-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

/* 排行榜模态框响应式 */
@media (max-width: 480px) {
    .leaderboard-modal-box {
        width: 92%;
        padding: 20px 16px 12px;
    }
    .leaderboard-modal-list {
        max-height: 45vh;
    }
}
