* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
}

.page-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    overflow-x: hidden;
    padding: 0 10px;
}

.headerr {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e6ed;
    width: 100%;
    max-width: 1200px;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 32px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 18px;
    margin-bottom: 20px;
}

.alert-banner {
    background: linear-gradient(135deg, #fff8e1, #fff3cd);
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    box-sizing: border-box;
}

.alert-banner .alert-icon {
    color: #ff9800;
    font-size: 24px;
    margin-top: 2px;
}

.alert-banner p {
    margin: 0;
    flex: 1;
}

.alert-banner strong {
    color: #d35400;
}

.container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.calculator-section {
    flex: 1;
    min-width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
    box-sizing: border-box;
    width: 100%;
}

.results-section {
    flex: 1;
    min-width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
}

h3:hover {
    background-color: #e8f4fc;
}

h3 .toggle-icon {
    font-size: 20px;
    color: #3498db;
    transition: transform 0.3s;
}

.input-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
}

.required::after {
    content: " *";
    color: #e74c3c;
}

select, input[type="number"] {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background-color: #fff;
    box-sizing: border-box;
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.input-hint {
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 5px;
}

.input-error {
    font-size: 13px;
    color: #e74c3c;
    margin-top: 5px;
    display: none;
}

.radio-group, .checkbox-group-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 8px;
}

.radio-option, .checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8fafc;
    border-radius: 6px;
    border: 2px solid #e0e6ed;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 120px;
    box-sizing: border-box;
}

.radio-option:hover, .checkbox-option:hover {
    border-color: #3498db;
    background: #e8f4fc;
}

.radio-option.selected, .checkbox-option.selected {
    border-color: #3498db;
    background: #e8f4fc;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.radio-option input, .checkbox-option input {
    margin: 0;
}

.calculate-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 18px 30px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-top: 10px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
}

.calculate-btn:hover {
    background: linear-gradient(135deg, #2980b9, #2573a7);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(41, 128, 185, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

.calculate-btn .btn-icon {
    font-size: 20px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    box-sizing: border-box;
}

.result-card {
    background: linear-gradient(135deg, #f8fafc, #e8f4fc);
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid #3498db;
    box-sizing: border-box;
    width: 100%;
}

.result-card.warning {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #fff8e1, #fff3cd);
}

.result-card.danger {
    border-left-color: #e74c3c;
    background: linear-gradient(135deg, #ffeaea, #ffd6d6);
}

.result-title {
    font-size: 14px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-value {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.result-subtitle {
    font-size: 14px;
    color: #666;
}

.breakdown-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e6ed;
    width: 100%;
}

.breakdown-list {
    list-style: none;
    padding: 0;
}

.breakdown-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
}

.breakdown-list li:last-child {
    border-bottom: none;
    font-weight: 600;
    color: #2c3e50;
    background: #f8fafc;
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
}

.state-rules-content {
    max-height: 500px;
    overflow-y: auto;
    transition: all 0.3s ease;
    padding-right: 5px;
    margin-top: 15px;
    width: 100%;
}

.state-rules-content.collapsed {
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
}

.state-table-wrapper {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.state-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

.state-table th {
    background-color: #2c3e50;
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.state-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e6ed;
}

.state-table tbody tr:hover {
    background-color: #f8fafc;
}

.state-table tbody tr.current-state {
    background-color: #e8f4fc !important;
    font-weight: 600;
    border-left: 3px solid #3498db;
}

.state-table tbody tr.current-state td {
    color: #2980b9;
}

.state-table .data-source {
    font-size: 12px;
    color: #95a5a6;
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
}

.warn-calculator {
    background: #fff8e1;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.warn-calculator.active {
    display: block;
}

.warn-calculator h4 {
    color: #d35400;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.warn-calculator .warn-result {
    background: white;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    border-left: 4px solid #ffc107;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;

}

.secondary-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
}

.secondary-btn:hover {
    background: #e8f4fc;
    transform: translateY(-2px);
}

.legal-disclaimer {
    background: linear-gradient(135deg, #f9f9f9, #e9ecef);
    border-radius: 10px;
    padding: 25px;
    margin-top: 40px;
    border-left: 4px solid #95a5a6;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.legal-disclaimer h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.legal-disclaimer ul {
    margin: 15px 0 15px 20px;
    color: #666;
}

.legal-disclaimer li {
    margin-bottom: 8px;
}

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #3498db;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    transition: all 0.3s;
    opacity: 0;
    transform: translateY(20px);
    z-index: 100;
    border: none;
    font-size: 24px;
}

.scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: #2980b9;
    transform: scale(1.1);
}

@media (max-width: 1100px) {
    .container {
        max-width: 100%;
        padding: 20px;
        gap: 20px;
    }
    
    .alert-banner,
    .headerr,
    .legal-disclaimer {
        max-width: 100%;
    }
}

@media (max-width: 992px) {
    .container {
        flex-direction: column;
    }
    
    .calculator-section, .results-section {
        min-width: 100%;
        width: 100%;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        width: 100%;
        overflow-x: hidden;
    }
    
    .page-wrapper {
        padding: 0 5px;
    }
    
    .container {
        padding: 10px;
        margin: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .calculator-section, .results-section {
        padding: 15px;
        width: 100%;
        min-width: unset;
        box-sizing: border-box;
    }
    
    .alert-banner {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 15px;
        box-sizing: border-box;
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        width: 100%;
        box-sizing: border-box;
    }
    
    .state-table {
        font-size: 13px;
    }
    
    .state-table th,
    .state-table td {
        padding: 10px 12px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .result-value {
        font-size: 28px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .page-wrapper {
        padding: 0 2px;
    }
    
    .container {
        padding: 8px;
        gap: 15px;
    }
    
    .calculator-section, .results-section {
        padding: 12px;
        min-width: unset;
    }
    
    .alert-banner {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .state-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .state-table {
        min-width: 600px;
    }
    
    .state-table {
        font-size: 12px;
    }
    
    .state-table th,
    .state-table td {
        padding: 8px 10px;
    }
    
    .radio-group, .checkbox-group-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .radio-option, .checkbox-option {
        min-width: 100%;
    }
    
    .container {
        padding: 4px;
    }
    
    .calculate-btn {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    .legal-disclaimer {
        padding: 15px;
        margin-top: 20px;
    }
    
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 确保所有链接和按钮在移动端可点击区域足够大 */
button, 
a, 
input[type="submit"], 
input[type="button"] {
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    min-width: 44px;
}

/* 防止文本选中时的蓝色背景 */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许输入框和文本区域选中文本 */
input, 
textarea, 
select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}