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

body {
    font-family: 'Microsoft YaHei', 'SimHei', 'KaiTi', serif;
    background: linear-gradient(135deg, #2c1810 0%, #3d2314 50%, #1a0f0a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: linear-gradient(180deg, #4a3020 0%, #2d1a10 100%);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 900px;
    width: 100%;
    border: 2px solid #5a3a20;
}

.game-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(180, 140, 100, 0.3);
}

.game-header h1 {
    color: #d4a574;
    font-size: 2.2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-family: 'KaiTi', 'STKaiti', serif;
}

.game-header .subtitle {
    color: #8b6914;
    font-size: 1rem;
    margin-left: 10px;
    font-style: italic;
}

.game-header .game-desc {
    color: #a08060;
    margin-top: 5px;
    font-size: 0.85rem;
}

.game-mode-area {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-mode-area label {
    color: #b09070;
    font-size: 0.85rem;
}

.game-mode-area select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #5a3a20;
    background: #3a2010;
    color: #d4a574;
    cursor: pointer;
    font-family: inherit;
}

.game-mode-area select:focus {
    outline: none;
    border-color: #8b6914;
}

.player-status {
    font-size: 0.75rem;
    color: #d4a574;
    margin-top: 3px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    border: 1px solid rgba(180, 140, 100, 0.2);
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 15px;
    border-radius: 8px;
    min-width: 80px;
}

.player-black {
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border: 2px solid #3a3a3a;
}

.player-white {
    background: linear-gradient(135deg, #e8dcc8, #d4c4a8);
    border: 2px solid #b8a888;
}

.player-black .player-name {
    color: #d4a574;
}

.player-white .player-name {
    color: #3a2010;
}

.player-name {
    font-size: 1rem;
    font-weight: bold;
}

.piece-count {
    font-size: 1.8rem;
    font-weight: bold;
    margin-top: 3px;
}

.player-black .piece-count {
    color: #c49464;
}

.player-white .piece-count {
    color: #8b4513;
}

.dice-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dice {
    width: 45px;
    height: 45px;
    background: linear-gradient(145deg, #f5e6d3, #d4c4a8);
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    font-weight: bold;
    color: #3a2010;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease;
    border: 1px solid #b8a888;
}

.dice.rolling {
    animation: roll 0.6s ease-in-out;
}

@keyframes roll {
    0%, 100% { 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); }
}

.roll-btn {
    padding: 10px 25px;
    font-size: 0.95rem;
    font-weight: bold;
    background: linear-gradient(135deg, #8b4513, #654321);
    color: #f5e6d3;
    border: 1px solid #a0522d;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    font-family: inherit;
}

.roll-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.5);
    background: linear-gradient(135deg, #a0522d, #8b4513);
}

.roll-btn:disabled {
    background: #3a3a3a;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    border-color: #444;
}

.turn-indicator {
    text-align: center;
    padding: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #f5e6d3;
    background: rgba(139, 69, 19, 0.4);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(180, 140, 100, 0.3);
}

.turn-indicator.black-turn {
    background: rgba(30, 20, 10, 0.8);
    border-color: #5a3a20;
}

.turn-indicator.white-turn {
    background: rgba(200, 180, 150, 0.3);
    color: #3a2010;
}

.board-container {
    position: relative;
    margin-bottom: 15px;
}

.direction-hints {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 20;
}

.hint {
    position: absolute;
    font-size: 0.65rem;
    color: #c4a882;
    background: rgba(35, 20, 10, 0.95);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #5a3a20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hint-title {
    font-weight: bold;
    color: #d4a574;
}

.hint-desc {
    font-size: 0.6rem;
    color: #a08060;
}

.hint-arrow {
    font-size: 0.9rem;
    color: #8b6914;
}

.hint-top-left {
    top: -28px;
    left: 5px;
}

.hint-top-right {
    top: -28px;
    right: 5px;
}

.hint-bottom-left {
    bottom: -28px;
    left: 5px;
}

.hint-bottom-right {
    bottom: -28px;
    right: 5px;
}

.move-direction-hints {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 10px;
}

.move-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
}

.move-hint-black {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border: 1px solid #3a3a3a;
    color: #d4a574;
}

.move-hint-white {
    background: linear-gradient(135deg, #e8dcc8, #d4c4a8);
    border: 1px solid #b8a888;
    color: #3a2010;
}

.move-arrow {
    font-size: 1rem;
}

.board {
    background: linear-gradient(135deg, #5c3d2e, #3a2518);
    border-radius: 10px;
    padding: 12px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5),
                0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    border: 3px solid #6b4423;
}

.board::before,
.board::after {
    display: none;
}

.board-half {
    display: flex;
    justify-content: space-between;
}

.points-container {
    display: flex;
    gap: 2px;
}

.point {
    width: 55px;
    height: 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.point::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 27px solid transparent;
    border-right: 27px solid transparent;
    z-index: 0;
    pointer-events: none;
}

.top-half .point::before {
    top: 0;
    border-top: 150px solid;
}

.bottom-half .point::before {
    bottom: 0;
    border-bottom: 150px solid;
}

.point:nth-child(odd)::before {
    border-color: #6b4423;
}

.point:nth-child(even)::before {
    border-color: #8b6914;
}

.point:hover {
    filter: brightness(1.15);
}

.point.valid-move {
    filter: brightness(1.2);
}

.point.valid-move::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid #ffd700;
    border-radius: 5px;
    animation: pulse 1s infinite;
    z-index: 3;
    pointer-events: none;
}

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

.point.selected {
    filter: brightness(1.3);
}

.point.selected::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid #00ff88;
    border-radius: 5px;
    z-index: 3;
    pointer-events: none;
}

.point-number {
    position: absolute;
    font-size: 0.65rem;
    color: #a08060;
    z-index: 4;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.top-half .point-number {
    top: 2px;
}

.bottom-half .point-number {
    bottom: 2px;
}

.bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 100%;
    background: linear-gradient(135deg, #3a2518, #2a1a10);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 5px;
    z-index: 10;
    border: 1px solid #5a3a20;
}

.bar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    max-height: 45%;
    overflow: hidden;
}

.piece {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.piece.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #1a1a1a);
    border: 2px solid #2a2a2a;
    color: #d4a574;
}

.piece.white {
    background: radial-gradient(circle at 30% 30%, #f5e6d3, #c4b49a);
    border: 2px solid #a89070;
    color: #3a2010;
}

.piece:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
}

.piece.stacked {
    margin-top: -22px;
}

.piece.moving {
    animation: movepiece 0.3s ease-out;
}

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

.home-area {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.home {
    padding: 12px 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    transition: all 0.3s ease;
}

.black-home {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border: 2px solid #3a3a3a;
}

.white-home {
    background: linear-gradient(135deg, #e8dcc8, #d4c4a8);
    border: 2px solid #b8a888;
}

.home-label {
    font-size: 0.8rem;
    margin-bottom: 3px;
}

.black-home .home-label {
    color: #a08060;
}

.white-home .home-label {
    color: #5a4030;
}

.home-count {
    font-size: 1.8rem;
    font-weight: bold;
    color: #d4a574;
}

.home.valid-move {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    border-color: #ffd700;
    animation: homeglow 1s infinite;
}

@keyframes homeglow {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
    50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.9); }
}

.home.can-bear-off {
    border-color: #8b6914;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.control-btn {
    padding: 8px 20px;
    font-size: 0.9rem;
    background: rgba(60, 40, 20, 0.8);
    color: #d4a574;
    border: 1px solid #5a3a20;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.control-btn:hover {
    background: rgba(90, 60, 30, 0.9);
    border-color: #8b6914;
}

.message-area {
    text-align: center;
    padding: 8px;
    color: #f5e6d3;
    font-size: 0.95rem;
    min-height: 35px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(180, 140, 100, 0.2);
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #3a2518, #2a1a10);
    padding: 25px;
    border-radius: 15px;
    max-width: 450px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 2px solid #5a3a20;
}

.modal-content h2 {
    color: #d4a574;
    margin-bottom: 15px;
    text-align: center;
    font-family: 'KaiTi', 'STKaiti', serif;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 1.4rem;
    color: #a08060;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #d4a574;
}

.rules-content {
    color: #c4a882;
    line-height: 1.7;
    font-size: 0.9rem;
}

.rules-content p {
    margin-bottom: 10px;
}

/* 图解样式 */
.diagram-container {
    margin: 15px 0;
}

.diagram {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(180, 140, 100, 0.2);
}

.diagram-title {
    color: #d4a574;
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(180, 140, 100, 0.3);
}

.diagram-board {
    background: linear-gradient(135deg, #5c3d2e, #3a2518);
    border-radius: 8px;
    padding: 12px;
    border: 2px solid #6b4423;
}

.diagram-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.diagram-row:last-child {
    margin-bottom: 0;
}

.diagram-cell {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    text-align: center;
    min-width: 60px;
}

.black-piece {
    background: linear-gradient(135deg, #4a4a4a, #1a1a1a);
    color: #d4a574;
    border: 2px solid #2a2a2a;
}

.white-piece {
    background: linear-gradient(135deg, #f5e6d3, #c4b49a);
    color: #3a2010;
    border: 2px solid #a89070;
}

.dice-diagram {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    flex-wrap: wrap;
}

.dice-examples {
    text-align: center;
}

.dice-show {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}

.dice-show .dice {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
}

.dice-desc {
    font-size: 0.8rem;
    color: #a08060;
}

.move-examples {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.move-example {
    flex: 1;
    min-width: 140px;
    text-align: center;
}

.move-board {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.mini-point {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.mini-point.empty {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #6b4423;
    color: #a08060;
}

.mini-point.black-piece-mini {
    background: linear-gradient(135deg, #4a4a4a, #1a1a1a);
    color: #d4a574;
    border: 2px solid #2a2a2a;
}

.mini-point.white-piece-mini {
    background: linear-gradient(135deg, #f5e6d3, #c4b49a);
    color: #3a2010;
    border: 2px solid #a89070;
}

.mini-arrow {
    font-size: 1.2rem;
    color: #8b6914;
}

.move-desc {
    font-size: 0.8rem;
    color: #a08060;
}

.bearoff-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.bearoff-step {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #5a3a20;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    max-width: 300px;
}

.step-number {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: #8b6914;
    color: #f5e6d3;
    border-radius: 50%;
    font-weight: bold;
    margin-bottom: 8px;
}

.step-desc {
    font-size: 0.85rem;
    color: #c4a882;
    line-height: 1.6;
}

.bearoff-arrow {
    font-size: 1.5rem;
    color: #8b6914;
}

.rules-content h3 {
    color: #d4a574;
    margin: 12px 0 8px;
    font-size: 1rem;
}

.rules-content ul {
    padding-left: 18px;
}

.rules-content li {
    margin-bottom: 6px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        align-items: flex-start;
    }
    
    .game-container {
        padding: 12px;
        max-width: 100%;
    }
    
    .game-header h1 {
        font-size: 1.6rem;
    }
    
    .game-mode-area {
        flex-direction: column;
        gap: 8px;
    }
    
    .game-info {
        flex-wrap: wrap;
        gap: 10px;
        padding: 8px;
    }
    
    .player-info {
        min-width: 60px;
        padding: 6px 10px;
    }
    
    .piece-count {
        font-size: 1.4rem;
    }
    
    .dice-area {
        flex-direction: row;
        gap: 10px;
    }
    
    .board-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .board {
        min-width: 580px;
        max-width: none;
        width: auto;
        padding: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .board-half {
        gap: 4px;
    }
    
    .points-container {
        gap: 1px;
    }
    
    .point {
        width: 36px;
        height: 100px;
        padding: 3px;
    }
    
    .point::before {
        border-left-width: 18px;
        border-right-width: 18px;
    }
    
    .top-half .point::before {
        border-top-width: 88px;
    }
    
    .bottom-half .point::before {
        border-bottom-width: 88px;
    }
    
    .piece {
        width: 26px;
        height: 26px;
        font-size: 0.6rem;
    }
    
    .piece.stacked {
        margin-top: -14px;
    }
    
    .dice {
        width: 38px;
        height: 38px;
        font-size: 1.3rem;
    }
    
    .roll-btn {
        padding: 8px 20px;
        font-size: 0.85rem;
    }
    
    .bar {
        width: 28px;
        padding: 4px 2px;
        gap: 4px;
    }
    
    .bar-section {
        gap: 1px;
    }
    
    .point-number {
        font-size: 0.5rem;
    }
    
    .game-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .control-btn {
        padding: 6px 15px;
        font-size: 0.85rem;
    }
    
    .move-direction-hints {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .hint {
        font-size: 0.55rem;
        padding: 3px 6px;
    }
    
    .direction-hints {
        display: none;
    }
    
    .home-area {
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        padding: 8px;
        border-radius: 10px;
    }
    
    .game-header h1 {
        font-size: 1.3rem;
    }
    
    .game-header .subtitle {
        font-size: 0.8rem;
        display: block;
        margin-left: 0;
    }
    
    .game-mode-area label,
    .game-mode-area select {
        font-size: 0.75rem;
    }
    
    .player-info {
        min-width: 50px;
        padding: 4px 8px;
    }
    
    .player-name {
        font-size: 0.8rem;
    }
    
    .piece-count {
        font-size: 1.2rem;
    }
    
    .point {
        width: 32px;
        height: 100px;
        padding: 3px;
    }
    
    .point::before {
        border-left-width: 16px;
        border-right-width: 16px;
    }
    
    .top-half .point::before {
        border-top-width: 85px;
    }
    
    .bottom-half .point::before {
        border-bottom-width: 85px;
    }
    
    .piece {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }
    
    .piece.stacked {
        margin-top: -12px;
    }
    
    .dice {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .roll-btn {
        padding: 6px 15px;
        font-size: 0.8rem;
    }
    
    .bar {
        width: 30px;
    }
    
    .bar-section {
        gap: 1px;
    }
    
    .home-area {
        gap: 10px;
    }
    
    .home {
        min-width: 70px;
        padding: 8px 12px;
    }
    
    .home-label {
        font-size: 0.7rem;
    }
    
    .home-count {
        font-size: 1.4rem;
    }
    
    .turn-indicator {
        font-size: 0.9rem;
        padding: 6px;
    }
    
    .message-area {
        font-size: 0.85rem;
        min-height: 30px;
    }
    
    .modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .modal-content h2 {
        font-size: 1.2rem;
    }
    
    .rules-content {
        font-size: 0.8rem;
    }
    
    .hint {
        font-size: 0.5rem;
        padding: 2px 4px;
    }
    
    .hint-desc {
        font-size: 0.45rem;
    }
    
    .diagram {
        padding: 8px;
    }
    
    .diagram-title {
        font-size: 0.85rem;
    }
    
    .diagram-cell {
        font-size: 0.75rem;
        padding: 4px 8px;
        min-width: 50px;
    }
    
    .dice-show .dice {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    
    .mini-point {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    
    .step-number {
        width: 25px;
        height: 25px;
        line-height: 25px;
        font-size: 0.9rem;
    }
    
    .step-desc {
        font-size: 0.75rem;
    }
}
