/**
 * 马年新春中国象棋 - 主样式
 * Horse Year Chinese Chess - Main Styles
 */

/* ==================== 全局样式 ==================== */
:root {
    /* 马年主题配色 */
    --primary-red: #C8102E;      /* 中国红 */
    --primary-gold: #FFD700;     /* 金色 */
    --primary-yellow: #FFF8DC;   /* 米黄色 */
    --primary-brown: #8B4513;    /* 棕色 */
    --primary-black: #2C2C2C;    /* 黑色 */
    
    /* 辅助颜色 */
    --success-green: #28a745;
    --info-blue: #17a2b8;
    --warning-orange: #ffc107;
    --danger-red: #dc3545;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-yellow) 0%, #FFE4B5 100%);
    color: var(--primary-black);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== 游戏容器 ==================== */
.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== 游戏标题 ==================== */
.game-header {
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(135deg, var(--primary-red), #E63946);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 3px solid var(--primary-gold);
}

.game-title {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.horse-icon {
    font-size: 40px;
    animation: horse-bounce 2s ease-in-out infinite;
}

@keyframes horse-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-subtitle {
    font-size: 18px;
    color: var(--primary-yellow);
    font-weight: 500;
}

/* ==================== 游戏主区域 ==================== */
.game-main {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 20px;
    flex: 1;
    margin-bottom: 20px;
}

/* ==================== 信息面板 ==================== */
.info-panel,
.decoration-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-card,
.decoration-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--primary-gold);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover,
.decoration-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.info-card h3,
.decoration-card h3 {
    font-size: 18px;
    color: var(--primary-red);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-yellow);
    font-weight: bold;
}

/* 玩家信息显示 */
.player-info {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-yellow), #FFE4B5);
    border: 2px solid var(--primary-gold);
    color: var(--primary-red);
}

/* 回合显示 */
.turn-display {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.turn-red {
    background: linear-gradient(135deg, var(--primary-red), #E63946);
    color: var(--primary-gold);
    border: 2px solid var(--primary-gold);
}

.turn-black {
    background: linear-gradient(135deg, var(--primary-black), #4A4A4A);
    color: var(--primary-gold);
    border: 2px solid var(--primary-gold);
}

.ai-thinking {
    text-align: center;
    color: var(--primary-red);
    font-size: 16px;
    padding: 10px;
    background: var(--primary-yellow);
    border-radius: var(--radius-md);
    margin-top: 10px;
}

.thinking-icon {
    display: inline-block;
    animation: thinking-spin 1s linear infinite;
}

@keyframes thinking-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 控制按钮 */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-red), #E63946);
    color: white;
    border: 2px solid var(--primary-gold);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #A00D25, #C82F3D);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--primary-black), #4A4A4A);
    color: white;
    border: 2px solid var(--primary-gold);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1C1C1C, #3A3A3A);
}

.btn-skill {
    background: linear-gradient(135deg, var(--warning-orange), #FFA500);
    color: white;
    border: 2px solid var(--primary-gold);
    font-size: 18px;
}

.btn-skill:hover:not(:disabled) {
    background: linear-gradient(135deg, #E6A100, #FF8C00);
}

/* 难度选择 */
.difficulty-select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid var(--primary-gold);
    border-radius: var(--radius-md);
    background: white;
    color: var(--primary-black);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.difficulty-select:focus {
    outline: none;
    border-color: var(--primary-red);
}

/* 技能提示 */
.skill-hint {
    font-size: 14px;
    color: var(--primary-black);
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    background: var(--primary-yellow);
    border-radius: var(--radius-sm);
}

/* 游戏规则 */
.rules-list {
    list-style: none;
    padding: 0;
}

.rules-list li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    font-size: 14px;
    color: var(--primary-black);
    border-bottom: 1px dashed var(--primary-yellow);
}

.rules-list li:last-child {
    border-bottom: none;
}

.rules-list li:before {
    content: '🎯';
    position: absolute;
    left: 0;
    top: 8px;
    font-size: 14px;
}

/* ==================== 棋盘容器 ==================== */
.board-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #DEB887, #D2B48C);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--primary-brown);
    position: relative;
    overflow: hidden;
}

.board-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><text x="10" y="50" font-size="20" opacity="0.1">🐴</text></svg>');
    background-size: 100px 100px;
    pointer-events: none;
}

/* ==================== 装饰面板 ==================== */
.new-year-decoration {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 15px;
}

.lantern {
    font-size: 48px;
    animation: lantern-swing 3s ease-in-out infinite;
}

.lantern:nth-child(3) {
    animation-delay: 1.5s;
}

@keyframes lantern-swing {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.cloud {
    font-size: 40px;
    animation: cloud-float 4s ease-in-out infinite;
}

@keyframes cloud-float {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

.new-year-message {
    text-align: center;
}

.new-year-message p {
    font-size: 18px;
    color: var(--primary-red);
    font-weight: bold;
    margin: 8px 0;
    padding: 8px;
    background: var(--primary-yellow);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-gold);
}

/* 技能类型说明 */
.skill-types {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skill-type-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--primary-yellow);
    border-radius: var(--radius-md);
    transition: transform 0.3s ease;
}

.skill-type-item:hover {
    transform: translateX(5px);
}

.skill-type-icon {
    font-size: 24px;
    min-width: 30px;
}

.skill-type-name {
    font-weight: bold;
    color: var(--primary-red);
    min-width: 70px;
}

.skill-type-desc {
    font-size: 12px;
    color: var(--primary-black);
    flex: 1;
}

/* ==================== 页脚 ==================== */
.game-footer {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-red), #E63946);
    color: var(--primary-gold);
    border-radius: var(--radius-lg);
    font-weight: bold;
    border: 2px solid var(--primary-gold);
    margin-top: auto;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1200px) {
    .game-main {
        grid-template-columns: 240px 1fr 240px;
        gap: 15px;
    }
    
    .info-card,
    .decoration-card {
        padding: 15px;
    }
}

@media (max-width: 992px) {
    .game-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .info-panel,
    .decoration-panel {
        grid-row: 2;
    }
    
    .board-container {
        grid-row: 1;
        order: -1;
    }
    
    .game-title {
        font-size: 28px;
    }
    
    .horse-icon {
        font-size: 32px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-header {
        padding: 15px 0;
    }
    
    .game-title {
        font-size: 24px;
        flex-direction: column;
    }
    
    .game-subtitle {
        font-size: 14px;
    }
    
    .info-card,
    .decoration-card {
        padding: 12px;
    }
}

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

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

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

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

/* ==================== 技能选择样式 ==================== */
/* 可选择的棋子高亮 */
.selectable-for-skill {
    animation: selectable-pulse 1.5s ease-in-out infinite;
    cursor: pointer;
    z-index: 10;
}

@keyframes selectable-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 5px var(--primary-gold)) drop-shadow(0 0 10px var(--primary-gold));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 15px var(--primary-gold)) drop-shadow(0 0 25px var(--primary-gold));
        transform: scale(1.05);
    }
}

/* 技能选择弹窗样式 */
.skill-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modal-fade-in 0.3s ease;
    backdrop-filter: blur(5px);
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.skill-selection-modal .modal-content {
    background: linear-gradient(135deg, var(--primary-yellow), #FFE4B5);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 4px solid var(--primary-gold);
    position: relative;
    animation: modal-slide-up 0.4s ease;
}

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

/* 装饰元素 */
.modal-decoration {
    position: absolute;
    display: flex;
    gap: 10px;
    z-index: 1;
    opacity: 0.6;
}

.modal-decoration.top {
    top: 20px;
    left: 30px;
}

.modal-decoration.bottom {
    bottom: 20px;
    right: 30px;
}

.lantern-left,
.lantern-right {
    font-size: 40px;
    animation: lantern-swing 3s ease-in-out infinite;
}

.lantern-right {
    animation-delay: 1.5s;
}

.cloud-left,
.cloud-right {
    font-size: 35px;
    animation: cloud-float 4s ease-in-out infinite;
}

.cloud-right {
    animation-delay: 2s;
}

@keyframes lantern-swing {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

@keyframes cloud-float {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

/* 标题区域 */
.modal-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.header-decoration {
    margin-bottom: 15px;
}

.header-decoration .horse-icon {
    font-size: 50px;
    animation: horse-gallop 2s ease-in-out infinite;
}

@keyframes horse-gallop {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    25% {
        transform: translateX(10px) rotate(5deg);
    }
    75% {
        transform: translateX(-10px) rotate(-5deg);
    }
}

.skill-selection-modal h2 {
    color: var(--primary-red);
    font-size: 32px;
    margin-bottom: 8px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header-subtitle {
    color: var(--primary-brown);
    font-size: 16px;
    font-weight: 500;
}

/* 技能卡片容器 */
.skills-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    position: relative;
    z-index: 2;
}

/* 技能卡片 */
.skill-card {
    background: white;
    border: 3px solid var(--primary-gold);
    border-radius: var(--radius-xl);
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    transition: left 0.5s ease;
}

.skill-card:hover::before {
    left: 100%;
}

.skill-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    border-color: var(--primary-red);
}

.skill-card.selected {
    transform: scale(0.95);
    opacity: 0.7;
}

.skill-card-decoration {
    position: absolute;
    top: 10px;
    right: 10px;
}

.sparkle {
    font-size: 20px;
    animation: sparkle-rotate 2s linear infinite;
}

@keyframes sparkle-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.skill-icon {
    font-size: 48px;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.skill-info {
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

.skill-card h3 {
    color: var(--primary-red);
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: bold;
}

.skill-type {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--primary-gold), #FFA500);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.skill-description {
    color: var(--primary-black);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.skill-card-footer {
    position: relative;
    z-index: 2;
}

.skill-hint {
    color: var(--primary-red);
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skill-card:hover .skill-hint {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .skills-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .skill-selection-modal .modal-content {
        padding: 30px;
    }
}

@media (max-width: 992px) {
    .skills-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .skill-selection-modal .modal-content {
        padding: 25px;
    }

    .skill-selection-modal h2 {
        font-size: 28px;
    }

    .skill-card {
        padding: 20px 15px;
    }

    .skill-icon {
        font-size: 40px;
    }

    .skill-card h3 {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .skill-selection-modal .modal-content {
        padding: 20px;
        max-width: 95%;
    }

    .skills-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .skill-selection-modal h2 {
        font-size: 24px;
    }

    .header-decoration .horse-icon {
        font-size: 40px;
    }

    .modal-decoration .lantern-left,
    .modal-decoration .lantern-right {
        font-size: 30px;
    }

    .modal-decoration .cloud-left,
    .modal-decoration .cloud-right {
        font-size: 25px;
    }
}

/* 游戏消息提示 */
.game-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: var(--radius-lg);
    font-size: 20px;
    font-weight: bold;
    z-index: 2000;
    animation: message-fade-in-out 3s ease forwards;
    border: 2px solid var(--primary-gold);
    text-align: center;
}

@keyframes message-fade-in-out {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    10%, 90% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* 阵营选择弹窗样式 */
.side-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modal-fade-in 0.3s ease;
}

.side-selection-modal .modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 800px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--primary-gold);
}

.side-selection-modal h2 {
    text-align: center;
    color: var(--primary-red);
    font-size: 32px;
    margin-bottom: 15px;
    font-weight: bold;
}

.side-selection-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-top: 30px;
}

.side-card {
    background: linear-gradient(135deg, var(--primary-yellow), #FFE4B5);
    border: 3px solid var(--primary-gold);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.side-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-red);
}

.side-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.side-card h3 {
    color: var(--primary-red);
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: bold;
}

.side-card p {
    color: var(--primary-black);
    font-size: 16px;
}