/* 更明显的闪烁效果 */
/* 更明显的闪烁效果 */
@keyframes pulse-orange {
    0% {
        box-shadow: 0 0 10px 5px rgba(255, 165, 0, 0.9);
    }

    50% {
        box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.6);
    }

    100% {
        box-shadow: 0 0 10px 5px rgba(255, 165, 0, 0.1);
    }
}

.button-glowing {
  animation: pulse-orange 1.5s infinite;
  margin: 15px; /* 为阴影扩展留出空间 */
}

.button-glowing {
    animation: pulse-orange 1s infinite ease-in-out;
    position: relative; /* 确保 box-shadow 能显示 */
    z-index: 1; /* 防止被其他元素遮挡 */
}



/* 橙色交换范围高亮 */


body {
    font-family: 'Arial', sans-serif;
    background-color: #1a2a3a;
    color: white;
    margin: 0;
    padding: 20px;
}


#skill-buttons {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 5px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

    #skill-buttons button {
        padding: 5px 10px;
        background: #4a5568;
        color: white;
        border: none;
        border-radius: 3px;
        cursor: pointer;
    }

        #skill-buttons button:hover {
            background: #2d3748;
        }

.game-container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(5, 100px);
    gap: 5px;
    margin-bottom: 20px;
    background-color: #2a3a4a;
    padding: 10px;
    border-radius: 10px;
}

.cell {
    background-color: #3a4a5a;
    border: 2px solid #4a5a6a;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

    .cell:hover {
        background-color: #4a5a6a;
    }

    .cell.highlight {
        border-color: gold;
        box-shadow: 0 0 10px gold;
    }

.unit.unoperated {
    box-shadow: 0 0 10px #00FF00; /* 绿色光效表示可操作 */
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 5px #00FF00;
    }

    50% {
        box-shadow: 0 0 15px #00FF00;
    }

    100% {
        box-shadow: 0 0 5px #00FF00;
    }
}

.cell.attackable {
    border-color: red;
    box-shadow: 0 0 10px red;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 5px red;
    }

    50% {
        box-shadow: 0 0 15px red;
    }

    100% {
        box-shadow: 0 0 5px red;
    }
}

.cell.movable {
    border-color: #4CAF50;
    box-shadow: 0 0 10px #4CAF50;
}

.base {
    background-color: #8b0000;
    font-weight: bold;
}

.unit {
    width: 80%;
    height: 80%;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 12px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.human {
    background-color: #4682b4;
}

.shadow {
    background-color: #483d8b;
}

.elemental {
    background-color: #cd5c5c;
}

.beast {
    background-color: #228b22;
}

.spell {
    background-color: #9370DB;
}

.unit-stats {
    position: absolute;
    bottom: 2px;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.player-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.player-header h2 {
    margin: 0;
}

.ai-toggle-btn {
    padding: 4px 8px;
    background-color: #4a5568;
    color: white;
    border: 1px solid #2d3748;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.ai-toggle-btn:hover {
    background-color: #2d3748;
}

.ai-toggle-btn.active {
    background-color: #48bb78;
    border-color: #38a169;
    box-shadow: 0 0 5px #48bb78;
}

.player-panel {
    background-color: #2a3a4a;
    padding: 10px;
    border-radius: 10px;
    width: 48%;
}

.hand {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    min-height: 120px;
    flex-wrap: wrap;
}

.card {
    width: 80px;
    height: 100px;
    background-color: #3a4a5a;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

    .card:hover {
        transform: translateY(-10px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }

    .card.selected {
        border: 2px solid gold;
        box-shadow: 0 0 10px gold;
    }

.controls {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 5px;
}

    button:disabled {
        background-color: #cccccc;
        cursor: not-allowed;
    }

.action-points {
    font-weight: bold;
    color: gold;
}

.health-bar {
    height: 20px;
    background-color: #333;
    border-radius: 10px;
    margin-top: 5px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background-color: #f00;
    width: 100%;
    transition: width 0.3s;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #2a3a4a;
    margin: 15% auto;
    padding: 20px;
    border-radius: 10px;
    width: 50%;
    text-align: center;
}

.tooltip {
    position: absolute;
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 5px;
    border-radius: 5px;
    z-index: 10;
    max-width: 200px;
    font-size: 12px;
    pointer-events: none;
}

.phase-indicator {
    padding: 10px;
    background-color: #3a4a5a;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
}

.placement-phase {
    background-color: #4682b4;
}

.battle-phase {
    background-color: #cd5c5c;
}

.connection-info {
    margin-bottom: 10px;
    padding: 5px;
    background-color: #2a3a4a;
    border-radius: 5px;
}

.chat-container {
    margin-top: 20px;
    padding: 10px;
    background-color: #2a3a4a;
    border-radius: 5px;
}

#chat-messages {
    height: 100px;
    overflow-y: scroll;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    padding: 5px;
}

#chat-input {
    width: 70%;
    padding: 5px;
    margin-right: 5px;
}

.shield-icon {
    position: absolute;
    top: 2px;
    right: 2px;
    color: gold;
    font-size: 10px;
}

.frozen {
    position: relative;
    filter: brightness(1.2) hue-rotate(180deg);
    opacity: 0.8;
}

    .frozen::after {
        content: "❄️";
        position: absolute;
        right: 5px;
        top: 5px;
        font-size: 1.2em;
    }

/* swappable高亮，用于暗影移动和野性祝福技能 */
.swappable {
    box-shadow: 0 0 8px 3px rgb(255, 136, 0);
    border: 2px solid orange;
    background: rgba(255, 215, 0, 0.15);
    transition: box-shadow 0.2s, border 0.2s, background 0.2s;
}

/* AI学习管理界面样式 */
.ai-learning-controls {
    background-color: #2a3a4a;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #4a5a6a;
}

.ai-learning-controls h3 {
    margin: 0 0 10px 0;
    color: #ffd700;
    text-align: center;
}

.ai-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #3a4a5a;
    border-radius: 5px;
}

.ai-stats span {
    font-weight: bold;
    color: #87ceeb;
}

.ai-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.ai-buttons button {
    padding: 8px 12px;
    background-color: #4a5a6a;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.ai-buttons button:hover {
    background-color: #5a6a7a;
}

.ai-buttons button:active {
    background-color: #3a4a5a;
}

/* 并行训练样式 */
.parallel-training {
    margin-top: 15px;
    padding: 10px;
    background-color: #3a4a5a;
    border-radius: 5px;
    border: 1px solid #4a5a6a;
}

.parallel-training h4 {
    margin: 0 0 10px 0;
    color: #ffd700;
    text-align: center;
}

.training-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.training-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #87ceeb;
}

.training-controls input {
    width: 60px;
    padding: 5px;
    border: 1px solid #4a5a6a;
    border-radius: 3px;
    background-color: #2a3a4a;
    color: white;
}

.training-status {
    display: flex;
    justify-content: space-around;
    font-size: 12px;
    color: #87ceeb;
}

/* 权重显示样式 */
.ai-weights {
    margin: 15px 0;
    padding: 10px;
    background-color: #3a4a5a;
    border-radius: 5px;
    border: 1px solid #4a5a6a;
}

.ai-weights h4 {
    margin: 0 0 10px 0;
    color: #ffd700;
    text-align: center;
}

.weight-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.weight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    background-color: #2a3a4a;
    border-radius: 3px;
    font-size: 12px;
}

.weight-item span:first-child {
    color: #87ceeb;
    font-weight: bold;
}

.weight-item span:last-child {
    color: #ffd700;
    font-family: monospace;
    font-weight: bold;
    }

/* 攻击动画：单位移动到目标再返回 */
.unit.attack-animating {
  z-index: 10;
  transition: transform 0.35s cubic-bezier(0.4, 0.2, 0.2, 1);
}

/* 伤害飘字动画 */
.damage-float {
  position: absolute;
  left: 50%;
  top: 10%;
  transform: translate(-50%, 0);
  color: #ff4444;
  font-size: 1.6em;
  font-weight: bold;
  pointer-events: none;
  opacity: 1;
  animation: damage-float-up 0.8s cubic-bezier(0.4, 0.2, 0.2, 1) forwards;
  text-shadow: 0 2px 8px #000a;
}
@keyframes damage-float-up {
  0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  60% { opacity: 1; transform: translate(-50%, -30px) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(1.1); }
    }

.unit.enemy-inactive {
    background: rgba(80,80,80,0.35) !important;
    filter: grayscale(0.5);
    }
