* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft JhengHei', '微軟正黑體', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.main-header {
    background: linear-gradient(135deg, #7ebaee, #93c8f7);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-container {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid white;
}

.logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-right {
    font-size: 14px;
    opacity: 0.9;
}

/* 新增：導航選項卡樣式 */
.calculator-tabs {
    max-width: 1200px;
    margin: 0 auto 20px;
    display: flex;
    border-bottom: 1px solid #ddd;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tab {
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
    font-size: 16px;
}

.tab:hover {
    color: #003B6D;
    background-color: #f8f9fa;
}

.tab.active {
    color: #003B6D;
    font-weight: 600;
}

.tab.active:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #003B6D;
}

.results-sticky-wrapper {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding: 10px 15px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

/* 手機版取消sticky效果 */
@media (max-width: 768px) {
    .results-sticky-wrapper {
        position: static;
    }
}

.results-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.result-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    flex: 1;
    min-width: 250px;
}

.result-card h2 {
    color: #003B6D;
    margin-bottom: 15px;
    font-size: 1.4em;
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 8px;
}

.result-values {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    height: 45px;
    align-items: center;
}

.result-item:last-child {
    border-bottom: none;
}

.label {
    font-weight: 600;
    color: #555;
}

.value {
    font-weight: bold;
    color: #003B6D;
}

.increase {
    color: #e74c3c;
}

.result-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

.result-input label {
    min-width: 100px;
    font-weight: 500;
}

input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 120px;
    font-size: 16px;
}

.yinmingfu-option {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #eee;
}

/* 新增：新印傳選項樣式 */
.new-yinchuan-option {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #eee;
}

/* 新增：只影響改動後屬性值的選項樣式 */
.after-only-options {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #eee;
}

.result-final {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    font-size: 1.2em;
    font-weight: bold;
}

.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px 30px;
    display: flex;
    gap: 25px;
}

.side-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    flex: 1;
    overflow: hidden;
    position: relative;
}

.side-panel h2 {
    color: #003B6D;
    padding: 15px 20px;
    margin: 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
}

/* 關鍵修復：兩個按鈕垂直對齊 - 精確定位 */
.copy-button-container-panel {
    position: absolute;
    z-index: 10;
}

.copy-button-container-panel.top {
    top: 15px;
    right: 20px;
}

/* 關鍵修復：底部按鈕在"精靈"項目下方，不阻擋內容 */
.copy-button-container-panel.bottom {
    /* 關鍵：使用 bottom 定位確保在內容下方 */
    position: relative;
    padding: 15px 20px;
    text-align: right;
    background: white;
    z-index: 5;
}

.copy-button {
    background: #003B6D;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
    /* 確保與頂部按鈕寬度一致 */
    min-width: 100px;
}

.copy-button:hover {
    background: #002F57;
    transform: translateY(-2px);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #003B6D;
    border-bottom: 2px solid #eee;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    height: 45px;
    vertical-align: middle;
}

/* 關鍵修復：啟用/選擇列 - 精確對齊 */
.controls-cell {
    padding: 0 10px !important;
    text-align: left; /* 所有內容左對齊 */
    position: relative;
    height: 100%;
}

/* 關鍵修復：統一Checkbox樣式和位置 */
.controls-cell input[type="checkbox"] {
    transform: scale(1.2);
    margin: 0;
    position: relative;
    left: 0;
    top: 1px; /* 精確垂直對齊 */
    display: inline-block;
    vertical-align: middle;
}

/* 關鍵修復：下拉選單樣式和位置 */
.controls-cell select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    width: auto;
    max-width: 150px;
    margin-left: 10px; /* 與checkbox的間距 */
    vertical-align: middle;
    display: inline-block;
}

/* 關鍵修復：屬性值數字置中對齊 */
.value-cell {
    font-weight: bold;
    color: #003B6D;
    text-align: center;
    padding: 0 15px !important;
}

/* 手機版新增：並排顯示項目 */
.result-input-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 8px 0;
}

.result-input-group .result-input {
    flex: 1;
    min-width: 0; /* 允許flex項目收縮 */
}

.mobile-attr-value {
    display: none; /* 默認隱藏 */
    text-align: right;
    white-space: nowrap;
    margin-left: 10px;
}

.mobile-attr-value .label {
    font-weight: 500;
    color: #555;
    margin-right: 5px;
}

.mobile-attr-value .value {
    font-weight: bold;
    color: #003B6D;
}

/* 新增：通用計算器樣式 */
.main-content {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.skill-damage-calculator,
.critical-calculator,
.critical-damage-calculator {
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    padding: 25px;
}

.skill-damage-calculator h2,
.critical-calculator h2,
.critical-damage-calculator h2 {
    color: #003B6D;
    margin-bottom: 20px;
    font-size: 1.6em;
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 10px;
}

.input-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 500;
    color: #555;
}

.input-group input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.result-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.result-section .result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #ddd;
}

.result-section .result-item:last-child {
    border-bottom: none;
}

/* 電腦版顯示，手機版隱藏 */
.desktop-only {
    display: block;
}

/* 電腦版隱藏，手機版顯示 */
.mobile-only {
    display: none;
}

/* 手機版優化 */
@media (max-width: 768px) {
    /* 隱藏屬性值總計卡片 */
    .desktop-only {
        display: none;
    }
    
    /* 顯示手機版特殊佈局 */
    .mobile-only {
        display: block;
    }
    
    .results-container {
        flex-direction: column;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    /* 關鍵修復：手機版按鈕樣式 */
    .copy-button-container-panel {
        position: static;
        margin: 10px 0;
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    
    .copy-button-container-panel.top {
        margin-top: 0;
    }
    
    .copy-button-container-panel.bottom {
        margin-top: 0;
        padding: 10px 15px;
    }
    
    /* 讓傷害增幅計算區域佔滿整個寬度 */
    .results-container > .result-card:last-child {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 調整傷害增幅計算區域的內部間距 */
    .results-container > .result-card:last-child {
        padding: 15px;
    }
    
    .result-card h2 {
        font-size: 1.4em;
        padding-bottom: 8px;
    }
    
    .result-input {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin: 0;
    }
    
    .result-input label {
        font-size: 0.95em;
        min-width: 90px;
    }
    
    input[type="number"] {
        width: 80px;
        max-width: 80px;
        padding: 6px;
        font-size: 14px;
    }
    
    .yinmingfu-option {
        padding-top: 0;
        margin-top: 0;
        border-top: none;
    }
    
    /* 新增：手機版新印傳選項樣式 */
    .new-yinchuan-option {
        padding-top: 0;
        margin-top: 0;
        border-top: none;
        margin-left: 15px; /* 與印冥符的間距 */
        border-left: 1px solid #eee;
        padding-left: 15px;
    }
    
    /* 新增：手機版只影響改動後屬性值的選項樣式 */
    .after-only-options {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #eee;
        font-size: 0.85em;
        color: #777;
    }
    
    /* 在手機版上，只影響改動後的選項應該有自己的行 */
    .after-only-options .result-input {
        margin: 0;
        padding: 0;
    }
    
    .result-final {
        font-size: 1.3em;
        padding-top: 12px;
        margin-top: 12px;
        border-top: 2px solid #eaeaea;
    }
    
    /* 調整sticky wrapper高度 */
    .results-sticky-wrapper {
        padding: 0 10px;
        margin-bottom: 15px;
    }
    
    .results-sticky-wrapper:after {
        height: 8px;
    }
    
    /* 縮小面板間距 */
    .main-container {
        padding: 0 10px 15px;
        gap: 10px;
    }
    
    .side-panel {
        padding: 0;
    }
    
    /* 縮小表格間距 */
    table th, table td {
        padding: 10px 8px;
        height: 45px;
    }
    
    /* 調整複製按鈕樣式 */
    .copy-button {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    /* 手機版上顯示並排項目 */
    .mobile-attr-value {
        display: block;
    }
    
    /* 移除頂部和底部的額外間距 */
    .result-input-group {
        margin: 5px 0;
    }
    
    /* 手機版導航選項卡 */
    .calculator-tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* 手機版計算器樣式 */
    .input-section {
        grid-template-columns: 1fr;
    }
    
    .skill-damage-calculator,
    .critical-calculator,
    .critical-damage-calculator {
        padding: 20px 15px;
    }
    
    /* 關鍵修改：手機版附魔區域樣式調整 */
    .enchants-sticky-wrapper {
        position: static;
        top: auto;
        padding: 15px;
        margin-bottom: 15px;
        box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    }
    
    /* 將附魔區域改為垂直排列 */
    .enchants-container {
        flex-direction: column;
        gap: 15px;
    }
    
    /* 確保每個附魔區塊在手機上佔滿寬度 */
    .enchant-column {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 調整附魔區域內元素的間距 */
    .enchant-row {
        flex-wrap: wrap;
        margin-bottom: 10px;
    }
    
    .enchant-row label, 
    .enchant-row span {
        min-width: 70px;
        font-size: 14px;
    }
    
    .enchant-row select {
        width: auto;
        min-width: 80px;
        margin-right: 8px;
    }
    
    /* 調整標題大小 */
    .enchant-column h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    /* 確保爆擊計算區域在傷害計算區域下方 */
    .results-container {
        flex-direction: column;
    }
    
    /* 調整結果區域的間距 */
    .result-card {
        margin-bottom: 15px;
    }
    
    .result-card:last-child {
        margin-bottom: 0;
    }
    
    /* 修正手機版上"只影響改動後"選項的字體樣式 */
    .mobile-attr-grid .mobile-attr-item label {
        font-weight: 500;
        color: #555;
        font-size: 14px;
    }
    
    /* 確保"只影響改動後"的選項與其他選項字體一致 */
    .mobile-attr-grid .mobile-attr-item:nth-child(6),
    .mobile-attr-grid .mobile-attr-item:nth-child(7) {
        font-size: 14px;
        color: #555;
    }
}
/* 新增：啟用框樣式 */
.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.dragon-tian-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.dragon-tian-info {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    padding-left: 28px;
}
