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

/* ===== 爱心主题色 ===== */
:root {
    --pink-100: #fff0f3;
    --pink-200: #ffd6e0;
    --pink-300: #ffadd2;
    --pink-400: #ff85c0;
    --pink-500: #eb2f96;
    --pink-600: #c41d7f;
    --rose: #f759ab;
    --gold: #faad14;
    --cream: #fff8f0;
    --text: #4a3040;
    --text-light: #8c6b7a;
    --shadow: rgba(235, 47, 150, 0.15);
    --board-color: #f5deb3;
    --board-line: #8b6914;
    --piece-white: #ffffff;
    --piece-black: #2d2d2d;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #fff0f3 0%, #ffe8f0 30%, #ffd6e7 60%, #ffe0f0 100%);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
}

/* ===== 飘落爱心背景 ===== */
#hearts-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    font-size: 20px;
    animation: floatDown linear infinite;
    opacity: 0.6;
    user-select: none;
}

@keyframes floatDown {
    0% {
        transform: translateY(-50px) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    10% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

@keyframes floatDown {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ===== 主页 ===== */
#main-page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.love-header {
    text-align: center;
    margin-bottom: 30px;
}

.title {
    font-size: 2.8em;
    color: var(--pink-500);
    text-shadow: 2px 2px 4px var(--shadow);
    animation: titlePulse 2s ease-in-out infinite;
    letter-spacing: 4px;
}

.heart-icon {
    display: inline-block;
    animation: heartBeat 1.2s ease-in-out infinite;
}

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

@keyframes titlePulse {
    0%, 100% { text-shadow: 2px 2px 4px var(--shadow); }
    50% { text-shadow: 2px 2px 20px var(--pink-400), 0 0 40px var(--pink-300); }
}

.subtitle {
    font-size: 1.3em;
    color: var(--text-light);
    margin-top: 10px;
    letter-spacing: 2px;
}

/* ===== 爱心卡片 ===== */
.love-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 35px 45px;
    margin: 20px 0 30px;
    box-shadow: 0 8px 32px var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.5);
    max-width: 480px;
    width: 90%;
    position: relative;
    overflow: hidden;
}

.love-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--pink-300), var(--pink-100), var(--pink-300));
    border-radius: 26px;
    z-index: -1;
    animation: borderGlow 3s linear infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.love-text {
    font-size: 1.1em;
    line-height: 2;
    color: var(--text);
}

.love-text .sign {
    text-align: right;
    margin-top: 15px;
    color: var(--pink-500);
    font-weight: bold;
}

/* ===== 按钮 ===== */
.cute-btn {
    background: linear-gradient(135deg, var(--pink-400), var(--rose));
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow);
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.cute-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(235, 47, 150, 0.3);
}

.cute-btn:active {
    transform: translateY(0) scale(0.98);
}

.cute-btn.small {
    padding: 10px 20px;
    font-size: 0.9em;
}

.deco-stars {
    margin-top: 30px;
    font-size: 1.5em;
    letter-spacing: 10px;
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ===== 游戏页面 ===== */
#game-page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 700px;
    margin-bottom: 10px;
}

.game-title {
    font-size: 1.6em;
    color: var(--pink-500);
    text-shadow: 1px 1px 3px var(--shadow);
}

/* ===== 游戏信息栏 ===== */
.game-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 700px;
}

.turn-box {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    padding: 10px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px var(--shadow);
    font-weight: bold;
    font-size: 1.05em;
    transition: all 0.3s ease;
}

.piece-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.piece-indicator.player {
    background: radial-gradient(circle at 35% 35%, #fff, #e0e0e0);
    border: 2px solid #ccc;
}

.piece-indicator.ai {
    background: radial-gradient(circle at 35% 35%, #555, #1a1a1a);
    border: 2px solid #000;
}

.score-box {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    padding: 10px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px var(--shadow);
    font-size: 1.05em;
}

.vs {
    color: var(--pink-500);
    font-weight: bold;
}

/* ===== 3D 棋盘容器 ===== */
#game-container {
    position: relative;
    width: 100%;
    max-width: 620px;
    aspect-ratio: 1 / 0.85;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 0 3px var(--pink-200);
    background: linear-gradient(180deg, #fef9f0 0%, #f5e6d0 100%);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

#hover-info {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(235, 47, 150, 0.8);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    pointer-events: none;
}

/* ===== 游戏控制 ===== */
.game-controls {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

/* ===== 胜利弹窗 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 30px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(235, 47, 150, 0.3);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 400px;
    width: 90%;
}

@keyframes modalPop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.win-icon {
    font-size: 4em;
    margin-bottom: 10px;
    animation: bounce 0.6s ease infinite alternate;
}

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

.modal-content h2 {
    color: var(--pink-500);
    font-size: 1.8em;
    margin-bottom: 8px;
}

.modal-content p {
    color: var(--text-light);
    font-size: 1.1em;
    margin-bottom: 15px;
}

.win-hearts {
    font-size: 1.5em;
    margin-bottom: 20px;
    animation: heartBeat 1s ease-in-out infinite;
}

/* ===== 加载动画 ===== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--pink-100);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

.loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    font-size: 3em;
    animation: spin 1.5s linear infinite;
}

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

.loading p {
    margin-top: 15px;
    color: var(--pink-500);
    font-size: 1.1em;
}

/* ===== 工具类 ===== */
.hidden {
    display: none !important;
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
    .title {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    .love-card {
        padding: 25px 30px;
    }

    .cute-btn {
        padding: 12px 30px;
        font-size: 1em;
    }

    .game-header {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
    }

    .game-title {
        font-size: 1.3em;
        order: -1;
        width: 100%;
        text-align: center;
    }

    #game-container {
        max-width: 95vw;
    }
}

/* ===== 飘落爱心动画增强 ===== */
.floating-heart {
    will-change: transform;
}

/* ===== 棋子放置动画 ===== */
@keyframes pieceDrop {
    0% { transform: translateY(-20px); opacity: 0; }
    60% { transform: translateY(3px); opacity: 1; }
    80% { transform: translateY(-2px); }
    100% { transform: translateY(0); opacity: 1; }
}

/* ===== 最近落子闪烁 ===== */
@keyframes lastPieceGlow {
    0%, 100% { box-shadow: 0 0 5px var(--pink-400); }
    50% { box-shadow: 0 0 20px var(--pink-400), 0 0 40px var(--pink-300); }
}
