/* 情侣飞行棋 - 主样式文件 */

/* 自定义字体 */
@font-face {
    font-family: 'Zhanku2016';
    src: url('../zt/zhanku2016.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 字体加载优化 */
.fonts-loaded {
    font-family: 'Zhanku2016', 'Microsoft YaHei', Arial, sans-serif;
}

.fonts-loading {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

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

body {
    font-family: 'Zhanku2016', 'Microsoft YaHei', Arial, sans-serif;
    background: transparent;
    min-height: 100vh;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

/* 动态背景图片 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--background-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
    z-index: -1;
    transition: opacity 0.8s ease-in-out, background-image 0.8s ease-in-out;
    filter: blur(0px);
}

/* 背景切换动画 */
body.background-transitioning::before {
    animation: backgroundTransition 1.5s ease-in-out;
}

/* 背景加载状态 */
body.background-loaded::before {
    opacity: 1;
    filter: blur(0px);
}

/* 背景模糊效果 */
body.background-blur::before {
    filter: blur(3px);
    opacity: 0.2;
}

/* 确保内容在背景之上 */
.container, .page, .modal {
    position: relative;
    z-index: 1;
}

/* 背景切换动画关键帧 */
@keyframes backgroundTransition {
    0% {
        opacity: 1;
        filter: blur(0px) scale(1);
        transform: scale(1);
    }
    25% {
        opacity: 0.3;
        filter: blur(2px) scale(1.05);
        transform: scale(1.05);
    }
    50% {
        opacity: 0.1;
        filter: blur(4px) scale(1.1);
        transform: scale(1.1);
    }
    75% {
        opacity: 0.3;
        filter: blur(2px) scale(1.05);
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        filter: blur(0px) scale(1);
        transform: scale(1);
    }
}

/* 背景粒子效果 */
.background-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}

/* 删除渐变遮罩层，只保留纯图片背景 */



/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #00d2d3, #54a0ff);
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #ff3838, #ff6b6b);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #ffa502, #ff6348);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #747d8c, #57606f);
    color: white;
}

.btn-large {
    padding: 15px 30px;
    font-size: 16px;
    width: 100%;
    margin-bottom: 15px;
}

/* 欢迎页面 */
.welcome-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.welcome-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.welcome-header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.welcome-header p {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 30px;
}

.game-features {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.welcome-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.welcome-form h3 {
    margin-bottom: 30px;
    color: #333;
}

.avatar-selection {
    margin: 20px 0;
}

.avatar-selection label {
    display: block;
    margin-bottom: 15px;
    color: #666;
    font-weight: 500;
}

.avatar-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 60px;
    align-items: center;
}

.avatar-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: #007bff;
    box-shadow: 0 0 10px rgba(0,123,255,0.3);
}

.avatar-option.active {
    border-color: #007bff;
    box-shadow: 0 0 15px rgba(0,123,255,0.5);
    transform: scale(1.15);
}

.avatar-loading {
    color: #666;
    font-style: italic;
}

.color-selection {
    margin: 20px 0;
}

.color-selection label {
    display: block;
    margin-bottom: 15px;
    color: #666;
    font-weight: 500;
}

.color-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: #333;
    transform: scale(1.2);
}

.action-buttons {
    margin-top: 30px;
}



.input-group {
    margin-bottom: 20px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    margin-bottom: 10px;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #ff6b6b;
}

.name-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
}

.btn-generate {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(79, 172, 254, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(79, 172, 254, 0.35);
    background: linear-gradient(135deg, #3b9cfd 0%, #00e5fd 100%);
}

.btn-generate:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
}

.btn-generate:active {
    transform: translateY(0);
}

.name-tip {
    color: #666;
    font-size: 12px;
    font-style: italic;
    opacity: 0.8;
}

/* 房间大厅 */
.lobby-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.player-details h3 {
    color: #333;
    margin-bottom: 5px;
}

.player-details p {
    color: #666;
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.lobby-content {
    display: block;
}

.lobby-main {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.lobby-tips {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.lobby-tips h4 {
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid #ff6b6b;
    padding-bottom: 10px;
}

.lobby-tips ul {
    list-style: none;
    padding: 0;
}

.lobby-tips li {
    padding: 8px 0;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
}

.lobby-tips li:last-child {
    border-bottom: none;
}

.lobby-main {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.room-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ff6b6b;
}

.rooms-list {
    height: calc(100% - 80px);
    overflow-y: auto;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.room-item:hover {
    border-color: #ff6b6b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.room-info h4 {
    color: #333;
    margin-bottom: 5px;
}

.room-info p {
    color: #666;
    font-size: 14px;
}

.room-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.status-waiting {
    background: #2ed573;
    color: white;
}

.status-playing {
    background: #ffa502;
    color: white;
}

.status-full {
    background: #ff3838;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .lobby-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .lobby-sidebar {
        order: 2;
    }
    
    .lobby-main {
        order: 1;
    }
    
    .lobby-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
    }
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    color: white;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

/* 数字键盘弹窗样式 */
.keypad-modal {
    background: #f8f9fa;
    margin: 5% auto;
    max-width: 400px;
    border-radius: 20px;
    overflow: hidden;
    padding: 0;
}

.keypad-modal .modal-header {
    background: #fff;
    padding: 20px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid #e9ecef;
}

.back-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 5px;
}

.keypad-modal h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    font-weight: 500;
}

.code-display {
    padding: 40px 20px;
    text-align: center;
    background: #fff;
}

.code-dots {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    background: #fff;
    transition: all 0.2s ease;
}

.dot.filled {
    background: #333;
    border-color: #333;
}

.reset-link {
    margin-top: 20px;
}

.reset-link a {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.number-keypad {
    padding: 20px;
    background: #f8f9fa;
}

.keypad-row {
    display: flex;
    gap: 1px;
    margin-bottom: 1px;
}

.keypad-btn {
    flex: 1;
    height: 60px;
    background: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
    position: relative;
}

.keypad-btn:hover {
    background: #e9ecef;
}

.keypad-btn:active {
    background: #dee2e6;
}

.keypad-btn.empty {
    cursor: default;
    background: #f8f9fa;
}

.keypad-btn.empty:hover {
    background: #f8f9fa;
}

.digit {
    font-size: 24px;
    font-weight: 300;
    color: #333;
    line-height: 1;
}

.letters {
    font-size: 10px;
    color: #666;
    margin-top: 2px;
    letter-spacing: 1px;
}

.delete-btn svg {
    color: #666;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close:hover {
    color: #000;
}

/* 房间页面 */
.room-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.room-code-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.room-code-label {
    color: #666;
    font-size: 14px;
}

.room-code-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 2px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.btn-copy {
    background: linear-gradient(45deg, #00d2d3, #54a0ff);
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-copy:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 210, 211, 0.4);
}

.btn-copy.copied {
    background: linear-gradient(45deg, #00b894, #00cec9);
    transform: scale(1.1);
}

.copy-icon {
    font-size: 18px;
}

/* 游戏模式选择 */
.game-mode-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-mode-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.game-mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.mode-option {
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.mode-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mode-option:hover::before {
    opacity: 1;
}

.mode-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.mode-option.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.mode-option.active::before {
    opacity: 0;
}

.mode-option .mode-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.mode-option:hover .mode-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mode-option.active .mode-icon {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.mode-option .mode-icon .mode-icon-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.mode-option .mode-icon .mode-icon-emoji {
    font-size: 32px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-option .mode-name {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 16px;
    color: #333;
    transition: color 0.3s ease;
}

.mode-option:hover .mode-name {
    color: #667eea;
}

.mode-option.active .mode-name {
    color: white;
    font-weight: 700;
}

.mode-option .mode-desc {
    font-size: 13px;
    opacity: 0.7;
    line-height: 1.4;
    color: #666;
    transition: all 0.3s ease;
}

.mode-option:hover .mode-desc {
    opacity: 0.9;
    color: #555;
}

.mode-option.active .mode-desc {
    opacity: 0.95;
    color: rgba(255, 255, 255, 0.95);
}

.game-mode-display .selected-mode {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.game-mode-display .mode-icon {
    font-size: 32px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 3px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.game-mode-display .mode-icon .mode-icon-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.game-mode-display .mode-icon .mode-icon-emoji {
    font-size: 40px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-mode-display .mode-info h5 {
    margin: 0 0 5px 0;
    color: #333;
}

.game-mode-display .mode-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.mode-loading {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* 单机模式选择对话框中的图标样式 */
.solo-mode-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.solo-mode-icon .mode-icon-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.solo-mode-icon .mode-icon-emoji {
    font-size: 20px;
    line-height: 1;
}

.room-info h3 {
    color: #333;
    margin-bottom: 5px;
}

.room-info p {
    color: #666;
    font-size: 14px;
}

.room-actions {
    display: flex;
    gap: 10px;
}

.room-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
}

.players-area {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.player-card {
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    min-width: 200px;
}

.player-card.active {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    transform: scale(1.05);
}

.player-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #ff6b6b;
    margin-bottom: 15px;
}

.player-card.active img {
    border-color: white;
}

.player-info h4 {
    margin-bottom: 8px;
    font-size: 18px;
}

.player-info p {
    font-size: 14px;
    opacity: 0.8;
}

.player-status {
    margin-top: 10px;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(0,0,0,0.1);
}

.vs-indicator {
    font-size: 2em;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.room-chat {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

.chat-message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 10px;
    background: #f8f9fa;
}

.chat-message.system {
    background: #e3f2fd;
    color: #1976d2;
    text-align: center;
    font-style: italic;
}

.chat-message .sender {
    font-weight: bold;
    color: #ff6b6b;
    margin-bottom: 5px;
}

.chat-message .message-text {
    margin-bottom: 5px;
    word-wrap: break-word;
}

.chat-message .message-time {
    font-size: 12px;
    color: #999;
    text-align: right;
}

/* 任务消息样式 */
.chat-message.task-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid #5a6fd8;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.chat-message.task-message .task-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: bold;
}

.chat-message.task-message .task-icon {
    font-size: 18px;
}

.chat-message.task-message .task-title {
    font-size: 14px;
    opacity: 0.9;
}

.chat-message.task-message .task-content {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 8px;
    font-weight: 500;
}

/* 回合提示样式 */
.chat-message.turn-indicator {
    background: #fff3cd;
    color: #856404;
    text-align: center;
    border: 1px solid #ffeaa7;
}

.chat-message.turn-indicator .turn-text {
    font-weight: bold;
}

/* 本地消息样式 */
.chat-message.local-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* 游戏模式更改消息样式 */
.chat-message.system.game-mode-change {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #d63384;
    border: 2px solid #e91e63;
}

.chat-input {
    display: flex;
    padding: 20px;
    border-top: 1px solid #eee;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.chat-input input:focus {
    outline: none;
    border-color: #ff6b6b;
}

/* 确认对话框 */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* 获胜弹窗样式 */
.winner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease-in-out;
}

.winner-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.5s ease-out;
}

.winner-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 20px 20px 0 0;
}

.winner-header h2 {
    margin: 0;
    color: white;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.winner-body {
    padding: 30px 20px;
}

.winner-avatar {
    margin-bottom: 20px;
}

.winner-icon {
    font-size: 60px;
    animation: bounce 1s infinite;
}

.winner-body h3 {
    margin: 0 0 10px 0;
    color: white;
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.winner-body p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

.winner-footer {
    padding: 20px;
    border-radius: 0 0 20px 20px;
}

.winner-footer .btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.winner-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.confirm-dialog {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: confirmDialogShow 0.3s ease;
}

@keyframes confirmDialogShow {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-header {
    padding: 20px 20px 0 20px;
    text-align: center;
}

.confirm-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.confirm-body {
    padding: 20px;
    text-align: center;
}

.confirm-body p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

.confirm-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-footer .btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10001;
}

.confirm-footer .btn-secondary {
    background: #6c757d;
    color: white;
}

.confirm-footer .btn-secondary:hover {
    background: #5a6268;
}

.confirm-footer .btn-danger {
    background: #dc3545;
    color: white;
}

.confirm-footer .btn-danger:hover {
    background: #c82333;
}

/* 公告模态框样式 */
.announcement-content {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    line-height: 1.6;
    color: #333;
    font-size: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* 公告按钮样式 */
.btn-info {
    background: linear-gradient(45deg, #17a2b8, #20c997);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(45deg, #138496, #1ea085);
}

/* 前端主页广告样式 */
.frontend-ad-section {
    margin: 20px 0;
    padding: 0;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
    overflow: visible;
}

.frontend-ad-section:hover {
    transform: translateY(-2px);
}

.frontend-ad-section .text-ad {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.frontend-ad-section img {
    max-width: 100% !important;
    max-height: 100px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 6px;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    overflow: visible !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .frontend-ad-section {
        margin: 15px 0;
        padding: 0;
    }
    
    .frontend-ad-section .text-ad {
        font-size: 13px;
    }
}

/* 房间等待广告样式 */
.room-waiting-ad {
    display: inline-block;
    margin-left: 10px;
    padding: 0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.room-waiting-ad:hover {
    transform: translateY(-1px);
}

.room-waiting-ad .text-ad {
    margin: 0;
    font-size: 12px;
    line-height: 1.3;
}

.room-waiting-ad img {
    max-width: 100%;
    max-height: 30px;
    width: auto;
    height: auto;
    border-radius: 4px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.room-waiting-ad img:hover {
    transform: translateY(-1px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .room-waiting-ad {
        margin-left: 8px;
        padding: 0;
        font-size: 11px;
    }
    
    .room-waiting-ad .text-ad {
        font-size: 11px;
    }
}

/* ===== 移动端响应式优化 ===== */

/* 移动端基础样式调整 */
@media (max-width: 768px) {
    /* 欢迎页面移动端优化 */
    .welcome-container {
        padding: 15px;
    }
    
    .welcome-header h1 {
        font-size: 2.2em;
        margin-bottom: 8px;
    }
    
    .welcome-header p {
        font-size: 1em;
        margin-bottom: 20px;
    }
    
    .game-features {
        flex-direction: column;
        gap: 10px;
    }
    
    .feature {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .welcome-form {
        width: 100%;
        max-width: 400px;
    }
    
    .input-group {
        margin-bottom: 20px;
    }
    
    .name-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .avatar-selection {
        margin-bottom: 25px;
    }
    
    .avatar-options {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .avatar-option {
        width: 60px;
        height: 60px;
    }
    
    /* 房间大厅移动端优化 */
    .lobby-container {
        padding: 10px;
    }
    
    .lobby-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .player-info {
        flex-direction: column;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-actions .btn {
        width: 100%;
    }
    
    .room-item {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .room-info {
        text-align: center;
    }
    
    .room-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .room-actions .btn {
        width: 100%;
    }
    
    .lobby-tips {
        padding: 15px;
        margin-top: 20px;
    }
    
    .lobby-tips h4 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .lobby-tips ul {
        padding-left: 20px;
    }
    
    .lobby-tips li {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    /* 房间页面移动端优化 */
    .room-container {
        padding: 10px;
    }
    
    .room-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .room-info {
        text-align: center;
    }
    
    .room-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .room-actions .btn {
        width: 100%;
    }
    
    .room-code-display {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .room-code-value {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .btn-copy {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .game-mode-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .game-mode-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .mode-option {
        padding: 12px;
    }
    
    .room-content {
        display: flex !important; /* 强制使用flex布局 */
        flex-direction: column !important; /* 强制垂直排列 */
        gap: 20px;
        /* 手机端：玩家区域在上，聊天区域在下 */
        grid-template-columns: none !important; /* 移除网格列 */
        grid-template-rows: none !important; /* 移除网格行 */
        height: auto; /* 手机端不限制高度 */
        min-height: calc(100vh - 200px); /* 确保最小高度 */
    }
    
    .players-area {
        display: flex !important; /* 强制使用flex布局 */
        flex-direction: row !important; /* 手机端也保持横向布局 */
        gap: 15px;
        order: 1; /* 确保玩家区域在上方 */
        padding: 20px 15px; /* 调整内边距 */
        width: 100% !important; /* 确保占满宽度 */
    }
    
    .room-chat {
        display: flex !important; /* 强制使用flex布局 */
        flex-direction: column !important; /* 垂直排列 */
        order: 2; /* 确保聊天区域在下方 */
        height: auto; /* 手机端自适应高度 */
        min-height: 200px; /* 确保最小高度可见 */
        flex: 1; /* 占据剩余空间 */
        width: 100% !important; /* 确保占满宽度 */
        margin-top: 0 !important; /* 移除可能的顶部边距 */
    }
    
    .vs-indicator {
        font-size: 1.5em; /* 手机端稍微小一些 */
        margin: 0 10px; /* 左右间距而不是上下间距 */
    }
    
    .player-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
        min-width: 120px; /* 确保最小宽度 */
        flex: 1; /* 均分剩余空间 */
        max-width: 45%; /* 限制最大宽度，确保两个卡片能并排显示 */
    }
    
    .player-avatar {
        width: 60px;
        height: 60px;
        margin: 0 auto 10px;
    }
    
    /* 移除重复的room-chat定义 */
    
    .chat-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .chat-input input {
        width: 100%;
    }
    
    .chat-input .btn {
        width: 100%;
    }
    
    /* 手机端聊天消息区域优化 */
    .chat-messages {
        max-height: none; /* 手机端不限制最大高度 */
        min-height: 200px; /* 增加最小高度确保可见性 */
        flex: 1; /* 占据剩余空间 */
        padding: 15px; /* 调整内边距 */
    }
    
    /* 确保聊天框在手机端完全可见 */
    .room-chat {
        display: flex !important; /* 强制显示 */
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* 游戏页面移动端优化 */
    .game-container {
        padding: 10px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .game-info {
        text-align: center;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 5px;
    }
    
    .game-board {
        margin: 15px 0;
    }
    
    .board-grid {
        grid-template-columns: repeat(15, 1fr);
        gap: 2px;
    }
    
    .grid-cell {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .dice-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .dice {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .game-controls .btn {
        width: 100%;
        padding: 12px;
    }
    
    .player-pieces {
        flex-direction: column;
        gap: 10px;
    }
    
    /* 棋子样式已删除，使用JavaScript动态生成 */
    
    /* 通用移动端优化 */
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px; /* 确保触摸目标足够大 */
    }
    
    .btn-large {
        padding: 16px 24px;
        font-size: 18px;
    }
    
    /* 模态框移动端优化 */
    .modal-content {
        width: 90%;
        max-width: 400px;
        margin: 20px auto;
    }
    
    .confirm-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .confirm-footer .btn {
        width: 100%;
    }
}

/* 平板端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .welcome-header h1 {
        font-size: 2.5em;
    }
    
    .game-features {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .avatar-options {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .room-content {
        gap: 30px;
    }
    
    .players-area {
        gap: 30px;
    }
    
    .board-grid {
        grid-template-columns: repeat(15, 1fr);
        gap: 3px;
    }
    
    .grid-cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
}

/* 所有iPad设备优化 - 强制垂直布局 */
@media (min-width: 769px) and (max-width: 1024px) {
    /* 强制使用垂直布局，确保聊天框在玩家区域下方 */
    .room-content {
        display: flex !important; /* 强制使用flex布局 */
        flex-direction: column !important; /* 强制垂直排列 */
        grid-template-columns: none !important; /* 移除网格列 */
        grid-template-rows: none !important; /* 移除网格行 */
        height: auto !important; /* 自适应高度 */
        min-height: calc(100vh - 200px); /* 确保最小高度 */
        gap: 20px; /* 减少间距 */
    }
    
    .players-area {
        display: flex !important; /* 强制使用flex布局 */
        flex-direction: row !important; /* 玩家区域保持横向 */
        order: 1; /* 确保玩家区域在上方 */
        padding: 20px; /* 减少内边距 */
        gap: 20px; /* 减少间距 */
        width: 100% !important; /* 确保占满宽度 */
    }
    
    .room-chat {
        display: flex !important; /* 强制使用flex布局 */
        flex-direction: column !important; /* 垂直排列 */
        order: 2; /* 确保聊天区域在下方 */
        height: auto; /* 自适应高度 */
        min-height: 250px; /* 确保最小高度可见 */
        flex: 1; /* 占据剩余空间 */
        width: 100% !important; /* 确保占满宽度 */
        margin-top: 0 !important; /* 移除可能的顶部边距 */
    }
    
    .player-card {
        padding: 15px; /* 减少卡片内边距 */
        min-width: 150px; /* 减少最小宽度 */
        flex: 1; /* 均分空间 */
        max-width: 45%; /* 限制最大宽度 */
    }
    
    .player-avatar {
        width: 60px; /* 减少头像大小 */
        height: 60px;
    }
    
    .chat-messages {
        max-height: none; /* 移除最大高度限制 */
        min-height: 200px; /* 确保最小高度 */
        flex: 1; /* 占据剩余空间 */
        padding: 15px; /* 调整内边距 */
    }
    
    .game-mode-section {
        padding: 15px; /* 减少游戏模式区域内边距 */
        margin-bottom: 15px; /* 减少底部边距 */
    }
    
    .game-mode-selector {
        gap: 10px; /* 减少游戏模式选择器间距 */
    }
    
    .mode-option {
        padding: 12px; /* 减少模式选项内边距 */
    }
    
    /* 确保聊天框完全可见 */
    .room-chat {
        visibility: visible !important;
        opacity: 1 !important;
        overflow: visible !important;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .welcome-header h1 {
        font-size: 1.8em;
    }
    
    .welcome-header p {
        font-size: 0.9em;
    }
    
    .feature {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .avatar-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .avatar-option {
        width: 50px;
        height: 50px;
    }
    
    .room-item {
        padding: 12px;
    }
    
    .player-card {
        padding: 12px;
    }
    
    .player-avatar {
        width: 50px;
        height: 50px;
    }
    
    .board-grid {
        gap: 1px;
    }
    
    .grid-cell {
        width: 18px;
        height: 18px;
        font-size: 8px;
    }
    
    .dice {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    /* 棋子样式已删除，使用JavaScript动态生成 */
}

/* Toast 动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 复制按钮样式 */
.btn-copy.copied {
    background: linear-gradient(45deg, #00b894, #00cec9) !important;
    transform: scale(1.1);
}

.chat-message.local-message .message-time {
    font-size: 12px;
    opacity: 0.7;
    text-align: right;
}

/* 任务消息样式 */
.chat-message.task-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid #5a6fd8;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.chat-message.task-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    animation: rainbow 3s linear infinite;
}

@keyframes rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.chat-message.task-message .task-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: bold;
}

.chat-message.task-message .task-icon {
    font-size: 18px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

.chat-message.task-message .task-title {
    font-size: 14px;
    opacity: 0.9;
}

.chat-message.task-message .task-content {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 8px;
    font-weight: 500;
}

.chat-message.task-message .message-time {
    font-size: 12px;
    opacity: 0.7;
    text-align: right;
}

/* 游戏模式消息特殊样式 */
.chat-message.system.game-mode-change {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #d63384;
    border: 2px solid #e91e63;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.2);
    font-weight: 600;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.chat-message.system.game-mode-change::before {
    content: '🎮';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.chat-message.system.game-mode-change .message-text {
    padding-left: 30px;
}
