* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group > label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

input[type="number"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

input[type="number"]::placeholder {
    color: #aaa;
    font-size: 14px;
}

.hint {
    margin-top: 6px;
    font-size: 13px;
    color: #888;
    line-height: 1.5;
}

.inline-inputs {
    display: flex;
    gap: 20px;
}

.inline-inputs .input-wrapper {
    flex: 1;
}

.inline-inputs .input-wrapper label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.calculated-result {
    margin-top: 8px;
    padding: 10px 15px;
    background: #f0f7ff;
    border-radius: 6px;
    color: #667eea;
    font-weight: 600;
    display: none;
}

.calculated-result.show {
    display: block;
}

/* 费用+月份选择器布局 */
.fee-with-months {
    display: flex;
    gap: 15px;
    align-items: stretch;
}

.fee-input {
    flex: 2;
    position: relative;
    display: flex;
    align-items: center;
}

.fee-input input {
    flex: 1;
    padding-right: 60px;
}

.fee-input .unit {
    position: absolute;
    right: 12px;
    color: #888;
    font-size: 14px;
    pointer-events: none;
}

.month-select {
    flex: 1;
    min-width: 100px;
}

.month-select select {
    height: 100%;
}

.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.result-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px dashed #e0e0e0;
}

.result-section.hidden {
    display: none;
}

.result-section h2 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 22px;
}

.result-list {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.result-item:last-child {
    border-bottom: none;
}

.item-name {
    color: #555;
    font-size: 15px;
}

.item-value {
    color: #333;
    font-weight: 600;
    font-size: 16px;
}

.total-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.total-name {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}

.total-value {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

/* 平板适配 */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 25px;
        border-radius: 12px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 25px;
    }

    .form-group {
        margin-bottom: 20px;
    }
}

/* 手机端适配 */
@media (max-width: 600px) {
    body {
        padding: 10px;
        background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    }

    .container {
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    }

    h1 {
        font-size: 20px;
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group > label {
        font-size: 15px;
        margin-bottom: 6px;
    }

    input[type="number"],
    select {
        padding: 14px 12px;
        font-size: 16px; /* 防止iOS缩放 */
        border-radius: 6px;
    }

    .hint {
        font-size: 12px;
        line-height: 1.4;
    }

    .inline-inputs {
        flex-direction: column;
        gap: 12px;
    }

    .inline-inputs .input-wrapper label {
        font-size: 13px;
    }

    .fee-with-months {
        flex-direction: column;
        gap: 10px;
    }

    .fee-input .unit {
        font-size: 13px;
    }

    .month-select {
        min-width: auto;
    }

    .calculated-result {
        padding: 8px 12px;
        font-size: 13px;
        line-height: 1.4;
    }

    .submit-btn {
        padding: 14px;
        font-size: 16px;
        border-radius: 6px;
        margin-top: 15px;
    }

    .submit-btn:hover {
        transform: none; /* 移动端禁用hover效果 */
        box-shadow: none;
    }

    .submit-btn:active {
        background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
        transform: scale(0.98);
    }

    .result-section {
        margin-top: 30px;
        padding-top: 25px;
    }

    .result-section h2 {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .result-list {
        padding: 15px;
        border-radius: 8px;
    }

    .result-item {
        padding: 10px 0;
        flex-wrap: wrap;
    }

    .item-name {
        font-size: 14px;
        flex-shrink: 0;
    }

    .item-value {
        font-size: 14px;
        text-align: right;
    }

    .total-result {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 15px 20px;
        border-radius: 8px;
    }

    .total-name {
        font-size: 16px;
    }

    .total-value {
        font-size: 22px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 375px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 18px;
    }

    .form-group > label {
        font-size: 14px;
    }

    input[type="number"],
    select {
        padding: 12px 10px;
    }

    .hint {
        font-size: 11px;
    }

    .item-name,
    .item-value {
        font-size: 13px;
    }

    .total-value {
        font-size: 20px;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px 20px;
    }

    h1 {
        font-size: 18px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .form-group {
        margin-bottom: 12px;
    }
}

/* iOS安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}
