/* 古风五子棋样式 - 传统中国风设计 */

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

body {
    font-family: "STKaiti", "KaiTi", "楷体", "SimSun", "宋体", serif;
    background: #f5f0e6;
    background-image:
        linear-gradient(90deg, rgba(200, 180, 150, 0.1) 1px, transparent 1px),
        linear-gradient(rgba(200, 180, 150, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 装饰性背景图案 */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c-1.5 0-3 1.5-3 3v10c0 1.5 1.5 3 3 3s3-1.5 3-3V8c0-1.5-1.5-3-3-3zm0 25c-1.5 0-3 1.5-3 3v10c0 1.5 1.5 3 3 3s3-1.5 3-3v-10c0-1.5-1.5-3-3-3z' fill='%23d4c4a8' fill-opacity='0.3'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

.container {
    background: #faf6ef;
    border: 3px solid #8b6914;
    border-radius: 4px;
    padding: 30px 40px;
    box-shadow:
        0 0 0 2px #d4c4a8,
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 0 60px rgba(139, 105, 20, 0.05);
    max-width: 720px;
    width: 100%;
    position: relative;
}

/* 四角装饰 */
.container::before,
.container::after {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid #8b6914;
}

.container::before {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
}

.container::after {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px dashed #d4c4a8;
}

header h1 {
    font-size: 2.5em;
    color: #2c1810;
    font-weight: normal;
    letter-spacing: 8px;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #8b6914;
    font-size: 0.95em;
    letter-spacing: 4px;
    font-style: italic;
}

/* 游戏信息栏 */
.game-info {
    margin-bottom: 20px;
}

.status-bar {
    text-align: center;
    padding: 15px 25px;
    background: linear-gradient(to bottom, #faf6ef, #f0e8d8);
    border: 1px solid #d4c4a8;
    border-radius: 4px;
    margin-bottom: 20px;
    position: relative;
}

.status-bar::before {
    content: "┃";
    position: absolute;
    left: 15px;
    color: #8b6914;
}

.status-bar::after {
    content: "┃";
    position: absolute;
    right: 15px;
    color: #8b6914;
}

#statusText {
    font-size: 1.2em;
    color: #4a3728;
    letter-spacing: 3px;
}

/* 玩家指示器 - 印章风格 */
.player-indicator {
    display: flex;
    justify-content: center;
    gap: 60px;
}

.player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 25px;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.player.active {
    opacity: 1;
    background: linear-gradient(135deg, #f8f4ec, #efe7d8);
    border-color: #8b6914;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.5),
        0 2px 8px rgba(139, 105, 20, 0.2);
}

.player.black.active {
    border-color: #2c1810;
}

.player.white.active {
    border-color: #8b7355;
}

.stone-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.stone-icon.black {
    background: radial-gradient(circle at 35% 35%, #3a3a3a, #0a0a0a);
}

.stone-icon.black::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.stone-icon.white {
    background: radial-gradient(circle at 35% 35%, #ffffff, #c0c0c0);
    border: 1px solid #b0b0b0;
}

.stone-icon.white::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

.player span {
    font-size: 1em;
    color: #4a3728;
    letter-spacing: 2px;
}

/* 游戏区域 */
.game-area {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(to bottom, #f8f4ec, #ede4d4);
    border: 2px solid #d4c4a8;
    border-radius: 4px;
}

#gameCanvas {
    border-radius: 2px;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 0 20px rgba(139, 105, 20, 0.1);
    cursor: pointer;
    touch-action: none;
    background: #e3c48b;
}

/* 控制按钮 - 古典风格 */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding-top: 20px;
    border-top: 1px dashed #d4c4a8;
}

.btn {
    padding: 12px 28px;
    border: 2px solid #8b6914;
    border-radius: 4px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    letter-spacing: 2px;
    background: linear-gradient(to bottom, #faf6ef, #f0e8d8);
    color: #4a3728;
    position: relative;
    overflow: hidden;
}

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

.btn:hover:not(:disabled)::before {
    left: 100%;
}

.btn.primary {
    background: linear-gradient(to bottom, #5c3d2e, #3d2518);
    color: #f5f0e6;
    border-color: #2c1810;
    box-shadow: 0 4px 12px rgba(44, 24, 16, 0.3);
}

.btn.primary:hover:not(:disabled) {
    background: linear-gradient(to bottom, #6d4c3a, #4a3020);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(44, 24, 16, 0.4);
}

.btn.secondary {
    background: linear-gradient(to bottom, #faf6ef, #f0e8d8);
}

.btn.secondary:hover:not(:disabled) {
    background: linear-gradient(to bottom, #fff, #f5f0e6);
    transform: translateY(-2px);
    border-color: #a67c00;
}

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

/* 说明区域 - 古典书籍风格 */
.instructions {
    background: linear-gradient(to bottom, #faf6ef, #f5f0e6);
    border: 1px solid #d4c4a8;
    border-radius: 4px;
    padding: 20px 25px;
    position: relative;
}

.instructions::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 15px;
    right: 15px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d4c4a8, transparent);
}

.instructions h3 {
    font-size: 1.1em;
    color: #2c1810;
    margin-bottom: 15px;
    font-weight: normal;
    letter-spacing: 3px;
    text-align: center;
    background: #faf6ef;
    display: inline-block;
    padding: 0 15px;
    position: relative;
    z-index: 1;
    margin-left: 50%;
    transform: translateX(-50%);
}

.instructions ul {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

.instructions li {
    font-size: 0.9em;
    color: #6b5344;
    padding: 8px 0;
    padding-left: 30px;
    position: relative;
    letter-spacing: 1px;
}

.instructions li::before {
    content: "◇";
    position: absolute;
    left: 0;
    color: #8b6914;
    font-size: 1em;
}

/* 胜利弹窗 - 古典风格 */
.win-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 24, 16, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.4s ease;
}

.win-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(to bottom, #faf6ef, #f0e8d8);
    padding: 50px 60px;
    border: 3px solid #8b6914;
    border-radius: 4px;
    text-align: center;
    animation: slideUp 0.5s ease;
    box-shadow:
        0 0 0 3px #d4c4a8,
        0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
}

.modal-content::before,
.modal-content::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #8b6914;
}

.modal-content::before {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

.modal-content::after {
    bottom: 10px;
    right: 10px;
    border-left: none;
    border-top: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h2 {
    font-size: 2.2em;
    color: #2c1810;
    margin-bottom: 20px;
    font-weight: normal;
    letter-spacing: 6px;
}

.modal-content p {
    color: #6b5344;
    margin-bottom: 30px;
    font-size: 1.1em;
    letter-spacing: 2px;
}

.modal-content .btn {
    min-width: 150px;
}

/* 响应式设计 */
@media (max-width: 640px) {
    .container {
        padding: 20px 25px;
        margin: 10px;
    }

    header h1 {
        font-size: 1.8em;
        letter-spacing: 4px;
    }

    .player-indicator {
        gap: 30px;
    }

    .player {
        padding: 8px 15px;
    }

    .player span {
        font-size: 0.9em;
    }

    .controls {
        gap: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.85em;
    }

    .modal-content {
        padding: 35px 40px;
        margin: 20px;
    }

    .modal-content h2 {
        font-size: 1.8em;
    }
}

/* 落子动画 - 水墨风格 */
@keyframes dropStone {
    0% {
        transform: scale(1.4) translateY(-10px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(2px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.stone-drop {
    animation: dropStone 0.35s ease-out forwards;
}

/* AI 思考状态 - 传统Loading */
.thinking {
    position: relative;
}

.thinking::after {
    content: "…";
    position: absolute;
    top: 50%;
    right: -20px;
    font-size: 1.5em;
    color: #8b6914;
    animation: thinkingDot 1.2s ease-in-out infinite;
    transform: translateY(-50%);
}

@keyframes thinkingDot {
    0%, 20% { opacity: 0.3; transform: translateY(-50%) translateY(-3px); }
    50% { opacity: 1; transform: translateY(-50%) translateY(0); }
    80%, 100% { opacity: 0.3; transform: translateY(-50%) translateY(3px); }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f5f0e6;
}

::-webkit-scrollbar-thumb {
    background: #d4c4a8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8b6914;
}
