/* Inherit most styles from health.css logic but customized for acupoints */
body {
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #fcf3cf; /* Light yellow background for TCM feel */
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    overflow: auto;
}

.main-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.game-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
    min-width: 0;
}

.info-section {
    width: 280px;
    background-color: #fff;
    border-left: 2px solid #d35400; /* Orange border */
    padding: 15px;
    overflow-y: auto;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
}

h1 {
    color: #8e44ad; /* Purple title */
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    text-align: center;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: bold;
    padding: 0 5px;
    color: #5d4037;
}

/* Header Row for Title and Help Button */
.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 10px;
}

.help-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 5px 10px;
    background-color: #8e44ad;
    font-size: 14px;
}

.help-btn:hover {
    background-color: #71368a;
}

/* Modal Styling */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff9c4; /* Light yellow modal bg */
    padding: 20px;
    border: 1px solid #fbc02d;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 5px;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Split Layout */
.split-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 15px;
    max-height: calc(100vh - 150px);
    min-height: 400px;
}

.split-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #fff;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.column-title {
    text-align: center;
    margin: 0 0 10px 0;
    padding: 5px;
    border-bottom: 2px solid #eee;
    font-size: 1.2rem;
}

.disease-title {
    color: #c0392b;
    border-bottom-color: #e6b0aa;
}

.acupoint-title {
    color: #2980b9;
    border-bottom-color: #a9cce3;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    grid-auto-rows: minmax(130px, auto);
    gap: 8px;
    padding: 5px;
    flex: 1;
    overflow-y: auto;
}

/* Scrollbar styling for grids */
.card-grid::-webkit-scrollbar {
    width: 8px;
}
.card-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.card-grid::-webkit-scrollbar-thumb {
    background: #d7bde2;
    border-radius: 4px;
}
.card-grid::-webkit-scrollbar-thumb:hover {
    background: #c39bd3;
}

.card {
    width: 100%;
    height: 140px;
    position: relative;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: bold;
    padding: 4px;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
    background-color: white;
    border: 1px solid #ddd;
    color: #333;
    user-select: none;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

/* 选中状态 */
.card.selected {
    border-color: #8e44ad;
    box-shadow: 0 0 15px rgba(142, 68, 173, 0.6);
    transform: scale(1.05);
    z-index: 10;
}

/* 错误配对状态 */
.card.incorrect {
    animation: shake 0.5s;
    border-color: #e74c3c;
    background-color: #fadbd8;
}

/* 匹配成功消失 */
.card.matched {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
}

.card.disease {
    background-color: #fdedec;
    border-color: #f5b7b1;
    color: #922b21;
}

.card.acupoint {
    background-color: #ebf5fb;
    border-color: #aed6f1;
    color: #1a5276;
}

.card-image {
    font-size: 36px;
    margin-bottom: 8px;
}

.card-type {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: normal;
}

.card-content {
    font-size: 14px;
    line-height: 1.2;
}

button {
    background-color: #8e44ad;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.3s;
    align-self: center;
}

button:hover {
    background-color: #71368a;
}

.info-panel {
    background-color: #fef9e7;
    border: 1px solid #f39c12;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
}

.info-panel h3 {
    color: #d35400;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1rem;
}

.info-panel p {
    color: #5d4037;
    line-height: 1.4;
    margin: 0;
    font-size: 0.9rem;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    /* 不再强制列数，使用 auto-fill */
}

@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }
    
    .info-section {
        width: 100%;
        border-left: none;
        border-top: 2px solid #d35400;
        max-height: 200px;
        order: 2; /* Move info section to bottom */
    }
    
    .game-section {
        flex: 1;
        min-height: 0; /* Important for flex child to scroll */
        order: 1;
    }

    .split-container {
        flex-direction: row; /* Keep side-by-side on tablets */
        max-height: none;
    }
}

@media (max-width: 768px) {
    .split-container {
        flex-direction: row; /* Keep side-by-side on mobile */
        gap: 5px;
    }

    .split-column {
        max-height: none; /* Let them take available height */
        padding: 5px;
        overflow: hidden; /* Ensure inner content scrolls */
    }

    .card-grid {
        grid-template-columns: 1fr; /* Single column per side */
        gap: 8px;
        overflow-y: auto; /* Enable independent scrolling */
        padding-right: 2px;
    }
    
    .card {
        height: 100px; /* Slightly smaller height */
        width: 100%; /* Full width of the column */
    }
    
    .card-image {
        font-size: 24px;
        margin-bottom: 4px;
    }
    
    .card-type {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .card-content {
        font-size: 12px;
        line-height: 1.1;
    }

    h1 {
        font-size: 1.4rem;
        margin-bottom: 5px;
    }
    
    .column-title {
        font-size: 1rem;
        margin-bottom: 5px;
        padding: 3px;
    }
}