/* 黄金矿工主题样式 - 卡通设计 */
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,400;0,700;1,400&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Comic Neue', 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #F59E0B; /* 金色主题 */
    --primary-light: #FEF3C7;
    --secondary: #8B5CF6; /* 紫色辅助 */
    --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);
}

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(--primary);
    border-radius: 2px;
}

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

.nickname-display {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--primary-light);
    border-radius: 10px;
    font-size: 16px;
    text-align: center;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

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

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

.form-group input {
    width: 100%;
    padding: 12px 15px;
    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(245, 158, 11, 0.1);
}

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

.input-button-group {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-button-group input {
    flex: 1;
    padding: 12px 15px;
    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;
}

.input-button-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.input-button-group button {
    padding: 12px 20px;
    font-size: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.input-button-group button:hover {
    background: #D97706;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.button-group button {
    flex: 1;
    max-width: 200px;
}

.room-list-section {
    margin-bottom: 20px;
    text-align: left;
}

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

.room-list-section h4::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.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 15px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.room-id {
    font-weight: 600;
    color: var(--primary);
    font-size: 18px;
}

.room-count {
    font-size: 14px;
    color: var(--gray);
    display: flex;
    align-items: center;
}

.room-count::before {
    content: "👥";
    margin-right: 5px;
    font-size: 16px;
}

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

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

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

.join-room-btn:hover:not(:disabled) {
    background: #D97706;
    transform: translateY(-1px);
}

.join-room-btn:disabled {
    background: var(--gray);
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 按钮通用样式 */
button {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

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

button:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

button:disabled {
    background: var(--gray);
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

button.btn-secondary {
    background: var(--gray);
}

button.btn-secondary:hover {
    background: #4B5563;
}

button.btn-success {
    background: var(--success);
}

button.btn-success:hover {
    background: #059669;
}

button.btn-danger {
    background: var(--danger);
}

button.btn-danger:hover {
    background: #DC2626;
}

/* 游戏房间面板 */
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    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;
    justify-content: space-around;
    margin-bottom: 25px;
    gap: 20px;
}

.player-card {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 12px;
    flex: 1;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

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

.player-card .player-role {
    font-size: 24px;
    margin-bottom: 15px;
    color: #374151;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.player-card .win-count {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--primary);
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.ready-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ready-btn:hover {
    background: #D97706;
    transform: translateY(-1px);
}

/* 游戏画布样式 */
.score-panel {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.score-panel div {
    background: var(--light-gray);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: #374151;
    box-shadow: var(--shadow);
}

#gameCanvas {
    border: 2px solid var(--border);
    width: 100%;
    max-width: 800px;
    height: auto;
    background: linear-gradient(45deg, #8B4513 0%, #A0522D 50%, #CD853F 100%);
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.1) 0%, transparent 50%),
        linear-gradient(45deg, #8B4513 0%, #A0522D 50%, #CD853F 100%);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.game-controls {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.game-controls button {
    font-size: 16px;
    padding: 12px 24px;
    margin: 0;
}

/* 游戏开始后隐藏的元素 */
.game-started-hidden {
    display: none !important;
}

/* 响应式适配 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .panel {
        padding: 20px;
    }
    
    .players-list {
        flex-direction: column;
        gap: 15px;
    }

    .player-card {
        width: 100%;
    }

    .room-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    #gameCanvas {
        width: 100%;
        height: 300px;
    }

    .game-controls {
        flex-direction: column;
        align-items: center;
    }

    .game-controls button {
        width: 80%;
        margin: 5px 0;
    }
    
    .input-button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .input-button-group input {
        width: 100%;
    }
    
    .input-button-group button {
        width: 100%;
    }
    
    .button-group {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .button-group button {
        width: 45%;
        margin: 5px;
        flex: 0 0 auto;
    }
}

/* 胜利弹窗样式 */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 9999 !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
}

/* 显示遮罩层的类，确保覆盖display: none !important */
.modal-overlay.show {
    display: flex !important;
}

.victory-modal-wrapper {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.victory-modal {
    position: relative !important;
    z-index: 10000 !important;
    background: white !important;
    border-radius: 16px !important;
    padding: 40px !important;
    box-shadow: var(--shadow-lg) !important;
    text-align: center !important;
    min-width: 400px !important;
    max-width: 600px !important;
    margin: 0 auto !important;
}

.victory-modal h2 {
    color: var(--primary) !important;
    font-size: 28px !important;
    margin-bottom: 20px !important;
    font-weight: 700 !important;
}

.victory-modal p {
    font-size: 18px !important;
    margin-bottom: 25px !important;
    color: #374151 !important;
    font-weight: 500 !important;
}

.score-board {
    margin: 25px 0 !important;
    padding: 20px !important;
    background: var(--light-gray) !important;
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
}

.score-item {
    font-size: 18px !important;
    margin: 10px 0 !important;
    color: #374151 !important;
    font-weight: 600 !important;
}

.restart-btn, .leave-btn {
    padding: 12px 24px !important;
    margin: 0 10px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
}

.restart-btn {
    background: var(--primary) !important;
    color: white !important;
}

.restart-btn:hover {
    background: #D97706 !important;
    transform: translateY(-2px) !important;
}

.leave-btn {
    background: var(--danger) !important;
    color: white !important;
}

.leave-btn:hover {
    background: #DC2626 !important;
    transform: translateY(-2px) !important;
}

/* 自定义提示组件样式 */
.custom-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 80%;
    transition: all 0.3s ease;
    animation: slideDown 0.3s ease-out;
}

.custom-notification.error {
    border-left-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.custom-notification.success {
    border-left-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.notification-content {
    color: #374151;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

.custom-notification.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}