/* 色块占比竞技场样式 - 简约美观设计 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #8B5CF6; /* 紫色主题，与index页面一致 */
    --primary-light: #F3E8FF;
    --secondary: #7C3AED;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --gray: #6B7280;
    --light-gray: #F3F4F6;
    --border: #E5E7EB;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --gradient-primary: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    padding: 20px;
    color: #1F2937;
    min-height: 100vh;
}

/* 通用面板样式 */
.panel {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.hidden {
    display: none !important;
}

.show {
    display: flex !important;
}

.error {
    color: var(--danger);
    margin-top: 10px;
    margin-bottom: 15px;
    min-height: 20px;
    text-align: center;
    font-size: 14px;
}

.success {
    color: var(--success) !important;
}

/* 房间创建面板 */
#roomPanel h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 30px;
    font-size: 32px;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

#roomPanel h1::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* 主菜单面板样式 */
#mainMenuPanel h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 40px; /* 增加与下方元素的间距 */
    font-size: 32px;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

#mainMenuPanel h1::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.nickname-display {
    margin-top: 20px; /* 增加与上方元素的间距 */
    margin-bottom: 20px;
    padding: 15px;
    background: var(--primary-light);
    border-radius: 10px;
    font-size: 16px;
    text-align: center;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

#nicknameDisplay {
    font-weight: 600;
    color: var(--primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 16px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    background: white;
    color: #1F2937;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-group input::placeholder {
    color: #9CA3AF;
}

.button-group {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 房间加入区域 - 横向布局 */
.room-join-section {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 20px;
}

.room-join-section .form-group.inline {
    flex: 1;
    margin-bottom: 0;
}

.room-join-section .form-group.inline label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 16px;
}

.room-join-section .form-group.inline input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    background: white;
    color: #1F2937;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.room-join-section .form-group.inline input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.room-join-section .button-group.inline {
    flex: none;
    margin-bottom: 0;
    display: flex;
    gap: 10px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#createRoomBtn {
    background: var(--gradient-primary);
}

#joinRoomBtn {
    background: var(--gradient-primary);
}

#copyLinkBtn {
    background: var(--gradient-primary);
}

#leaveRoomBtn {
    background: #9CA3AF;
}

#leaveRoomBtn:hover {
    background: #6B7280;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#startGameBtn {
    background: var(--gradient-primary);
    font-size: 18px;
    padding: 15px 30px;
}

#restartGameBtn {
    background: var(--gradient-success);
}

#leaveGameBtn {
    background: var(--gradient-danger);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button:active {
    transform: translateY(0);
}

/* 房间列表样式 */
.room-list-section {
    margin-top: 20px;
}

.room-list-section h4 {
    color: #374151;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.room-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--light-gray);
}

.room-item {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.room-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-grow: 1;
}

/* 夸张的房间号样式 */
.room-id {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 2px 2px 4px rgba(139, 92, 246, 0.3);
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 15px;
    min-width: 100px;
    text-align: center;
    letter-spacing: 2px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 玩家图标样式 */
.player-count {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 15px;
}

.player-icon {
    font-size: 18px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: all 0.2s;
}

.player-icon.empty {
    opacity: 0.3;
    filter: grayscale(100%);
}

.player-icon:not(.empty):hover {
    transform: scale(1.2);
}

.game-status {
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 12px;
}

.status-waiting {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.status-playing {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.join-room-btn {
    margin-left: 10px;
    padding: 6px 12px;
    font-size: 14px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.join-room-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.join-room-btn:disabled {
    background: #9CA3AF;
    color: #E5E7EB;
    cursor: not-allowed;
    transform: none;
}

/* 游戏房间界面 */
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.room-header h2 {
    color: var(--primary);
    font-size: 24px;
    font-weight: 600;
}

.players-list {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.player-card, .game-stats {
    flex: 1;
    background: var(--light-gray);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.player-card h3, .game-stats h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.player-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.player-name {
    flex-grow: 1;
    font-weight: 500;
}

.player-percentage {
    font-weight: 600;
    font-size: 16px;
    color: var(--primary);
    margin-left: 10px;
}

.player-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 8px;
}

.player-item span {
    display: inline-block;
}

.ready-indicator {
    color: var(--success);
    font-weight: bold;
    margin-left: 8px;
}

/* 游戏控制区 */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-gray);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.countdown-container h3 {
    color: var(--primary);
    font-size: 20px;
    font-weight: 600;
}

#gameCountdown {
    color: var(--warning);
    font-weight: 700;
}

/* 游戏画布 */
#gameCanvasPanel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#gameCanvas {
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    box-shadow: var(--shadow);
}

/* 技能面板 */
.skills-panel {
    background: var(--light-gray);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    width: 100%;
}

.skills-panel h3 {
    color: var(--primary);
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.skill-list {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 80px;
}

.skill-key {
    background: var(--gradient-primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    margin-bottom: 5px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 技能冷却状态 - 灰色效果 */
.skill-key.on-cooldown {
    background: #9CA3AF !important;
    filter: grayscale(100%);
}

/* 技能持续状态 - 带圆圈进度条效果 */
.skill-key.on-duration {
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.3);
    position: relative;
}

/* 圆圈进度条容器 */
.skill-key.on-duration::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0deg, transparent 0deg);
    z-index: -1;
    animation: skillDurationProgress linear forwards;
}

/* 进度条动画 */
@keyframes skillDurationProgress {
    from { background: conic-gradient(var(--primary) 0deg, transparent 0deg); }
    to { background: conic-gradient(var(--primary) 360deg, transparent 0deg); }
}

.skill-name {
    font-size: 12px;
    text-align: center;
    color: #4B5563;
}

.skill-cooldown {
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.skill-cooldown.active {
    opacity: 1;
}

/* 技能持续时间显示 */
.skill-duration {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--primary);
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skill-duration.active {
    opacity: 1;
}

/* 游戏结算界面 */
#gameResultPanel {
    text-align: center;
}

#gameResultPanel h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 700;
}

/* 最终画布容器样式 */
.final-canvas-container {
    margin: 0 auto 30px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: inline-block;
}

.final-canvas-container h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
}

#finalGameCanvas {
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
    max-width: 100%;
    height: auto;
}

.final-stats {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.result-item.winner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.result-rank {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    width: 50px;
    text-align: center;
}

.result-item.winner .result-rank {
    color: var(--warning);
}

.result-player {
    display: flex;
    align-items: center;
    flex-grow: 1;
    margin-left: 15px;
    font-size: 18px;
    font-weight: 500;
}

.result-proportion {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.result-item.winner .result-proportion {
    color: var(--warning);
}

.result-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .panel {
        width: 95%;
        padding: 20px;
    }
    
    .players-list {
        flex-direction: column;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .skill-list {
        gap: 10px;
    }
    
    .skill-item {
        width: 60px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 600px;
        height: auto;
    }
}

/* 技能提示样式 */
.skill-notification {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    z-index: 9999;
    border: 2px solid;
    animation: fadeInOut 3s ease-in-out;
    pointer-events: none;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* 游戏时间显示 */
.game-time {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 100;
}

/* 颜色占比显示 */
.color-proportions {
    margin-top: 15px;
    padding: 10px;
    background: var(--light-gray);
    border-radius: 8px;
    border: 1px solid var(--border);
}