/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #16213e 100%);
    color: #e0e0ff;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding-bottom: 120px;
}

/* 头部样式 */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(10, 15, 35, 0.8);
    border-radius: 15px;
    border: 2px solid #4a4a9a;
    box-shadow: 0 0 20px rgba(74, 74, 154, 0.3);
}

.game-header h1 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 3.2rem;
    color: #9d7bd8;
    text-shadow: 0 0 10px #9d7bd8, 0 0 20px #7b5fb8;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.4rem;
    color: #a0c8ff;
    font-weight: 300;
}

/* 游戏区域 */
.game-area {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.player-area {
    background: rgba(15, 20, 40, 0.85);
    border-radius: 15px;
    padding: 20px;
    border: 2px solid;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.ai-area {
    border-color: #ff6b6b;
}

.player-area.player-area {
    border-color: #4ecdc4;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.player-header h2 {
    font-size: 1.8rem;
    color: #ffcc5c;
}

.ai-area .player-header h2 {
    color: #ff9a8b;
}

.player-area .player-header h2 {
    color: #4ecdc4;
}

.health-bar-container {
    width: 250px;
}

.health-bar-label {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #a0c8ff;
    font-weight: bold;
}

.health-bar {
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #4a4a9a;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff416c, #ff4b2b);
    width: 100%;
    transition: width 0.5s ease;
}

.ai-area .health-fill {
    background: linear-gradient(90deg, #ff6b6b, #ff8e53);
}

.player-area .health-fill {
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
}

/* 五行之力区域 */
.elements-area {
    margin-bottom: 25px;
}

.elements-area h3 {
    font-size: 1.4rem;
    color: #ffcc5c;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.elements-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.element-box {
    background: rgba(30, 35, 65, 0.8);
    border-radius: 10px;
    padding: 15px 10px;
    text-align: center;
    border: 2px solid;
    transition: all 0.3s ease;
}

.element-box[data-element="metal"] {
    border-color: #ffd166;
}

.element-box[data-element="water"] {
    border-color: #118ab2;
}

.element-box[data-element="wood"] {
    border-color: #06d6a0;
}

.element-box[data-element="fire"] {
    border-color: #ef476f;
}

.element-box[data-element="earth"] {
    border-color: #9d7bd8;
}

.element-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.element-box[data-element="metal"] .element-icon {
    color: #ffd166;
}

.element-box[data-element="water"] .element-icon {
    color: #118ab2;
}

.element-box[data-element="wood"] .element-icon {
    color: #06d6a0;
}

.element-box[data-element="fire"] .element-icon {
    color: #ef476f;
}

.element-box[data-element="earth"] .element-icon {
    color: #9d7bd8;
}

.element-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.element-status {
    font-size: 0.9rem;
    color: #aaa;
}

.element-box.active {
    box-shadow: 0 0 15px;
    transform: translateY(-5px);
}

.element-box[data-element="metal"].active {
    box-shadow: 0 0 15px #ffd166;
    background: rgba(255, 209, 102, 0.1);
}

.element-box[data-element="water"].active {
    box-shadow: 0 0 15px #118ab2;
    background: rgba(17, 138, 178, 0.1);
}

.element-box[data-element="wood"].active {
    box-shadow: 0 0 15px #06d6a0;
    background: rgba(6, 214, 160, 0.1);
}

.element-box[data-element="fire"].active {
    box-shadow: 0 0 15px #ef476f;
    background: rgba(239, 71, 111, 0.1);
}

.element-box[data-element="earth"].active {
    box-shadow: 0 0 15px #9d7bd8;
    background: rgba(157, 123, 216, 0.1);
}

.element-box.active .element-status {
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 5px;
}

/* 牌库区域 */
.deck-area, .hand-area {
    margin-bottom: 25px;
}

.deck-area h3, .hand-area h3 {
    font-size: 1.4rem;
    color: #ffcc5c;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 手牌区域 */
.hand-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    min-height: 150px;
}

.card {
    background: linear-gradient(135deg, rgba(40, 45, 75, 0.9), rgba(25, 30, 55, 0.9));
    border-radius: 10px;
    padding: 12px;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.card.selected {
    transform: translateY(-15px);
    box-shadow: 0 0 25px;
}

.card.metal {
    border-color: #ffd166;
}

.card.water {
    border-color: #118ab2;
}

.card.wood {
    border-color: #06d6a0;
}

.card.fire {
    border-color: #ef476f;
}

.card.earth {
    border-color: #9d7bd8;
}

.card.skill-available {
    animation: pulse 2s infinite;
}

/* AI卡牌背面样式 */
.ai-card {
    background: linear-gradient(135deg, rgba(50, 55, 85, 0.8), rgba(30, 35, 60, 0.8));
    border-color: #777 !important;
    color: #aaa;
    cursor: default;
}

.ai-card .card-name,
.ai-card .card-attribute,
.ai-card .card-function,
.ai-card .card-skill,
.ai-card .card-description {
    color: #aaa;
    opacity: 0.7;
}

.ai-card .card-type {
    background: rgba(120, 120, 120, 0.3);
    color: #bbb;
}

.ai-card:hover {
    transform: none;
    box-shadow: none;
}

@keyframes pulse {
    0% { box-shadow: 0 0 5px; }
    50% { box-shadow: 0 0 20px; }
    100% { box-shadow: 0 0 5px; }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #fff;
}

.card-type {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.card-type.qi {
    background: rgba(107, 229, 133, 0.3);
    color: #6be585;
}

.card-type.building {
    background: rgba(66, 153, 225, 0.3);
    color: #4299e1;
}

.card-type.golden {
    background: rgba(246, 201, 14, 0.3);
    color: #f6c90e;
}

.card-type.infancy {
    background: rgba(214, 69, 65, 0.3);
    color: #d64541;
}

.card-attribute {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.card-function, .card-skill {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #ccc;
}

.card-function span, .card-skill span {
    color: #ffcc5c;
}

.card-skill {
    color: #9d7bd8;
}

/* 比牌区域 */
.battle-area {
    background: rgba(10, 15, 35, 0.9);
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #9d7bd8;
    box-shadow: 0 0 25px rgba(157, 123, 216, 0.3);
}

.battle-area h2 {
    text-align: center;
    font-size: 2.2rem;
    color: #9d7bd8;
    margin-bottom: 25px;
    text-shadow: 0 0 10px #9d7bd8;
}

.battle-cards {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.battle-card-slot {
    width: 45%;
}

.slot-label {
    text-align: center;
    font-size: 1.3rem;
    color: #ffcc5c;
    margin-bottom: 15px;
}

.ai-slot .slot-label {
    color: #ff9a8b;
}

.player-slot .slot-label {
    color: #4ecdc4;
}

.card-placeholder {
    background: rgba(30, 35, 65, 0.8);
    border-radius: 15px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px dashed #4a4a9a;
    transition: all 0.3s ease;
}

.card-placeholder.active {
    border-style: solid;
    border-color: #9d7bd8;
    box-shadow: 0 0 20px rgba(157, 123, 216, 0.5);
}

.placeholder-text {
    color: #888;
    font-size: 1.2rem;
    text-align: center;
}

.battle-card {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.vs-circle {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #0a0a1a, #1a1a2e);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid #9d7bd8;
    box-shadow: 0 0 20px rgba(157, 123, 216, 0.5);
}

.vs-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 0 0 10px #ff6b6b;
}

.relation-display {
    font-size: 1.2rem;
    color: #ffcc5c;
    margin-top: 5px;
    text-align: center;
}

/* 战报区域 */
.battle-log {
    margin-bottom: 25px;
}

.battle-log h3 {
    font-size: 1.4rem;
    color: #ffcc5c;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-content {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 15px;
    height: 200px;
    overflow-y: auto;
    border: 1px solid #4a4a9a;
}

.log-entry {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    background: rgba(30, 35, 65, 0.5);
    border-left: 4px solid #9d7bd8;
}

.log-entry.player {
    border-left-color: #4ecdc4;
}

.log-entry.ai {
    border-left-color: #ff6b6b;
}

.log-entry.system {
    border-left-color: #ffcc5c;
}

/* 回合信息 */
.round-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(30, 35, 65, 0.8);
    border-radius: 10px;
    border: 1px solid #4a4a9a;
}

.round-counter {
    font-size: 1.3rem;
    color: #a0c8ff;
}

.turn-indicator {
    font-size: 1.3rem;
    color: #ffcc5c;
    font-weight: bold;
    padding: 8px 15px;
    background: rgba(157, 123, 216, 0.2);
    border-radius: 20px;
}

/* 控制区域 */
.control-area {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: rgba(15, 20, 40, 0.95);
    border-radius: 15px;
    border: 2px solid #4a4a9a;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    width: 90%;
    max-width: 1200px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.7);
}

.btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Noto Serif SC', serif;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 180px;
}

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

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

.btn-primary {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #06d6a0, #06a080);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffd166, #ffb142);
    color: #333;
}

.btn-info {
    background: linear-gradient(135deg, #118ab2, #0d6b8a);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #9d7bd8, #7b5fb8);
    color: white;
}

/* 页脚 */
.game-footer {
    text-align: center;
    padding: 20px;
    background: rgba(10, 15, 35, 0.8);
    border-radius: 15px;
    border: 2px solid #4a4a9a;
    font-size: 0.95rem;
    color: #a0c8ff;
}

.game-footer p {
    margin-bottom: 10px;
}

.warning-text {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 1.1rem;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #0a0a1a, #1a1a2e);
    width: 800px;
    max-width: 90%;
    border-radius: 15px;
    border: 3px solid #9d7bd8;
    box-shadow: 0 0 40px rgba(157, 123, 216, 0.5);
    overflow: hidden;
}

.modal-header {
    background: rgba(157, 123, 216, 0.2);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #9d7bd8;
}

.modal-header h2 {
    color: #ffcc5c;
    font-size: 2rem;
}

.close-modal {
    font-size: 2.5rem;
    color: #ff6b6b;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #ff9a8b;
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.rule-section {
    margin-bottom: 30px;
}

.rule-section h3 {
    color: #4ecdc4;
    font-size: 1.6rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rule-section p {
    color: #a0c8ff;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.rule-section ul {
    list-style-type: none;
    padding-left: 20px;
}

.rule-section li {
    color: #e0e0ff;
    margin-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid #ffcc5c;
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .game-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .hand-cards {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .elements-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: 2.5rem;
    }
    
    .player-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .health-bar-container {
        width: 100%;
    }
    
    .hand-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .elements-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .battle-cards {
        flex-direction: column;
        gap: 30px;
    }
    
    .battle-card-slot {
        width: 100%;
    }
    
    .vs-circle {
        order: -1;
        margin-bottom: 30px;
    }
    
    .container {
        padding-bottom: 180px;
    }
    
    .control-area {
        flex-direction: column;
        align-items: center;
        width: 95%;
        left: 2.5%;
        transform: translateX(0);
        padding: 15px;
        bottom: 10px;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 2rem;
    }
    
    .hand-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .elements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 卡牌详情模态框样式 */
.card-detail {
    max-width: 700px;
}

.card-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(157, 123, 216, 0.3);
}

.card-detail-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.card-detail-actions {
    display: flex;
    align-items: center;
}

.card-detail-name {
    font-size: 2.2rem;
    font-weight: bold;
    color: #ffcc5c;
    flex: 1;
}

.card-detail-type {
    font-size: 1.2rem;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(157, 123, 216, 0.2);
    color: #9d7bd8;
    border: 1px solid #9d7bd8;
}

.card-detail-element {
    font-size: 1.8rem;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
}

.card-detail-description {
    font-size: 1.3rem;
    color: #a0c8ff;
    margin-bottom: 25px;
    line-height: 1.6;
    padding: 15px;
    background: rgba(30, 35, 65, 0.5);
    border-radius: 10px;
    border-left: 4px solid #4ecdc4;
}

.card-detail-section {
    margin-bottom: 25px;
}

.card-detail-section h3 {
    color: #ffcc5c;
    font-size: 1.5rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-detail-function,
.card-detail-skill,
.card-detail-backstory {
    font-size: 1.2rem;
    color: #e0e0ff;
    padding: 15px;
    background: rgba(40, 45, 75, 0.6);
    border-radius: 10px;
    line-height: 1.5;
}

.card-detail-function span,
.card-detail-skill span {
    color: #ffcc5c;
    font-weight: bold;
}

/* 元素颜色 */
.card-detail-element.metal { color: #ffd166; background: rgba(255, 209, 102, 0.1); }
.card-detail-element.water { color: #118ab2; background: rgba(17, 138, 178, 0.1); }
.card-detail-element.wood { color: #06d6a0; background: rgba(6, 214, 160, 0.1); }
.card-detail-element.fire { color: #ef476f; background: rgba(239, 71, 111, 0.1); }
.card-detail-element.earth { color: #9d7bd8; background: rgba(157, 123, 216, 0.1); }

/* 类型颜色 */
.card-detail-type.qi { background: rgba(107, 229, 133, 0.2); color: #6be585; border-color: #6be585; }
.card-detail-type.building { background: rgba(66, 153, 225, 0.2); color: #4299e1; border-color: #4299e1; }
.card-detail-type.golden { background: rgba(246, 201, 14, 0.2); color: #f6c90e; border-color: #f6c90e; }
.card-detail-type.infancy { background: rgba(214, 69, 65, 0.2); color: #d64541; border-color: #d64541; }

/* 响应式调整 */
@media (max-width: 768px) {
    .card-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .card-detail-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-detail-name {
        font-size: 1.8rem;
    }
    
    .card-detail-element {
        font-size: 1.5rem;
    }
    
    .card-detail-actions {
        align-self: stretch;
        margin-top: 10px;
    }
}

/* 天道战报模态框 */
.log-modal-content {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
}

.log-modal-content .log-entry {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    background: rgba(30, 35, 65, 0.5);
    border-left: 4px solid #9d7bd8;
}

.log-modal-content .log-entry.player {
    border-left-color: #4ecdc4;
}

.log-modal-content .log-entry.ai {
    border-left-color: #ff6b6b;
}

.log-modal-content .log-entry.system {
    border-left-color: #ffcc5c;
}

/* 浮动提示样式 */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: rgba(20, 25, 45, 0.95);
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border: 2px solid #9d7bd8;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    max-width: 600px;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.player {
    border-color: #4ecdc4;
    background: rgba(20, 25, 45, 0.95);
}

.toast.ai {
    border-color: #ff6b6b;
    background: rgba(20, 25, 45, 0.95);
}

.toast.system {
    border-color: #ffcc5c;
    background: rgba(20, 25, 45, 0.95);
}