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

body {
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.game-container {
    max-width: 1200px;
    width: 100%;
    padding: 20px;
}

/* 标题区域 */
.title-area {
    text-align: center;
    margin-bottom: 15px;
}

.main-title {
    font-size: 2.5rem;
    background: linear-gradient(45deg, #f39c12, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 5px;
}

.sub-title {
    font-size: 1.1rem;
    color: #95a5a6;
    font-weight: normal;
}

/* 顶部栏 */
.top-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: #fff;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.btn-small {
    padding: 6px 15px;
    font-size: 0.9rem;
}

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

/* 玩家信息区域 */
.players-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 20px;
}

.player-card {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 15px 20px;
    text-align: center;
    min-width: 150px;
    transition: all 0.3s ease;
}

.player-card.active {
    background: rgba(241, 196, 15, 0.2);
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.3);
}

.player-name {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.player-stone {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

#playerCard .player-stone {
    color: #2c3e50;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#computerCard .player-stone {
    color: #ecf0f1;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.skill-points {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.sp-label {
    font-size: 0.9rem;
    color: #bdc3c7;
}

.sp-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #f39c12;
}

.sp-popup {
    position: absolute;
    top: -30px;
    font-size: 1.8rem;
    font-weight: bold;
    color: #27ae60;
    opacity: 0;
    pointer-events: none;
}

.sp-popup.show {
    animation: sppopup 1s ease-out;
}

@keyframes sppopup {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(1.5);
    }
}

/* 回合指示器 */
.turn-indicator {
    font-size: 1.3rem;
    font-weight: bold;
    color: #f39c12;
    text-align: center;
}

/* 倒计时区域 */
.timer-area {
    text-align: center;
    margin-bottom: 15px;
}

.timer-bar {
    width: 200px;
    height: 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    margin: 0 auto 8px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 5px;
    transition: width 0.1s linear, background 0.3s ease;
}

.timer-fill.warning {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    animation: timerpulse 0.5s ease infinite;
}

@keyframes timerpulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.timer-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #3498db;
}

.timer-text.warning {
    color: #e74c3c;
    animation: textpulse 0.5s ease infinite;
}

@keyframes textpulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 消息区域 */
.message-area {
    text-align: center;
    min-height: 30px;
    margin-bottom: 15px;
}

.message {
    font-size: 1.1rem;
    padding: 8px 15px;
    background: rgba(52, 152, 219, 0.3);
    border-radius: 8px;
    display: inline-block;
    animation: messagefade 0.3s ease;
}

.message.skill {
    background: rgba(155, 89, 182, 0.4);
}

.message.freeze {
    background: rgba(52, 152, 219, 0.4);
}

@keyframes messagefade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 游戏主体区域 */
.game-main {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

/* 技能面板 */
.skills-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 140px;
}

.skill-item {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.skill-item:hover:not(.disabled) {
    background: rgba(155, 89, 182, 0.3);
    transform: scale(1.05);
}

.skill-item.active-skill {
    background: rgba(155, 89, 182, 0.5);
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.5);
}

.skill-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.skill-item.used {
    opacity: 0.3;
    cursor: not-allowed;
}

.skill-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.skill-name {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.skill-cost {
    font-size: 0.8rem;
    color: #f39c12;
}

.skill-once {
    font-size: 0.7rem;
    color: #e74c3c;
    margin-top: 2px;
}

/* 棋盘区域 */
.board-area {
    background: linear-gradient(135deg, #d4a574 0%, #c4956a 50%, #b38560 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.board {
    display: grid;
    grid-template-columns: repeat(15, 35px);
    grid-template-rows: repeat(15, 35px);
    gap: 0;
    background: #deb887;
    position: relative;
}

.cell {
    width: 35px;
    height: 35px;
    border: 1px solid #8b7355;
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cell::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    background: #8b7355;
    top: 50%;
}

.cell::after {
    content: '';
    position: absolute;
    height: 100%;
    width: 1px;
    background: #8b7355;
    left: 50%;
}

.cell:hover:not(.occupied) {
    background: rgba(0,0,0,0.1);
}

.stone {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    position: absolute;
    z-index: 1;
    transition: transform 0.3s ease;
}

.stone.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #1a1a1a);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}

.stone.white {
    background: radial-gradient(circle at 30% 30%, #ffffff, #d0d0d0);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.stone.new {
    animation: stoneappear 0.3s ease;
}

@keyframes stoneappear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 获胜连线 */
.win-line {
    position: absolute;
    background: linear-gradient(90deg, #f39c12, #e74c3c);
    height: 4px;
    z-index: 2;
    animation: winline 0.5s ease;
}

@keyframes winline {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal-content h2 {
    margin-bottom: 15px;
    color: #f39c12;
}

.modal-content p {
    margin-bottom: 20px;
    color: #ecf0f1;
}

.setting-item {
    margin-bottom: 20px;
    text-align: left;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: #bdc3c7;
}

.setting-item select {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1rem;
}

/* 动画容器 */
.animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* 飞沙走石动画 */
.wind-effect {
    position: absolute;
    font-size: 3rem;
    animation: windblow 0.5s ease-in-out;
}

@keyframes windblow {
    0% {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: translateX(-20px) rotate(-15deg);
    }
    50% {
        transform: translateX(20px) rotate(15deg);
    }
    75% {
        transform: translateX(-10px) rotate(-8deg);
    }
    100% {
        transform: translateX(100vw) rotate(30deg);
        opacity: 0;
    }
}

/* 静如止水动画 */
.water-ripple {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 3px solid rgba(52, 152, 219, 0.8);
    border-radius: 50%;
    animation: ripple 1.5s ease-out infinite;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* 力拔山兮动画 */
.hand-slap {
    position: absolute;
    font-size: 5rem;
    animation: handslap 0.8s ease-in-out;
}

@keyframes handslap {
    0% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
    50% {
        transform: translateY(0) scale(1.5);
        opacity: 1;
    }
    100% {
        transform: translateY(50px) scale(0.5);
        opacity: 0;
    }
}

.falling-stone {
    animation: fall 0.8s ease-in forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(180deg);
        opacity: 0;
    }
}

/* 调虎离山动画 */
.dizzy-char {
    position: absolute;
    font-size: 4rem;
    animation: dizzy 2s ease-in-out;
}

@keyframes dizzy {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-15deg);
    }
    75% {
        transform: rotate(15deg);
    }
}

/* 时光倒流动画 */
.fade-out {
    animation: fadeout 1s ease forwards;
}

@keyframes fadeout {
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

.time-reverse {
    animation: timereverse 1.5s ease;
}

@keyframes timereverse {
    0% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(180deg) blur(5px);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* 响应式设计 */
@media (max-width: 900px) {
    .game-main {
        flex-direction: column;
        align-items: center;
    }

    .skills-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .board {
        grid-template-columns: repeat(15, 25px);
        grid-template-rows: repeat(15, 25px);
    }

    .cell {
        width: 25px;
        height: 25px;
    }

    .stone {
        width: 20px;
        height: 20px;
    }

    .main-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    .board {
        grid-template-columns: repeat(15, 20px);
        grid-template-rows: repeat(15, 20px);
    }

    .cell {
        width: 20px;
        height: 20px;
    }

    .stone {
        width: 16px;
        height: 16px;
    }

    .skill-item {
        min-width: 80px;
        padding: 8px;
    }

    .skill-icon {
        font-size: 1.5rem;
    }

    .skill-name {
        font-size: 0.75rem;
    }
}
