* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 16px;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 24px 20px;
    text-align: center;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

.header p {
    opacity: 0.95;
    font-size: 0.95rem;
    margin: 0;
}

.calculator {
    padding: 24px 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.input-group input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.15);
    transform: translateY(-1px);
}

.input-group button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.input-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 172, 254, 0.4);
}

.input-group button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
}

.result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
}

.result h3 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 1.2rem;
    font-weight: 600;
}

.breakdown {
    margin-bottom: 20px;
}

.step {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    flex-wrap: wrap;
}

.step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #4facfe;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 2px;
}

.step-content {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.step-fee {
    font-weight: 600;
    color: #27ae60;
    font-size: 0.95rem;
    margin-left: auto;
    padding-left: 8px;
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
}

.total {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
}

.total strong {
    font-size: 1.4rem;
    display: block;
    margin-top: 6px;
    font-weight: 700;
}

.error {
    background: #ffe6e6;
    color: #c0392b;
    padding: 14px;
    border-radius: 6px;
    margin-top: 16px;
    text-align: center;
    font-size: 0.95rem;
    border: 1px solid #ffcccc;
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 1rem;
}

/* 平板设备适配 */
@media (min-width: 600px) {
    .input-group {
        flex-direction: row;
        align-items: center;
    }
    
    .input-group input {
        flex: 1;
        margin-right: 12px;
    }
    
    .input-group button {
        width: auto;
        min-width: 120px;
    }
    
    .header {
        padding: 28px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .calculator {
        padding: 28px;
    }
}

/* 桌面设备适配 */
@media (min-width: 768px) {
    body {
        padding: 24px;
    }
    
    .container {
        border-radius: 16px;
    }
    
    .header {
        padding: 32px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .calculator {
        padding: 32px;
    }
    
    .step {
        padding: 16px;
        align-items: center;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .step-content {
        font-size: 1rem;
    }
    
    .step-fee {
        font-size: 1rem;
    }
    .total-summary {
        background: linear-gradient(135deg, #3182ce 0%, #00b5d8 100%);
    }
    
    .breakdown h4 {
        color: #90cdf4;
    }
    
    .detail-summary {
        background: rgba(45, 55, 72, 0.6);
        border-left-color: #3182ce;
    }
    
    .detail-content {
        color: #cbd5e0;
    }
}

/* 超小屏幕手机适配 */
@media (max-width: 600px) {
    body {
        padding: 12px;
        font-size: 14px;
    }
    
    .header h1 {
        font-size: 1.6rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .input-group input,
    .input-group button {
        padding: 14px;
        font-size: 0.95rem;
    }
    
    .step {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .step-number {
        margin-right: 0;
    }
    
    .step-fee {
        margin-left: 0;
        text-align: left;
        width: 100%;
        padding-left: 0;
        padding-top: 8px;
        border-top: 1px solid #eee;
    }
}

/* 防止手机端输入框缩放 */
@media (max-width: 480px) {
    input, select, textarea {
        font-size: 16px !important; /* 防止iOS缩放 */
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    .input-group button:hover {
        transform: none;
    }
    
    .input-group input:focus {
        transform: none;
    }
}

/* 深色模式支持 - 修正版 */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }
    
    .container {
        background: rgba(26, 32, 44, 0.95);
        color: #e2e8f0;
        backdrop-filter: blur(10px);
    }
    
    .header {
        background: linear-gradient(135deg, #3182ce 0%, #00b5d8 100%);
    }
    
    .input-group input {
        background: rgba(45, 55, 72, 0.8);
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .input-group input::placeholder {
        color: #a0aec0;
    }
    
    .input-group input:focus {
        border-color: #3182ce;
        box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
        background: rgba(45, 55, 72, 1);
    }
    
    .result {
        background: rgba(45, 55, 72, 0.6);
        border: 1px solid #4a5568;
    }
    
    .step {
        background: rgba(45, 55, 72, 0.8);
        border: 1px solid #4a5568;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .result h3 {
        color: #90cdf4;
    }
    
    .step-content {
        color: #cbd5e0;
    }
    
    .step-fee {
        color: #68d391; /* 保持绿色，但调整为暗色模式友好的绿色 */
    }
    
    .total {
        background: linear-gradient(135deg, #3182ce 0%, #00b5d8 100%);
        border: 1px solid #4299e1;
    }
    
    .error {
        background: rgba(254, 215, 215, 0.1);
        color: #fc8181;
        border: 1px solid rgba(254, 215, 215, 0.2);
    }
    
    .loading {
        color: #a0aec0;
    }
    
    /* 按钮在暗色模式下的优化 */
    .input-group button {
        box-shadow: 0 4px 12px rgba(49, 130, 206, 0.4);
    }
    
    .input-group button:hover {
        box-shadow: 0 6px 16px rgba(49, 130, 206, 0.5);
    }
    
    .input-group button:active {
        box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
    }
}

/* 暗色模式下的超小屏幕适配 */
@media (prefers-color-scheme: dark) and (max-width: 360px) {
    .step-fee {
        border-top-color: #4a5568;
    }
    .total-summary {
        padding: 15px;
        font-size: 1.1em;
    }
    
    .total-summary strong {
        font-size: 1.3em;
    }
    
    .detail-summary {
        padding: 12px;
        font-size: 0.9em;
    }
}
