/**
 * 千智风声 - 大厅页面样式
 * 谍战风格暗色主题
 */

/* ==================== CSS变量定义 ==================== */
:root {
    /* 主色调 */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    
    /* 阵营颜色 */
    --color-red: #e94560;
    --color-red-dark: #c73e54;
    --color-blue: #0f3460;
    --color-blue-light: #1a4a7a;
    --color-yellow: #f4d03f;
    --color-black: #2c2c2c;
    
    /* 文字颜色 */
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    
    /* 强调色 */
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    
    /* 边框 */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 10px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    
    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ==================== 背景装饰 ==================== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.spy-icon {
    position: absolute;
    font-size: 3rem;
    opacity: 0.05;
    animation: float 6s ease-in-out infinite;
}

.spy-1 { top: 10%; left: 10%; animation-delay: 0s; }
.spy-2 { top: 20%; right: 15%; animation-delay: 1s; }
.spy-3 { bottom: 30%; left: 8%; animation-delay: 2s; }
.spy-4 { bottom: 15%; right: 10%; animation-delay: 3s; }

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

/* ==================== 主容器 ==================== */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* ==================== 游戏标题 ==================== */
.game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.game-title {
    font-size: 3.5rem;
    font-weight: bold;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.title-red {
    color: var(--color-red);
    text-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
}

.title-blue {
    color: var(--color-blue-light);
    text-shadow: 0 0 20px rgba(15, 52, 96, 0.8);
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
}

/* ==================== 登录区域 ==================== */
.login-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* 输入标签 */
.input-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* 昵称输入区域 */
.nickname-area {
    margin-bottom: 1.5rem;
}

.nickname-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.nickname-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

.nickname-input::placeholder {
    color: var(--text-muted);
}

.input-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ==================== 头像选择区域 ==================== */
.avatar-area {
    margin-bottom: 1.5rem;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.avatar-item {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    border: 3px solid transparent;
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.avatar-item:hover {
    transform: scale(1.05);
    border-color: var(--border-color);
}

.avatar-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.4);
}

.avatar-item.selected::after {
    content: '✓';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* ==================== 按钮样式 ==================== */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, var(--accent) 0%, var(--color-red-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(233, 69, 96, 0.4);
}

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

.btn-secondary {
    flex: 1;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--color-blue-light);
    border-color: var(--accent);
}

.btn-text {
    width: 100%;
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
    font-size: 0.9rem;
}

.btn-text:hover {
    color: var(--accent);
}

.btn-icon {
    font-size: 1.1rem;
}

/* ==================== 弹窗样式 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 600px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

/* 房间号输入 */
.room-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 0.5em;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.room-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* 数字键盘 */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.num-btn {
    padding: 1rem;
    font-size: 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.num-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.num-btn:active {
    transform: scale(0.95);
}

.num-btn-clear {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.num-btn-back {
    font-size: 1rem;
}

/* ==================== 规则说明样式 ==================== */
.rules-body {
    padding-right: 0.5rem;
}

.rules-body::-webkit-scrollbar {
    width: 6px;
}

.rules-body::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.rules-body::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.rules-section {
    margin-bottom: 1.5rem;
}

.rules-section h4 {
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.rules-section h5 {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0.75rem 0 0.5rem;
}

.rules-section p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.rules-section ul {
    list-style: none;
    padding-left: 0;
}

.rules-section li {
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

/* 身份卡片 */
.identity-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.identity-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    border: 2px solid transparent;
}

.identity-card.red {
    border-color: var(--color-red);
}

.identity-card.blue {
    border-color: var(--color-blue-light);
}

.identity-card.yellow {
    border-color: var(--color-yellow);
}

.identity-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.identity-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.identity-card.red .identity-name {
    color: var(--color-red);
}

.identity-card.blue .identity-name {
    color: var(--color-blue-light);
}

.identity-card.yellow .identity-name {
    color: var(--color-yellow);
}

.identity-goal {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* 颜色点 */
.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.color-dot.red {
    background: var(--color-red);
}

.color-dot.blue {
    background: var(--color-blue-light);
}

.color-dot.black {
    background: var(--color-black);
    border: 1px solid var(--border-color);
}

/* 功能标签 */
.function-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.function-tag {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* 游戏流程 */
.game-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none !important;
    padding-left: 0 !important;
}

.game-flow li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
}

.flow-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

/* ==================== 消息提示 ==================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.875rem 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.25rem;
}

/* ==================== 加载动画 ==================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    z-index: 3000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================== 页脚 ==================== */
.game-footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 480px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .game-subtitle {
        font-size: 0.9rem;
    }
    
    .login-section {
        padding: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .identity-cards {
        grid-template-columns: 1fr;
    }
    
    .game-flow {
        flex-direction: column;
    }
}

@media (min-width: 768px) {
    .main-container {
        padding: 3rem;
    }
    
    .login-section {
        padding: 2.5rem;
    }
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
