body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; color: #333; line-height: 1.6; padding: 20px; max-width: 98%; margin: auto; }
h1, h2, h3 { color: #2c3e50; text-align: center; }
.container { background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); max-width: 1800px; margin: auto; }
.main-controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 25px; align-items: flex-start; }
.coupon-controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; background-color: #f9f9f9; padding: 15px; border-radius: 5px; border: 1px solid #e0e0e0; }
.control-group, .coupon-group, .event-group { display: flex; flex-direction: column; }
.currency-group { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-end; gap: 20px; padding: 15px; background-color: #f8f9fa; border-radius: 5px; margin-bottom: 20px; }
.currency-group .control-group { flex-grow: 1; flex-basis: 250px; }
.exchange-rate-inputs { display: flex; align-items: center; gap: 8px; }
.exchange-rate-inputs span, .formatted-currency { flex-shrink: 0; }
.formatted-currency { font-size: 0.8em; color: #555; text-align: right; height: 1em; }
.switch-wrapper { flex-grow: 0; flex-basis: auto; }
.switch-container { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
#label-for-meso, #label-for-twd { font-weight: bold; transition: color 0.3s; }
.event-group .checkbox-group { flex-direction: row; align-items: center; margin-bottom: 5px; }
.coupon-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.note { font-size: 12px; color: #7f8c8d; margin: 5px 0 0 0; }
label { font-weight: bold; margin-bottom: 5px; color: #555; }
select, button, input { padding: 10px; border-radius: 5px; border: 1px solid #ccc; font-size: 16px; box-sizing: border-box; width: 100%; }
input[type="checkbox"] { width: auto; flex-shrink: 0; }
input:disabled { background-color: #ecf0f1; cursor: not-allowed; }
.checkbox-group label { font-weight: normal; margin-bottom: 0; }

.action-container {
    display: flex;
    gap: 15px;
    position: sticky;
    bottom: 20px;
    z-index: 100;
    margin-top: 20px;
}
button#share-settings-btn {
    background-color: #2ecc71;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    padding: 12px;
    font-size: 16px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    flex: 1;
    opacity: 0.95;
    font-weight: bold;
}
button#share-settings-btn:hover { background-color: #27ae60; opacity: 1; }

button#start-simulation { 
    background-color: #3498db; 
    color: white; 
    border: none; 
    cursor: pointer; 
    transition: background-color 0.3s; 
    padding: 12px; 
    font-size: 18px; 
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    flex: 2;
    opacity: 0.95;
}
button#start-simulation:hover { background-color: #2980b9; opacity: 1; }
button:disabled { background-color: #95a5a6; cursor: not-allowed; }
#results-container, #data-tables-container { margin-top: 30px; overflow-x: auto; }
#results-container { max-height: 80vh; }
.legend-note { text-align: center; color: #555; margin-bottom: 10px; font-size: 0.9em; }

/* Modal 樣式 */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.4); 
}
.modal.hidden { display: none; }
.modal:not(.hidden) { display: block; }
.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-modal:hover, .close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
.btn-details {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    white-space: nowrap;
}
.btn-details:hover { background-color: #7f8c8d; }

table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { border: 1px solid #ddd; padding: 10px 12px; text-align: center; vertical-align: middle; }
th { position: sticky; background-color: #ecf0f1; color: #34495e; z-index: 20; }
thead tr:first-child th { top: 0; }
thead tr:nth-child(2) th { top: 47px; z-index: 20; }
td:first-child, th:first-child { position: sticky; left: 0; font-weight: bold; z-index: 30; }
td:first-child { background-color: #eaf2f8; }
thead th:first-child { z-index: 40; }
tr:nth-child(even) td { background-color: #f9f9f9; }

tr.highlight-row td { 
    background-color: #fff8e1 !important; 
    border-top: 2px solid #ffc107;
    border-bottom: 2px solid #ffc107;
}
tr.highlight-row td:first-child, tr:nth-child(even).highlight-row td:first-child { 
    background-color: #ffecb3 !important; 
    color: #d35400;
}
.best-choice-badge {
    display: inline-block;
    background-color: #e74c3c;
    color: white;
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: normal;
    box-shadow: 0 2px 2px rgba(0,0,0,0.2);
}

td.cost, th.cost-header { text-align: right; }
td.destroy, th.destroy-header { text-align: center; }
.log-box { background-color: #2c3e50; color: #ecf0f1; font-family: 'Courier New', Courier, monospace; padding: 15px; border-radius: 5px; max-height: 400px; overflow-y: auto; white-space: pre-wrap; font-size: 14px; line-height: 1.8; text-align: left; }
.log-success { color: #2ecc71; font-weight: bold; }
.log-fail { color: #e74c3c; font-weight: bold; }
.log-keep { color: #bdc3c7; }
.log-cost { color: #95a5a6; font-style: italic; }
.log-cumulative { color: #f1c40f; }
.log-strategy { color: #3498db; font-weight: bold; }
.hidden { display: none !important; }
.switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: #2196F3; }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }
input[type="checkbox"]:disabled + .slider { cursor: not-allowed; background-color: #e0e0e0; }
#data-tables-container { display: flex; gap: 20px; flex-wrap: wrap; }
#data-tables-container > h2 { width: 100%; text-align: left; border-bottom: 2px solid #ecf0f1; padding-bottom: 10px; }
.data-table-wrapper { flex: 1; min-width: 400px; }
.data-table-wrapper table { font-size: 0.9em; }
.data-table-wrapper th, .data-table-wrapper td { padding: 6px 8px; }
.cost-breakdown { font-style: italic; font-size: 0.85em; text-align: right; }
.sim-cost-breakdown .breakdown-item, .theoretical-value .breakdown-item { display: block; }
.sim-cost-breakdown { color: #7f8c8d; }
.theoretical-value { color: #28a745; font-weight: bold; font-size: 0.9em; display: block; margin-top: 4px; }
.theoretical-value .cost-breakdown { color: #28a745; }
.coupon-section { margin-top: 5px; }
.settings-summary {
    cursor: pointer;
    padding: 12px;
    background: #eaf2f8;
    border-radius: 5px;
    font-weight: bold;
    color: #2c3e50;
    list-style: none;
}
.settings-summary::-webkit-details-marker { display: none; }
.path-info {
    font-size: 0.85em;
    color: #555;
    text-align: left;
    display: block;
    line-height: 1.4;
    white-space: normal; /* 允許換行 */
}
.path-info span { display: block; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* 副標題專用樣式 */
.subtitle-container {
    max-width: 800px;
    margin: -10px auto 25px auto; /* 稍微往上拉，靠近標題 */
    text-align: center;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px 20px;
}

.subtitle-main {
    font-size: 1.1em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle-main strong {
    color: #e74c3c; /* 強調重點色 */
}

.subtitle-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.subtitle-features li {
    font-size: 0.9em;
    color: #555;
    background: #fff;
    padding: 5px 12px;
    border-radius: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

/* 手機版調整：讓列表變成直排比較好閱讀 */
@media (max-width: 600px) {
    .subtitle-features {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start; /* 靠左對齊 */
        text-align: left;
        padding-left: 10px;
    }
    .subtitle-features li {
        width: 100%;
        box-sizing: border-box;
    }
}

/* 新增：屬性預覽區塊樣式 */
#stat-preview-box {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    padding: 10px;
    border-radius: 5px;
    justify-content: center;
}

.stat-preview-content {
    display: flex;
    gap: 15px;
    font-weight: bold;
    color: #1565c0;
    font-size: 1.1em;
    flex-wrap: wrap;
}

.stat-preview-content span {
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
