:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary: #667eea;
    --secondary: #764ba2;
    --success: #48bb78;
    --warning: #ed8936;
    --text: #2d3748;
    --text2: #718096;
    --text3: #a0aec0;
    --bg: #f7fafc;
    --white: #fff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 12px
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px
}

.header {
    text-align: center;
    padding: 30px 0;
    color: #fff
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px
}

.logo-icon {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2))
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2)
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 5px
}

.calc-card {
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    margin-bottom: 30px
}

.mode-switcher {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: var(--bg);
    padding: 6px;
    border-radius: 16px
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    transition: all .3s
}

.mode-btn:hover {
    color: var(--text)
}

.mode-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow)
}

.mode-icon {
    font-size: 1.2rem
}

.calc-form {
    display: flex;
    flex-direction: column;
    gap: 20px
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.form-group label {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text2);
    display: flex;
    align-items: center;
    gap: 6px
}

.label-unit {
    font-size: .8rem;
    color: var(--text3)
}

.main-input .input-wrapper {
    position: relative;
    display: flex;
    align-items: center
}

.input-prefix {
    position: absolute;
    left: 16px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary)
}

.main-input input {
    width: 100%;
    padding: 18px 18px 18px 50px;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all .3s
}

.main-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15)
}

.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    background: var(--bg);
    cursor: pointer;
    transition: all .3s
}

.section-header:hover {
    background: #edf2f7
}

.section-header h3 {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text)
}

.toggle-icon {
    font-size: .8rem;
    color: var(--text3);
    transition: all .3s
}

.section-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top: 1px solid var(--border)
}

.section-content.collapsed {
    display: none
}

.form-row {
    display: grid;
    gap: 15px
}

.form-row.four-col {
    grid-template-columns: repeat(4, 1fr)
}

.form-row.three-col {
    grid-template-columns: repeat(3, 1fr)
}

input[type="number"],
select {
    width: 100%;
    padding: 10px 14px;
    font-size: .95rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all .3s;
    background: var(--white)
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1)
}

.hint {
    font-size: .75rem;
    color: var(--text3)
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--text3);
    color: #fff;
    border-radius: 50%;
    font-size: .7rem;
    cursor: help;
    position: relative
}

.tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--text);
    color: #fff;
    font-size: .75rem;
    font-weight: 400;
    border-radius: 8px;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 5px
}

.calc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s;
    box-shadow: var(--shadow)
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15)
}

.calc-btn:active {
    transform: translateY(0)
}

.btn-icon {
    font-size: 1.3rem
}

.results {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px dashed var(--border);
    animation: fadeIn .5s ease
}

.results.hidden {
    display: none
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.results-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text)
}

.result-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px
}

.result-card {
    background: var(--bg);
    padding: 18px;
    border-radius: var(--radius);
    text-align: center
}

.result-card.highlight {
    background: var(--primary-gradient);
    color: #fff
}

.result-label {
    display: block;
    font-size: .85rem;
    margin-bottom: 6px;
    opacity: .8
}

.result-value {
    font-size: 1.4rem;
    font-weight: 700
}

.result-value.deduction {
    color: var(--warning)
}

.result-card.highlight .result-value {
    color: #fff
}

.breakdown {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 18px
}

.breakdown h4 {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text)
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse
}

.breakdown-table tr {
    border-bottom: 1px solid var(--border)
}

.breakdown-table tr:last-child {
    border-bottom: none
}

.breakdown-table td {
    padding: 10px 0;
    font-size: .9rem
}

.breakdown-table td:first-child {
    color: var(--text2)
}

.breakdown-table td:last-child {
    text-align: right;
    font-weight: 500
}

.breakdown-table tr.highlight-row td {
    font-weight: 600;
    color: var(--primary)
}

.ad-section {
    margin: 25px 0;
    min-height: 100px
}

.formula-section,
.examples-section,
.faq-section {
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 30px;
    margin-bottom: 25px
}

.formula-section h2,
.examples-section h2,
.faq-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text)
}

.formula-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px
}

.formula-card:last-child {
    margin-bottom: 0
}

.formula-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text)
}

.formula-box {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.formula {
    font-family: "SF Mono", Monaco, monospace;
    font-size: .9rem;
    padding: 12px 15px;
    background: var(--white);
    border-radius: 8px;
    border-left: 3px solid var(--primary)
}

.formula.highlight-formula {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left-color: var(--success);
    font-weight: 600
}

.table-wrapper {
    overflow-x: auto
}

.tax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem
}

.tax-table th,
.tax-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border)
}

.tax-table th {
    background: var(--white);
    font-weight: 600;
    color: var(--text)
}

.tax-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05)
}

.rate {
    display: inline-block;
    padding: 3px 10px;
    background: var(--primary-gradient);
    color: #fff;
    border-radius: 20px;
    font-weight: 600;
    font-size: .8rem
}

.insurance-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px
}

.insurance-item {
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    text-align: center
}

.insurance-name {
    display: block;
    font-size: .8rem;
    color: var(--text2);
    margin-bottom: 5px
}

.insurance-rate {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary)
}

.note {
    font-size: .8rem;
    color: var(--text3);
    font-style: italic
}

.example-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px
}

.example-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary)
}

.example-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px
}

.example-conditions h4,
.example-calc h4 {
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text)
}

.example-conditions ul,
.example-calc ol {
    padding-left: 20px;
    font-size: .9rem;
    color: var(--text2)
}

.example-conditions li,
.example-calc li {
    margin-bottom: 6px
}

.example-calc strong {
    color: var(--primary)
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    background: var(--bg);
    cursor: pointer;
    font-weight: 500;
    transition: all .3s
}

.faq-question:hover {
    background: #edf2f7
}

.faq-toggle {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 400;
    transition: all .3s
}

.faq-answer {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: all .3s
}

.faq-answer.open {
    padding: 15px 18px;
    max-height: 500px
}

.faq-answer p {
    font-size: .9rem;
    color: var(--text2);
    margin-bottom: 10px
}

.faq-answer ul {
    padding-left: 20px;
    font-size: .85rem;
    color: var(--text2)
}

.faq-answer li {
    margin-bottom: 5px
}

.footer {
    text-align: center;
    padding: 25px 0;
    color: #fff
}

.disclaimer {
    font-size: .8rem;
    opacity: .8;
    margin-bottom: 10px;
    line-height: 1.5
}

.copyright {
    font-size: .85rem;
    opacity: .9
}

.related-tools {
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 30px;
    margin-bottom: 25px
}

.related-tools h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text)
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px
}

.tool-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: var(--bg);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: all .3s;
    border: 1px solid transparent
}

.tool-link:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: var(--primary);
    transform: translateY(-2px)
}

.tool-icon {
    font-size: 1.5rem;
    margin-bottom: 8px
}

.tool-name {
    font-size: .8rem;
    text-align: center;
    line-height: 1.3;
    font-weight: 500
}

@media(max-width:768px) {
    .container {
        padding: 15px
    }

    .header h1 {
        font-size: 1.6rem
    }

    .calc-card {
        padding: 20px
    }

    .mode-switcher {
        flex-direction: column
    }

    .form-row.four-col,
    .form-row.three-col {
        grid-template-columns: repeat(2, 1fr)
    }

    .result-cards {
        grid-template-columns: 1fr
    }

    .insurance-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .example-content {
        grid-template-columns: 1fr
    }

    .tax-table {
        font-size: .75rem
    }

    .tax-table th,
    .tax-table td {
        padding: 8px 5px
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:480px) {

    .form-row.four-col,
    .form-row.three-col {
        grid-template-columns: 1fr
    }

    .main-input input {
        font-size: 1.3rem;
        padding: 15px 15px 15px 45px
    }

    .input-prefix {
        font-size: 1.3rem
    }
}

@media print {
    body {
        background: #fff
    }

    .mode-switcher,
    .calc-btn,
    .ad-section,
    .faq-section {
        display: none
    }

    .calc-card,
    .formula-section,
    .examples-section {
        box-shadow: none;
        break-inside: avoid
    }
}