body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 10px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    padding: 15px;
    position: relative;
}

.header-container {
    text-align: center;
    position: relative;
    margin-bottom: 15px;
}

h1 {
    display: inline-block;
    color: #333;
    font-size: 1.5rem;
    margin: 0;
    position: relative;
}

.intro-btn {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    margin-left: 8px;
}

.intro-btn i.fas.fa-question {
    font-size: 12px;
    line-height: 1;
    color: white;
}

.intro-btn:hover {
    background-color: #0056b3;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-50%) scale(1.1);
}

.intro-btn:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.character-selection {
    display: flex;
    justify-content: space-around;
    margin: 15px 0;
}

.character-card {
    width: 150px;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px;
    text-align: center;
    background-color: #fafafa;
}

.character-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.character-card.selected {
    border-color: #007bff;
    background-color: #e6f0ff;
    box-shadow: 0 0 5px rgba(0,123,255,0.5);
}

.character-card h3 {
    margin: 8px 0;
    font-size: 1rem;
}

.attributes {
    text-align: left;
    font-size: 12px;
}

.attributes div {
    margin: 2px 0;
}

.controls {
    text-align: center;
    margin: 15px 0;
}

.controls select, .controls input, .controls button {
    margin: 5px;
    padding: 8px;
    font-size: 14px;
}

.simulation-results {
    margin: 15px 0;
}

.simulation-results h3 { /* Centering the "对战日志" heading */
    text-align: center;
}

.win-rate {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0;
}

.log-container {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    background-color: #fafafa;
    margin: 10px auto; /* Center the block element */
    max-width: 800px; /* Limit width for better centering */
}

.log-entry {
    margin: 3px 0;
    padding: 3px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    /* Removed text-align: center */
}

.log-action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px; /* Space between buttons */
    margin: 10px 0;
}

.log-entry.round {
    font-weight: bold;
    background-color: #e9ecef;
}

.log-entry.victory {
    color: #28a745;
    font-weight: bold;
}

.log-entry.defeat {
    color: #dc3545;
    font-weight: bold;
}

.skills {
    text-align: left;
    font-size: 11px;
    margin-top: 8px;
}

.skills h4 {
    margin: 5px 0;
    color: #007bff;
    font-size: 12px;
}

.skills p {
    margin: 2px 0;
    line-height: 1.3;
}

.character-vs {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin: 15px 0;
}

.hidden {
    display: none;
}

.expand-btn { /* Specific styling for expand-btn */
    display: block;
    margin: 8px auto; /* Centering for individual expand-btn instances */
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    transition: background-color 0.3s ease;
}

#start-simulation { /* Specific styling for start-simulation */
    display: block;
    margin: 8px; /* Unique margin for start-simulation */
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    transition: background-color 0.3s ease;
}

.expand-btn:hover, #start-simulation:hover {
    background-color: #0056b3;
}

.expand-btn:active, #start-simulation:active {
    transform: translateY(1px);
}

.character-select {
    margin: 15px 0;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* 自定义下拉列表样式 */
.custom-select {
    position: relative;
    width: 100%;
    max-width: 250px;
    display: inline-block;
}

.custom-select select {
    display: none;
}

.select-selected {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px 30px 10px 10px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    min-height: 50px;
    box-sizing: border-box;
    font-size: 14px;
}

.select-selected:after {
    content: "▼";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.select-selected.select-arrow-active:after {
    content: "▲";
}

.select-items {
    position: absolute;
    background-color: #fff;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.select-hide {
    display: none;
}

.select-items div {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.select-items div:hover {
    background-color: #f1f1f1;
}

.select-items div img {
    width: 30px;
    height: 30px;
    margin-right: 10px;
    object-fit: contain;
}

.select-items div:last-child {
    border-bottom: none;
}

/* 选中项中的图片样式 */
.select-selected img {
    width: 30px;
    height: 30px;
    margin-right: 10px;
    object-fit: contain;
}

/* 角色详细信息面板 */
.character-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 15px 0;
}

.character-panel {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 12px;
    background-color: #fafafa;
}

.character-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.character-header img {
    width: 50px;
    height: 50px;
    margin-right: 12px;
    object-fit: contain;
}

.character-header h3 {
    margin: 0;
    font-size: 18px;
}

.character-attributes {
    margin-bottom: 12px;
}

.character-attributes h4 {
    margin: 8px 0 5px 0;
    color: #007bff;
    font-size: 14px;
}

.attribute-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.attribute-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 13px;
}

.attribute-name {
    font-weight: bold;
}

.attribute-value {
    margin-left: 5px;
}

.character-skills {
    margin-top: 12px;
}

.skill-card {
    background-color: white;
    border: 1px solid #eee;
    border-radius: 3px;
    padding: 8px;
    margin-bottom: 8px;
}

.skill-card h5 {
    margin: 0 0 5px 0;
    color: #007bff;
    font-size: 13px;
}

.skill-card p {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
}

/* 模拟控制区域 */
.simulation-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    text-align: center;
}

.simulation-slider {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.simulation-slider input {
    width: 100%;
}

.simulation-slider .slider-value {
    margin-top: 5px;
    font-weight: bold;
    color: #007bff;
}

.simulation-slider label {
    display: block;
    margin-bottom: 5px;
}

/* 响应式设计 */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .container {
        max-width: 1200px;
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .character-selection {
        display: flex;
        justify-content: space-around;
        margin: 20px 0;
    }
    
    .character-card {
        width: 200px;
        padding: 10px;
    }
    
    .character-card img {
        width: 100px;
        height: 100px;
    }
    
    .character-card h3 {
        font-size: 1.2rem;
    }
    
    .attributes {
        font-size: 14px;
    }
    
    .controls select, .controls input, .controls button {
        margin: 0 10px;
        padding: 5px 10px;
        font-size: 16px;
    }
    
    .log-entry {
        font-size: 16px;
    }
    
    .skills {
        font-size: 12px;
    }
    
    .skills h4 {
        font-size: 14px;
    }
    
    .character-vs {
        font-size: 24px;
        margin: 20px 0;
    }
    
    .expand-btn, #start-simulation {
        padding: 10px 20px;
        font-size: 16px;
    }
    
    .character-select {
        gap: 50px;
    }
    
    .select-selected {
        font-size: 16px;
    }
    
    .character-details {
        flex-direction: row;
        gap: 20px;
    }
    
    .character-panel {
        width: 48%;
    }
    
    .character-header img {
        width: 60px;
        height: 60px;
    }
    
    .character-header h3 {
        font-size: 20px;
    }
    
    .attribute-item {
        font-size: 14px;
    }
    
    .skill-card h5 {
        font-size: 14px;
    }
    
    .skill-card p {
        font-size: 14px;
    }
    
    .simulation-controls {
        width: 100%; /* Ensure it takes full width to center children */
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 30px;
    }
    
    .simulation-slider {
        max-width: 250px;
        /* Removed flex: 1 to prevent it from taking up too much space */
        flex-direction: row;
        align-items: center;
        gap: 10px;
        width: auto; /* Re-add width: auto to size based on content */
        text-align: center; /* Ensure internal content is centered */
    }
    
    .simulation-slider label {
        margin-bottom: 0;
        white-space: nowrap;
        width: auto;
    }
    
    .simulation-slider .slider-container {
        flex: 1;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    .simulation-slider .slider-value {
        margin-top: 0;
        margin-left: 10px;
        white-space: nowrap;
        width: auto;
    }
    
    .simulation-slider input {
        flex: 1;
        width: 100%;
    }
}

@media (max-width: 767px) {
    .character-select {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .custom-select {
        max-width: 250px;
    }
    
    .character-vs {
        font-size: 16px;
    }
    
    .win-rate {
        font-size: 14px;
    }
    
    .character-header {
        flex-direction: column;
        text-align: center;
    }
    
    .character-header img {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .attribute-grid {
        grid-template-columns: 1fr;
    }
    
    .simulation-slider {
        max-width: 250px;
    }
    
    .simulation-controls {
        gap: 15px;
    }
    
    .simulation-slider .slider-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .simulation-slider input {
        width: 100%;
    }
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Could be more responsive */
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
    text-align: left;
}

.modal-content h2 {
    text-align: center;
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
}

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

.narrative-story {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    white-space: pre-wrap; /* Preserve whitespace and wrap text */
    text-align: left;
}

/* Loading animation for narrative story */
.narrative-story.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px; /* Ensure spinner is visible */
    font-style: italic;
    color: #666;
}

.narrative-story.loading::before {
    content: '';
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-actions {
    text-align: center;
    margin-top: 20px;
}

.modal-actions .close-modal-btn {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.modal-actions .close-modal-btn:hover {
    background-color: #0056b3;
}

/* Narrative button styling */
.narrative-btn {
    background-color: #28a745; /* Green color */
    color: white;
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px; /* Space from expand button */
    transition: background-color 0.3s ease;
}

.narrative-btn:hover {
    background-color: #218838;
}

/* Copy button styling */
.copy-btn {
    background-color: #17a2b8; /* Teal color */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}

.copy-btn:hover {
    background-color: #138496;
}

.copy-btn:active {
    transform: translateY(1px);
}

/* Music button styling */
.music-btn {
    background-color: #6f42c1; /* Purple color */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}

.music-btn:hover {
    background-color: #5a359a;
}

.music-btn:active {
    transform: translateY(1px);
}

/* Music player controls */
.music-player {
    margin-top: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f8f9fa;
}

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

.music-info h4 {
    margin: 0 0 5px 0;
    color: #6f42c1;
}

.music-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.music-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.play-btn, .download-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.play-btn {
    background-color: #28a745;
    color: white;
}

.play-btn:hover {
    background-color: #218838;
}

.play-btn.playing {
    background-color: #dc3545;
}

.play-btn.playing:hover {
    background-color: #c82333;
}

.download-btn {
    background-color: #007bff;
    color: white;
}

.download-btn:hover {
    background-color: #0056b3;
}

/* Log entry buttons container for flex layout */
.log-entry-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 5px;
    margin-bottom: 5px;
}
