/* 各上头模拟器统一紧凑布局（与勋章制作一致） */
body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    padding: 8px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    margin: 0;
    color: #333;
    overflow-x: hidden;
}

/* 满级按钮样式 - 红色线框、无色背底、红色文字 */
.btn-max-level {
    background-color: transparent !important;
    border-color: #dc3545 !important;
    color: #dc3545 !important;
    cursor: not-allowed !important;
    opacity: 1;
}

.btn-max-level:hover {
    transform: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    border-color: #dc3545 !important;
    color: #dc3545 !important;
}

/* 隐藏滚动条但保持滚动功能 - 统一优化 */
* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    display: none;
}

/* 确保所有容器不会产生横向滚动 */
.page-wrap,
.equipment-card,
.card,
.sim-scroll-panel,
.inventory-scroll,
.badge-slots-container,
.target-selector,
.sim-row,
.top-stats-bar {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.page-wrap {
    max-width: 600px;
    margin: 0 auto;
}

h2 {
    font-size: 15px;
    margin: 6px 0;
}

h3 {
    font-size: 13px;
    margin: 4px 0;
}

.equipment-card,
.page-wrap > .card.panel-card {
    background-color: #fff;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.craft-main {
    margin-bottom: 8px;
}

.top-stats-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2px 8px;
    margin: 0 0 6px;
    padding: 4px 8px;
    font-size: 11px;
    background-color: #e9ecef;
    border-radius: 4px;
    line-height: 1.35;
}

.top-stats-bar .stat-sep {
    color: #adb5bd;
}

.top-stats-bar strong {
    font-weight: 700;
}

/* 与旧版 stats-bar / cost-info 顶部条兼容 */
.stats-bar.top-stats-bar,
.cost-info.top-stats-bar {
    margin-top: 0;
    margin-bottom: 6px;
}

.sim-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 0 0 6px;
}

.sim-col {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    max-width: calc(50% - 3px);
    display: flex;
}

.equipment-card.sim-panel {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sim-panel h3 {
    font-size: 12px;
    margin-bottom: 4px;
    line-height: 1.25;
}

.level-display {
    font-size: 12px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 2px;
}

.cost-info,
.info-strip {
    margin-top: 4px;
    padding: 5px 6px;
    background-color: #e9ecef;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.35;
}

.skill-display {
    font-size: 10px;
    margin-top: 4px;
    padding: 4px 6px;
    background-color: #e9ecef;
    border-radius: 4px;
    display: none;
    line-height: 1.4;
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    white-space: normal;
    overflow: hidden;
}

.result-message {
    margin-top: 6px;
    padding: 5px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.failure-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.btn {
    font-size: 12px;
    padding: 6px 10px;
    margin-top: 6px;
    transition: all 0.2s ease;
}

.water-btns {
    display: flex;
    gap: 4px;
    width: 100%;
    margin-top: 4px;
}

.water-btns .btn {
    margin-top: 0;
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    box-sizing: border-box;
}

.btn-count-group {
    display: flex;
    gap: 4px;
    width: 100%;
    margin-top: 4px;
}

.btn-count-group .btn {
    margin-top: 0;
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    height: 32px;
    box-sizing: border-box;
}

.sim-panel > .btn {
    width: 100%;
    margin-top: 4px;
    box-sizing: border-box;
    display: block;
}

.sim-toggle-btn {
    padding: 2px 8px;
    font-size: 12px;
    margin-top: 0;
    flex-shrink: 0;
    line-height: 1.4;
}

.rules-card .card-toggle-row,
.panel-toggle-row {
    margin-bottom: 0;
}

.rules-card .card-toggle-row h3,
.rules-card .card-toggle-row .mb-0 {
    font-size: 13px;
    color: #333;
}

.panel-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 4px 2px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.panel-section-header .panel-title {
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

.collapse-hint {
    font-size: 10px;
    color: #888;
    flex-shrink: 0;
}

.sim-scroll-panel {
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.probability-table {
    margin-top: 6px;
    font-size: 11px;
    margin-bottom: 0;
}

.probability-table th,
.probability-table td {
    text-align: center;
    padding: 4px 3px;
}

.badge-result {
    margin-top: 0;
    padding: 6px;
    border-radius: 6px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    font-size: 12px;
}

.craft-btn-wrap {
    margin-top: 6px;
}

.page-wrap .mb-3 {
    margin-bottom: 6px !important;
}

.page-wrap .mt-2 {
    margin-top: 4px !important;
}

.page-wrap .mt-3 {
    margin-top: 6px !important;
}

.page-wrap .mb-2 {
    margin-bottom: 4px !important;
}

/* 刻印模拟器 */
.crest-enhance .page-wrap > h2 {
    font-size: 14px;
    margin: 4px 0 6px;
}

.crest-enhance .card.panel-card {
    padding: 8px;
}

.crest-enhance .crest-select {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.crest-enhance .crest-option {
    padding: 8px 4px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 11px;
    background-color: #fff;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.crest-enhance .crest-option:hover {
    border-color: #007bff;
    background-color: #e3f2fd;
}

.crest-enhance .crest-option.selected {
    border-color: #28a745;
    background-color: #d4edda;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.2);
}

.crest-enhance .crest-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.crest-enhance .crest-name {
    font-weight: bold;
    color: #333;
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crest-enhance .stage-display-container {
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #dee2e6;
    position: relative;
}

.crest-enhance .main-content-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

.crest-enhance .left-panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 180px;
    flex-shrink: 0;
    min-width: 160px;
}

.crest-enhance .right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 160px;
    max-width: 220px;
}

.crest-enhance .circle-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0;
    max-width: 100%;
}

.crest-enhance .orb {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: scale(0);
}

.crest-enhance .orb.visible {
    opacity: 1;
    transform: scale(1);
}

.crest-enhance .orb.tier1 {
    width: 30px;
    height: 30px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 2px solid #ced4da;
    color: #6c757d;
}

.crest-enhance .orb.tier1.active {
    background: linear-gradient(145deg, #667eea, #764ba2);
    border-color: #aab;
    color: #fff;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.7);
    animation: pulse 1.5s infinite;
}

/* 第Ⅰ阶 - 日之起源 */
.crest-enhance .orb.tier1.sun {
    background: linear-gradient(145deg, #fff9e6, #fff3cd);
    border: 2px solid #f1c40f;
    color: #f1c40f;
}
.crest-enhance .orb.tier1.sun.active {
    background: linear-gradient(145deg, #f1c40f, #e67e22);
    border-color: #f39c12;
    color: #fff;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.7);
}

/* 第Ⅰ阶 - 月之起源 */
.crest-enhance .orb.tier1.moon {
    background: linear-gradient(145deg, #e8f4f8, #d4e6f1);
    border: 2px solid #3498db;
    color: #3498db;
}
.crest-enhance .orb.tier1.moon.active {
    background: linear-gradient(145deg, #3498db, #2980b9);
    border-color: #5dade2;
    color: #fff;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.7);
}

/* 第Ⅰ阶 - 云之起源 */
.crest-enhance .orb.tier1.cloud {
    background: linear-gradient(145deg, #e8f8f5, #d1f2eb);
    border: 2px solid #1abc9c;
    color: #1abc9c;
}
.crest-enhance .orb.tier1.cloud.active {
    background: linear-gradient(145deg, #1abc9c, #16a085);
    border-color: #48c9b0;
    color: #fff;
    box-shadow: 0 0 15px rgba(26, 188, 156, 0.7);
}

/* 第Ⅰ阶 - 勿忘草之起源 */
.crest-enhance .orb.tier1.flower {
    background: linear-gradient(145deg, #fde2e6, #fadbd8);
    border: 2px solid #e91e63;
    color: #e91e63;
}
.crest-enhance .orb.tier1.flower.active {
    background: linear-gradient(145deg, #e91e63, #c2185b);
    border-color: #f06292;
    color: #fff;
    box-shadow: 0 0 15px rgba(233, 30, 99, 0.7);
}

/* 第Ⅰ阶 - 星之起源 */
.crest-enhance .orb.tier1.star {
    background: linear-gradient(145deg, #f4ecf7, #e8daef);
    border: 2px solid #9b59b6;
    color: #9b59b6;
}
.crest-enhance .orb.tier1.star.active {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    border-color: #bb8fce;
    color: #fff;
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.7);
}

/* 第Ⅰ阶 - 闪电的起源 */
.crest-enhance .orb.tier1.lightning {
    background: linear-gradient(145deg, #fef9e7, #fdebd0);
    border: 2px solid #f39c12;
    color: #f39c12;
}
.crest-enhance .orb.tier1.lightning.active {
    background: linear-gradient(145deg, #f39c12, #d68910);
    border-color: #f5b041;
    color: #fff;
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.7);
}

/* 第Ⅰ阶 - 岛之起源 */
.crest-enhance .orb.tier1.island {
    background: linear-gradient(145deg, #f2f3f4, #e5e7e9);
    border: 2px solid #7f8c8d;
    color: #7f8c8d;
}
.crest-enhance .orb.tier1.island.active {
    background: linear-gradient(145deg, #7f8c8d, #707b7c);
    border-color: #aeb6bf;
    color: #fff;
    box-shadow: 0 0 15px rgba(127, 140, 141, 0.7);
}

.crest-enhance .orb.tier2-big {
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, #fff3cd, #ffeeba);
    border: 2px solid #ffc107;
    color: #856404;
}

.crest-enhance .orb.tier2-big.active {
    background: linear-gradient(145deg, #f39c12, #e74c3c);
    border-color: #fbb;
    color: #fff;
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.7);
    animation: pulse 1.5s infinite;
}

.crest-enhance .orb.tier2-small {
    width: 18px;
    height: 18px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1.5px solid #dee2e6;
    color: #adb5bd;
}

.crest-enhance .orb.tier2-small.active {
    background: linear-gradient(145deg, #ffd700, #ffaa00);
    border-color: #ffd;
    color: #333;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    animation: pulse 1.5s infinite;
}

/* 第Ⅱ阶 - 日之起源 */
.crest-enhance .orb.tier2-big.sun {
    background: linear-gradient(145deg, #fff9e6, #fff3cd);
    border: 2px solid #f1c40f;
    color: #f1c40f;
}
.crest-enhance .orb.tier2-big.sun.active {
    background: linear-gradient(145deg, #f1c40f, #e67e22);
    border-color: #f39c12;
    color: #fff;
    box-shadow: 0 0 18px rgba(241, 196, 15, 0.7);
}
.crest-enhance .orb.tier2-small.sun {
    background: linear-gradient(145deg, #fff9e6, #fff3cd);
    border: 1px solid #f1c40f;
    color: #f1c40f;
}
.crest-enhance .orb.tier2-small.sun.active {
    background: linear-gradient(145deg, #f1c40f, #e67e22);
    border-color: #f39c12;
    color: #fff;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.6);
}

/* 第Ⅱ阶 - 月之起源 */
.crest-enhance .orb.tier2-big.moon {
    background: linear-gradient(145deg, #e8f4f8, #d4e6f1);
    border: 2px solid #3498db;
    color: #3498db;
}
.crest-enhance .orb.tier2-big.moon.active {
    background: linear-gradient(145deg, #3498db, #2980b9);
    border-color: #5dade2;
    color: #fff;
    box-shadow: 0 0 18px rgba(52, 152, 219, 0.7);
}
.crest-enhance .orb.tier2-small.moon {
    background: linear-gradient(145deg, #e8f4f8, #d4e6f1);
    border: 1px solid #3498db;
    color: #3498db;
}
.crest-enhance .orb.tier2-small.moon.active {
    background: linear-gradient(145deg, #3498db, #2980b9);
    border-color: #5dade2;
    color: #fff;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.6);
}

/* 第Ⅱ阶 - 云之起源 */
.crest-enhance .orb.tier2-big.cloud {
    background: linear-gradient(145deg, #e8f8f5, #d1f2eb);
    border: 2px solid #1abc9c;
    color: #1abc9c;
}
.crest-enhance .orb.tier2-big.cloud.active {
    background: linear-gradient(145deg, #1abc9c, #16a085);
    border-color: #48c9b0;
    color: #fff;
    box-shadow: 0 0 18px rgba(26, 188, 156, 0.7);
}
.crest-enhance .orb.tier2-small.cloud {
    background: linear-gradient(145deg, #e8f8f5, #d1f2eb);
    border: 1px solid #1abc9c;
    color: #1abc9c;
}
.crest-enhance .orb.tier2-small.cloud.active {
    background: linear-gradient(145deg, #1abc9c, #16a085);
    border-color: #48c9b0;
    color: #fff;
    box-shadow: 0 0 10px rgba(26, 188, 156, 0.6);
}

/* 第Ⅱ阶 - 勿忘草之起源 */
.crest-enhance .orb.tier2-big.flower {
    background: linear-gradient(145deg, #fde2e6, #fadbd8);
    border: 2px solid #e91e63;
    color: #e91e63;
}
.crest-enhance .orb.tier2-big.flower.active {
    background: linear-gradient(145deg, #e91e63, #c2185b);
    border-color: #f06292;
    color: #fff;
    box-shadow: 0 0 18px rgba(233, 30, 99, 0.7);
}
.crest-enhance .orb.tier2-small.flower {
    background: linear-gradient(145deg, #fde2e6, #fadbd8);
    border: 1px solid #e91e63;
    color: #e91e63;
}
.crest-enhance .orb.tier2-small.flower.active {
    background: linear-gradient(145deg, #e91e63, #c2185b);
    border-color: #f06292;
    color: #fff;
    box-shadow: 0 0 10px rgba(233, 30, 99, 0.6);
}

/* 第Ⅱ阶 - 星之起源 */
.crest-enhance .orb.tier2-big.star {
    background: linear-gradient(145deg, #f4ecf7, #e8daef);
    border: 2px solid #9b59b6;
    color: #9b59b6;
}
.crest-enhance .orb.tier2-big.star.active {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    border-color: #bb8fce;
    color: #fff;
    box-shadow: 0 0 18px rgba(155, 89, 182, 0.7);
}
.crest-enhance .orb.tier2-small.star {
    background: linear-gradient(145deg, #f4ecf7, #e8daef);
    border: 1px solid #9b59b6;
    color: #9b59b6;
}
.crest-enhance .orb.tier2-small.star.active {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    border-color: #bb8fce;
    color: #fff;
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.6);
}

/* 第Ⅱ阶 - 闪电的起源 */
.crest-enhance .orb.tier2-big.lightning {
    background: linear-gradient(145deg, #fef9e7, #fdebd0);
    border: 2px solid #f39c12;
    color: #f39c12;
}
.crest-enhance .orb.tier2-big.lightning.active {
    background: linear-gradient(145deg, #f39c12, #d68910);
    border-color: #f5b041;
    color: #fff;
    box-shadow: 0 0 18px rgba(243, 156, 18, 0.7);
}
.crest-enhance .orb.tier2-small.lightning {
    background: linear-gradient(145deg, #fef9e7, #fdebd0);
    border: 1px solid #f39c12;
    color: #f39c12;
}
.crest-enhance .orb.tier2-small.lightning.active {
    background: linear-gradient(145deg, #f39c12, #d68910);
    border-color: #f5b041;
    color: #fff;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.6);
}

/* 第Ⅱ阶 - 岛之起源 */
.crest-enhance .orb.tier2-big.island {
    background: linear-gradient(145deg, #f2f3f4, #e5e7e9);
    border: 2px solid #7f8c8d;
    color: #7f8c8d;
}
.crest-enhance .orb.tier2-big.island.active {
    background: linear-gradient(145deg, #7f8c8d, #707b7c);
    border-color: #aeb6bf;
    color: #fff;
    box-shadow: 0 0 18px rgba(127, 140, 141, 0.7);
}
.crest-enhance .orb.tier2-small.island {
    background: linear-gradient(145deg, #f2f3f4, #e5e7e9);
    border: 1px solid #7f8c8d;
    color: #7f8c8d;
}
.crest-enhance .orb.tier2-small.island.active {
    background: linear-gradient(145deg, #7f8c8d, #707b7c);
    border-color: #aeb6bf;
    color: #fff;
    box-shadow: 0 0 10px rgba(127, 140, 141, 0.6);
}

.crest-enhance .center-icon {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 58px;
    background: transparent;
    border: 4px solid;
    transition: all 0.3s ease;
    z-index: 0;
}

.crest-enhance .center-icon.sun {
    color: #f1c40f;
    border-color: #f1c40f;
    box-shadow: none;
}

.crest-enhance .center-icon.moon {
    color: #3498db;
    border-color: #3498db;
    box-shadow: none;
}

.crest-enhance .center-icon.cloud {
    color: #1abc9c;
    border-color: #1abc9c;
    box-shadow: none;
}

.crest-enhance .center-icon.flower {
    color: #e91e63;
    border-color: #e91e63;
    box-shadow: none;
}

.crest-enhance .center-icon.star {
    color: #9b59b6;
    border-color: #9b59b6;
    box-shadow: none;
}

.crest-enhance .center-icon.lightning {
    color: #f39c12;
    border-color: #f39c12;
    box-shadow: none;
}

.crest-enhance .center-icon.island {
    color: #7f8c8d;
    border-color: #7f8c8d;
    box-shadow: none;
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 0 0 10px currentColor;
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 25px currentColor, 0 0 40px currentColor;
        transform: scale(1.05);
    }
}

.crest-enhance .tier-selector {
    display: flex;
    gap: 4px;
}

.crest-enhance .tier-tab {
    flex: 1;
    padding: 6px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #dee2e6;
    background: #f8f9fa;
    color: #6c757d;
    text-align: center;
    min-width: 0;
}

.crest-enhance .tier-tab.tier-1.active,
.crest-enhance .tier-tab.tier-2.active {
    background: #007bff !important;
    color: #fff !important;
    border-color: #007bff !important;
}

.crest-enhance .divider {
    height: 1px;
    background: #dee2e6;
    margin: 4px 0;
}

.crest-enhance .stage-info {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 16px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.crest-enhance .sale-tag {
    display: none;
    background: #dc3545;
    color: white;
    padding: 0 8px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 4px;
    height: 36px;
    width: 100%;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
}



.crest-enhance .stage-title {
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

.crest-enhance .tier-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 10px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    background: #e9ecef !important;
    border: 1px solid #dee2e6 !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    line-height: 1 !important;
    margin: 0 !important;
    color: #6c757d !important;
    font-weight: bold !important;
    box-sizing: border-box !important;
}

.crest-enhance .probability-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background-color: #fff3cd;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #ffeeba;
}

.crest-enhance .probability-value {
    font-size: 24px;
    font-weight: bold;
    color: #dc3545;
}

.crest-enhance .probability-label {
    font-size: 11px;
    color: #856404;
}

.crest-enhance .action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 0;
    align-items: center;
    height: 44px;
}

.crest-enhance .action-buttons .btn {
    width: 75px;
    margin: 0 !important;
    padding: 0 10px !important;
    font-size: 14px !important;
    flex-shrink: 0;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
}

.crest-enhance .action-buttons-row {
    display: flex;
    gap: 8px;
}

.crest-enhance .action-buttons-row .btn {
    flex: 1;
    margin: 0 !important;
    padding: 0 10px !important;
    font-size: 14px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
}

.crest-enhance .tier-badge-container {
    flex: 1;
    min-width: 0;
    height: 36px;
    display: flex;
    align-items: center;
}

.crest-enhance .tier-badge {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.crest-enhance .tier-selector {
    display: flex;
    gap: 6px;
}

.crest-enhance .tier-tab {
    flex: 1;
    padding: 0 !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: bold !important;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #dee2e6 !important;
    background: #f8f9fa !important;
    color: #6c757d !important;
    text-align: center;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.crest-enhance .reset-btn {
    font-size: 11px;
    padding: 6px 12px;
}

.crest-enhance .result-message {
    margin: 0 0 8px 0;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
    animation: fadeInUp 0.4s ease;
}

.crest-enhance .hint-message {
    margin: 4px 0;
    padding: 6px 8px;
    font-size: 11px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    box-sizing: border-box;
    overflow: visible;
    white-space: nowrap;
}

.crest-enhance .hint-message::before {
    content: '';
    width: 3px;
    height: 32px;
    border-radius: 2px;
    background: #667eea;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.crest-enhance .success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.crest-enhance .failure-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.crest-enhance .max-message {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.crest-enhance .probability-table {
    margin-top: 8px;
    font-size: 10px;
}

.crest-enhance .probability-table th,
.crest-enhance .probability-table td {
    text-align: center;
    padding: 4px 2px;
}

.crest-enhance .probability-table .current-stage {
    font-weight: bold;
    color: #dc3545;
    background-color: #fff3cd;
}

.crest-enhance .probability-table .tier-1-header {
    background-color: #cce5ff;
    color: #004085;
    font-weight: bold;
}

.crest-enhance .probability-table .tier-2-header {
    background-color: #fff3cd;
    color: #856404;
    font-weight: bold;
}

.crest-enhance .collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    color: #6c757d;
}

.crest-enhance .collapsible-header:hover {
    color: #007bff;
}

.crest-enhance .collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.crest-enhance .collapsible-content.open {
    max-height: 500px;
}

.crest-enhance .lightning { color: #f39c12; }
.crest-enhance .star { color: #9b59b6; }
.crest-enhance .sun { color: #f1c40f; }
.crest-enhance .moon { color: #3498db; }
.crest-enhance .cloud { color: #1abc9c; }
.crest-enhance .flower { color: #e91e63; }
.crest-enhance .island { color: #7f8c8d; }

.crest-enhance .enhance-btn {
    position: relative;
    overflow: hidden;
}

.crest-enhance .enhance-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.crest-enhance .enhance-btn:hover::after {
    left: 100%;
}

@media (max-width: 576px) {
    body {
        padding: 4px 6px;
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }

    .crest-enhance .hint-message {
        height: 26px;
        padding: 4px 8px;
    }

    .equipment-card,
    .page-wrap > .card.panel-card {
        padding: 6px;
        margin-bottom: 6px;
    }

    .top-stats-bar {
        font-size: 10px;
        padding: 3px 6px;
        margin-bottom: 4px;
    }

    .sim-row {
        gap: 4px;
    }

    .sim-col {
        flex: 1 1 calc(50% - 2px);
        max-width: calc(50% - 2px);
    }

    .sim-panel h3 {
        font-size: 11px;
    }

    .level-display {
        font-size: 11px;
    }

    .cost-info,
    .info-strip {
        font-size: 10px;
        padding: 4px 5px;
    }

    .sim-hide-mobile {
        display: none !important;
    }

    .btn {
        font-size: 11px;
        padding: 5px 8px;
        margin-top: 4px;
    }

    .btn-count-group .btn {
        height: 28px;
        font-size: 11px;
    }

    .sim-scroll-panel {
        max-height: 120px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        box-sizing: border-box;
    }

    .probability-table {
        font-size: 10px;
    }

    .probability-table th,
    .probability-table td {
        padding: 3px 2px;
    }

    .water-container {
        gap: 8px !important;
        margin: 6px 0 !important;
    }

    .crest-enhance .crest-select {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
    }

    .crest-enhance .crest-option {
        padding: 6px 3px;
        font-size: 10px;
        border-width: 1px;
        min-height: 42px;
    }

    .crest-enhance .crest-icon {
        font-size: 15px;
        margin-bottom: 1px;
    }

    .crest-enhance .crest-name {
        font-size: 8px;
    }

    .crest-enhance .circle-container {
        width: 160px;
        height: 160px;
        max-width: 100%;
    }

    .crest-enhance .orb.tier1 {
        width: 24px;
        height: 24px;
        font-size: 8px;
        border-width: 1.5px;
    }

    .crest-enhance .orb.tier2-big {
        width: 28px;
        height: 28px;
        font-size: 8px;
        border-width: 1.5px;
    }

    .crest-enhance .orb.tier2-small {
        width: 14px;
        height: 14px;
        border-width: 1px;
    }

    .crest-enhance .center-icon {
        font-size: 44px;
        border-width: 3px;
    }

    .crest-enhance .left-panel {
        width: 160px;
        min-width: 140px;
    }

    .crest-enhance .action-buttons {
        height: 38px;
    }

    .crest-enhance .action-buttons .btn {
        width: 65px !important;
        padding: 0 6px !important;
        font-size: 12px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .crest-enhance .action-buttons-row .btn {
        padding: 0 6px !important;
        font-size: 12px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .crest-enhance .tier-badge {
        font-size: 11px !important;
        padding: 0 8px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .crest-enhance .tier-tab {
        padding: 0 !important;
        font-size: 12px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .crest-enhance .stage-title {
        font-size: 12px;
    }

    .crest-enhance .tier-badge {
        font-size: 11px;
        padding: 3px 10px;
        margin-top: 4px;
    }

    .crest-enhance .sale-tag {
        height: 38px !important;
        width: 100% !important;
        font-size: 11px !important;
        padding: 0 8px !important;
    }

    .crest-enhance .probability-value {
        font-size: 22px;
    }

    .crest-enhance .probability-label {
        font-size: 11px;
    }

    .crest-enhance .probability-table {
        font-size: 10px;
    }

    .crest-enhance .probability-table th,
    .crest-enhance .probability-table td {
        padding: 3px 2px;
    }

    .crest-enhance .result-message {
        margin: 0 0 6px 0;
    }

    /* 珍珠 */
    .pearl-container {
        margin: 6px 0 !important;
    }

    .pearl-row {
        gap: 4px !important;
        margin-bottom: 4px !important;
    }

    .pearl-slot {
        width: 48px !important;
        height: 48px !important;
    }

    .pearl {
        width: 40px !important;
        height: 40px !important;
    }

    .combine-section {
        margin-top: 8px !important;
        padding-top: 8px !important;
    }

    .combine-pearl-slot {
        width: 56px !important;
        height: 56px !important;
    }

    .combine-slot {
        width: 72px !important;
    }

    .lock-column {
        margin: 0 4px !important;
        padding-top: 56px !important;
    }

    .button-container {
        gap: 6px !important;
        margin: 6px 0 !important;
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    .button-container .btn {
        width: auto !important;
        flex: 1;
        min-width: 0;
        margin-top: 0;
    }
}

@media (max-width: 390px) {
    .top-stats-bar {
        font-size: 10px;
        gap: 2px 6px;
    }

    .sim-scroll-panel {
        max-height: 96px;
    }

    .crest-enhance .crest-select {
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
    }

    .crest-enhance .crest-option {
        padding: 5px 2px;
        font-size: 9px;
        min-height: 38px;
    }

    .crest-enhance .crest-icon {
        font-size: 13px;
    }

    .crest-enhance .crest-name {
        font-size: 7px;
    }

    .crest-enhance .circle-container {
        width: 140px !important;
        height: 140px !important;
    }

    .crest-enhance .orb.tier1 {
        width: 22px !important;
        height: 22px !important;
        font-size: 7px !important;
    }

    .crest-enhance .orb.tier2-big {
        width: 26px !important;
        height: 26px !important;
        font-size: 7px !important;
    }

    .crest-enhance .orb.tier2-small {
        width: 12px !important;
        height: 12px !important;
    }

    .crest-enhance .center-icon {
        font-size: 38px !important;
    }

    .crest-enhance .left-panel {
        width: 145px !important;
        min-width: 130px;
    }

    .crest-enhance .action-buttons .btn {
        width: 58px !important;
        font-size: 11px !important;
    }

    .crest-enhance .action-buttons-row .btn {
        font-size: 11px !important;
    }
}

/* 超小屏手机 (max-width: 360px) */
@media (max-width: 360px) {
    body {
        padding: 3px 4px;
        padding-bottom: max(3px, env(safe-area-inset-bottom));
    }

    .page-wrap {
        max-width: 100%;
    }

    .equipment-card,
    .page-wrap > .card.panel-card {
        padding: 5px;
        margin-bottom: 5px;
        border-radius: 4px;
    }

    .top-stats-bar {
        font-size: 8px;
        gap: 1px 3px;
        padding: 2px 4px;
    }

    .top-stats-bar strong {
        font-size: 8px;
    }

    .sim-row {
        gap: 3px;
    }

    .sim-col {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .sim-panel h3 {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .level-display {
        font-size: 10px;
        margin-bottom: 1px;
    }

    .cost-info,
    .info-strip {
        font-size: 9px;
        padding: 3px 4px;
    }

    .btn {
        font-size: 10px;
        padding: 4px 6px;
        min-height: 32px;
    }

    .btn-count-group .btn {
        height: 28px;
        font-size: 10px;
    }

    .sim-scroll-panel {
        max-height: 80px;
    }

    .probability-table {
        font-size: 8px;
    }

    .probability-table th,
    .probability-table td {
        padding: 2px 1px;
    }

    .crest-enhance .crest-select {
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
    }

    .crest-enhance .crest-option {
        padding: 4px 2px;
        font-size: 8px;
        border-width: 1px;
        min-height: 36px;
    }

    .crest-enhance .crest-icon {
        font-size: 12px;
    }

    .crest-enhance .crest-name {
        font-size: 6px;
    }

    .crest-enhance .circle-container {
        width: 130px !important;
        height: 130px !important;
    }

    .crest-enhance .orb.tier1 {
        width: 20px !important;
        height: 20px !important;
        font-size: 6px !important;
        border-width: 1px;
    }

    .crest-enhance .orb.tier2-big {
        width: 24px !important;
        height: 24px !important;
        font-size: 6px !important;
        border-width: 1px;
    }

    .crest-enhance .orb.tier2-small {
        width: 10px !important;
        height: 10px !important;
        border-width: 1px;
    }

    .crest-enhance .center-icon {
        font-size: 34px !important;
        border-width: 2px;
    }

    .crest-enhance .left-panel {
        width: 135px !important;
        min-width: 120px;
    }

    .crest-enhance .action-buttons {
        height: 34px;
    }

    .crest-enhance .action-buttons .btn {
        width: 52px !important;
        padding: 0 4px !important;
        font-size: 10px !important;
        height: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;
    }

    .crest-enhance .action-buttons-row .btn {
        padding: 0 4px !important;
        font-size: 10px !important;
        height: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;
    }

    .crest-enhance .tier-badge {
        font-size: 10px !important;
        padding: 0 6px !important;
        height: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;
    }

    .crest-enhance .tier-tab {
        font-size: 11px !important;
        height: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;
    }

    .crest-enhance .stage-title {
        font-size: 11px;
    }

    .crest-enhance .probability-value {
        font-size: 20px;
    }

    .crest-enhance .probability-label {
        font-size: 10px;
    }

    .crest-enhance .probability-table {
        font-size: 9px;
    }

    .crest-enhance .result-message {
        font-size: 11px;
        padding: 6px 8px;
    }

    .pearl-container {
        margin: 4px 0 !important;
    }

    .pearl-row {
        gap: 3px !important;
        margin-bottom: 3px !important;
    }

    .pearl-slot {
        width: 44px !important;
        height: 44px !important;
    }

    .pearl {
        width: 36px !important;
        height: 36px !important;
    }

    .combine-section {
        margin-top: 6px !important;
        padding-top: 6px !important;
    }

    .combine-pearl-slot {
        width: 52px !important;
        height: 52px !important;
    }

    .combine-slot {
        width: 68px !important;
    }

    .lock-column {
        margin: 0 3px !important;
        padding-top: 52px !important;
    }

    .button-container {
        gap: 4px !important;
        margin: 4px 0 !important;
    }
}

/* 超小屏手机 (max-width: 320px) */
@media (max-width: 320px) {
    body {
        padding: 2px 3px;
        padding-bottom: max(2px, env(safe-area-inset-bottom));
    }

    .equipment-card,
    .page-wrap > .card.panel-card {
        padding: 4px;
        margin-bottom: 4px;
    }

    .top-stats-bar {
        font-size: 7px;
        gap: 1px 2px;
        padding: 2px 3px;
    }

    .sim-panel h3 {
        font-size: 9px;
    }

    .level-display {
        font-size: 9px;
    }

    .cost-info,
    .info-strip {
        font-size: 8px;
        padding: 2px 3px;
    }

    .btn {
        font-size: 9px;
        padding: 3px 5px;
        min-height: 30px;
    }

    .btn-count-group .btn {
        height: 26px;
        font-size: 9px;
    }

    .sim-scroll-panel {
        max-height: 70px;
    }

    .probability-table {
        font-size: 7px;
    }

    .crest-enhance .crest-select {
        gap: 1px;
    }

    .crest-enhance .crest-option {
        padding: 3px 1px;
        font-size: 7px;
        min-height: 34px;
    }

    .crest-enhance .crest-icon {
        font-size: 11px;
    }

    .crest-enhance .crest-name {
        font-size: 5px;
    }

    .crest-enhance .circle-container {
        width: 120px !important;
        height: 120px !important;
    }

    .crest-enhance .orb.tier1 {
        width: 18px !important;
        height: 18px !important;
        font-size: 5px !important;
    }

    .crest-enhance .orb.tier2-big {
        width: 22px !important;
        height: 22px !important;
        font-size: 5px !important;
    }

    .crest-enhance .orb.tier2-small {
        width: 10px !important;
        height: 10px !important;
    }

    .crest-enhance .center-icon {
        font-size: 30px !important;
    }

    .crest-enhance .left-panel {
        width: 125px !important;
        min-width: 110px;
    }

    .crest-enhance .action-buttons {
        height: 32px;
    }

    .crest-enhance .action-buttons .btn {
        width: 48px !important;
        padding: 0 3px !important;
        font-size: 9px !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
    }

    .crest-enhance .action-buttons-row .btn {
        padding: 0 3px !important;
        font-size: 9px !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
    }

    .crest-enhance .tier-badge {
        font-size: 9px !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
    }

    .crest-enhance .tier-tab {
        font-size: 10px !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
    }

    .pearl-slot {
        width: 40px !important;
        height: 40px !important;
    }

    .pearl {
        width: 32px !important;
        height: 32px !important;
    }

    .combine-pearl-slot {
        width: 48px !important;
        height: 48px !important;
    }

    .combine-slot {
        width: 64px !important;
    }
}

/* 横屏优化 (landscape orientation) */
@media (max-width: 992px) and (orientation: landscape) {
    body {
        padding: 4px 8px;
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }

    .page-wrap {
        max-width: 900px;
    }

    .sim-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .sim-col {
        flex: none;
        max-width: 100%;
    }

    .top-stats-bar {
        font-size: 10px;
        gap: 2px 10px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .equipment-card,
    .page-wrap > .card.panel-card {
        padding: 6px;
        margin-bottom: 6px;
    }

    .btn {
        font-size: 11px;
        padding: 5px 8px;
        min-height: 34px;
    }

    .crest-enhance .main-content-row {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .crest-enhance .left-panel {
        width: 200px;
        flex-shrink: 0;
    }

    .crest-enhance .right-panel {
        flex: 1;
        min-width: 200px;
    }

    .crest-enhance .circle-container {
        width: 180px;
        height: 180px;
    }

    .sim-scroll-panel {
        max-height: 100px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    body {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    button,
    .btn,
    .sim-toggle-btn,
    .tier-tab,
    .crest-option,
    .badge-option,
    .panel-section-header,
    .collapsible-header {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 14px;
    }

    .btn-count-group .btn {
        min-height: 44px;
        padding: 10px 8px;
    }

    .water-btns .btn {
        min-height: 44px;
        padding: 10px 8px;
    }

    .crest-enhance .action-buttons .btn,
    .crest-enhance .action-buttons-row .btn {
        min-height: 44px !important;
        height: 44px !important;
        font-size: 12px !important;
        padding: 0 12px !important;
    }

    .crest-enhance .tier-tab,
    .crest-enhance .tier-badge {
        min-height: 44px !important;
        height: 44px !important;
        font-size: 12px !important;
    }

    .crest-option {
        padding: 12px 6px;
    }

    .crest-enhance .crest-icon {
        font-size: 14px;
    }

    .crest-enhance .crest-name {
        font-size: 9px;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }

    .card,
    .equipment-card {
        border: 2px solid #333;
    }
}

/* 减少动画支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 防止文本自动调整 */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* 确保所有容器不会产生横向滚动 */
* {
    box-sizing: border-box;
    max-width: 100%;
}

/* 图片响应式 */
img {
    max-width: 100%;
    height: auto;
}

/* iframe 响应式 */
iframe {
    max-width: 100%;
}
