/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 80px;
}

/* 背景图片 */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"%3E%3Ccircle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/%3E%3Ccircle cx="80" cy="40" r="3" fill="rgba(255,255,255,0.08)"/%3E%3Ccircle cx="40" cy="70" r="2" fill="rgba(255,255,255,0.1)"/%3E%3Ccircle cx="70" cy="80" r="2" fill="rgba(255,255,255,0.06)"/%3E%3C/svg%3E');
    background-size: 200px 200px;
    pointer-events: none;
    z-index: 0;
}

/* 顶部导航栏 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h1 {
    font-size: 20px;
    color: white;
    font-weight: 600;
}

.back-btn,
.music-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover,
.music-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.back-btn img,
.music-btn img {
    width: 24px;
    height: 24px;
}

/* 游戏标题 */
.game-title {
    text-align: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.game-title h2 {
    font-size: 28px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 游戏规则 */
.rules {
    background: rgba(255, 255, 255, 0.95);
    margin: 0 20px 20px;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.rules h3 {
    font-size: 16px;
    color: #764ba2;
    margin-bottom: 10px;
}

.rules ul {
    list-style: none;
    padding-left: 0;
}

.rules li {
    font-size: 14px;
    color: #555;
    padding: 5px 0;
}

/* 棋盘容器 */
.board-container {
    position: relative;
    margin: 0 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
}

/* 棋盘 */
.board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    min-height: 300px;
}

.cell {
    aspect-ratio: 1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.cell:hover {
    transform: scale(1.05);
}

.cell:nth-child(6n+1) { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }
.cell:nth-child(6n+2) { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.cell:nth-child(6n+3) { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.cell:nth-child(6n+4) { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.cell:nth-child(6n+5) { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.cell:nth-child(6n) { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }

.cell.start {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.cell.end {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 玩家棋子 */
.player {
    position: absolute;
    width: 50px;
    height: 50px;
    transition: all 0.5s ease;
    z-index: 10;
}

.player-girl {
    top: 25px;
    left: 25px;
}

.player-boy {
    top: 45px;
    left: 45px;
}

.player .avatar {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.player-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
}

/* 骰子区域 */
.dice-container {
    text-align: center;
    margin: 20px 0;
    position: relative;
    z-index: 1;
}

.dice {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.dice:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.dice.rolling {
    animation: diceRoll 0.5s ease-in-out;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.dice-hint {
    font-size: 14px;
    color: white;
    margin-top: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* 当前玩家 */
.current-player {
    text-align: center;
    font-size: 16px;
    color: white;
    margin: 10px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.girl-turn {
    color: #ff6b9d;
    font-weight: 600;
}

.boy-turn {
    color: #4a90d9;
    font-weight: 600;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 25px;
    max-width: 350px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h3 {
    font-size: 20px;
    color: #764ba2;
    margin-bottom: 15px;
}

.task-text {
    font-size: 16px;
    color: #555;
    margin: 15px 0;
    line-height: 1.6;
}

.small-text {
    font-size: 12px;
    color: #999;
    margin: 5px 0;
}

.modal-content textarea {
    width: 100%;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    margin: 10px 0;
}

.modal-content textarea:focus {
    outline: none;
    border-color: #764ba2;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.modal-btn.secondary {
    background: #f0f0f0;
    color: #666;
}

.modal-btn.secondary:hover {
    background: #e0e0e0;
}

/* 胜利弹窗 */
.win-modal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.win-modal h2 {
    font-size: 28px;
    margin-bottom: 15px;
}

.win-modal p {
    font-size: 18px;
    margin-bottom: 20px;
}

.win-modal .modal-btn {
    background: white;
    color: #764ba2;
}

/* 音乐播放器 */
.music-player {
    background: rgba(255, 255, 255, 0.95);
    margin: 20px;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.music-info {
    text-align: center;
    margin-bottom: 10px;
}

#songTitle {
    font-size: 14px;
    color: #764ba2;
    font-weight: 600;
}

.music-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.control-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: scale(1.1);
}

.control-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.play-btn {
    width: 55px;
    height: 55px;
}

.play-btn svg {
    width: 24px;
    height: 24px;
}

/* 底部按钮 */
.bottom-buttons {
    display: flex;
    gap: 15px;
    padding: 0 20px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.bottom-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 600;
    color: #764ba2;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.bottom-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.bottom-btn span:first-child {
    font-size: 24px;
}

/* 响应式 */
@media (max-width: 400px) {
    .board {
        grid-template-columns: repeat(5, 1fr);
    }

    .game-title h2 {
        font-size: 24px;
    }

    .player {
        width: 40px;
        height: 40px;
    }
}

@media (min-width: 600px) {
    .board {
        grid-template-columns: repeat(8, 1fr);
    }

    .board-container {
        max-width: 600px;
        margin: 0 auto;
    }

    .rules,
    .music-player {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }

    .bottom-buttons {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}
