:root {
    --ink: #1c2733;
    --muted: #63748a;
    --line: rgba(28, 39, 51, 0.10);
    --accent: #0f766e;
    --accent-2: #1d4ed8;
    --accent-soft: rgba(15, 118, 110, 0.09);
    --card: rgba(255, 255, 255, 0.88);
    --shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
    --holiday: #c53030;
    --weekend: #2f5fb3;
    --makeup: #a16207;
    --radius: 22px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 6% -4%, rgba(15, 118, 110, 0.20), transparent 34%),
        radial-gradient(circle at 96% 2%, rgba(29, 78, 216, 0.16), transparent 30%),
        linear-gradient(165deg, #f1f5f9 0%, #e7f0ed 55%, #fbfcfe 100%);
    font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 固定背景只在宽屏启用，移动端随内容滚动，避免逐帧重绘 */
@media (min-width: 981px) {
    body {
        background-attachment: fixed;
    }
}

h1,
h2,
h3,
p {
    margin: 0;
}

input,
select,
button {
    font: inherit;
}

.page {
    width: min(1180px, 100% - 32px);
    margin: 0 auto;
    padding: 28px 0 56px;
}

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    padding: 30px 32px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.eyebrow {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 14px 0 8px;
    font-size: clamp(1.9rem, 3.6vw, 2.9rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.subtitle {
    max-width: 58ch;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.75;
}

.fare-link {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 14px;
    border-radius: 18px;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(135deg, #0f766e, #1d4ed8);
    box-shadow: 0 14px 30px rgba(29, 78, 216, 0.24);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.fare-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(29, 78, 216, 0.28);
}

.fare-link-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1rem;
}

.fare-link strong {
    display: block;
    font-size: 0.95rem;
}

.fare-link small {
    display: block;
    font-size: 0.74rem;
    opacity: 0.82;
}

.workspace {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 18px;
}

.panel {
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(10px);
}

.panel-head {
    padding: 22px 22px 0;
}

.panel-head h2 {
    font-size: 1.08rem;
}

.panel-head p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.6;
}

.fields {
    display: grid;
    gap: 16px;
    padding: 18px 22px 24px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.9rem;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.10);
}

.help {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.month-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

#resultBody {
    padding: 18px 20px 22px;
}

.verdict {
    position: relative;
    overflow: hidden;
    padding: 20px 22px;
    border-radius: 20px;
    color: #fff;
}

.verdict::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.11);
    pointer-events: none;
}

.verdict.is-pass {
    background: linear-gradient(135deg, #0b5e57, #0f766e 45%, #14b8a6);
}

.verdict.is-direct {
    background: linear-gradient(135deg, #172554, #1d4ed8 55%, #3b82f6);
}

.verdict-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.8;
}

.verdict-title {
    margin-top: 6px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.verdict p {
    position: relative;
    z-index: 1;
    margin-top: 8px;
    font-size: 0.94rem;
    opacity: 0.95;
}

.verdict strong {
    font-size: 1.06rem;
}

.totals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.total-card {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
}

.total-card.is-active {
    border-color: rgba(15, 118, 110, 0.45);
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.09), rgba(255, 255, 255, 0.9));
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.10);
}

.total-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.total-value {
    margin-top: 4px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.total-sub {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.76rem;
}

.breakdowns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.detail-card {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
}

.detail-card.is-best {
    border-color: rgba(15, 118, 110, 0.35);
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0.88));
}

.detail-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 800;
}

.detail-title span:last-child {
    color: var(--accent);
    font-size: 1.02rem;
    font-variant-numeric: tabular-nums;
}

.detail-list {
    display: grid;
    gap: 8px;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(28, 39, 51, 0.03);
    font-size: 0.84rem;
}

.detail-label {
    min-width: 0;
}

.detail-label strong {
    display: block;
    font-weight: 600;
}

.detail-label small {
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.45;
}

.detail-value {
    flex: none;
    font-variant-numeric: tabular-nums;
}

.detail-row.is-discount .detail-value {
    color: #b45309;
}

.detail-row.is-total {
    align-items: center;
    background: rgba(15, 118, 110, 0.10);
    font-weight: 800;
}

.detail-row.is-total .detail-label strong {
    font-weight: 800;
}

.detail-row.is-total .detail-value {
    color: var(--accent);
    font-size: 1rem;
}

.table-block {
    margin-top: 16px;
}

.table-title {
    margin-bottom: 8px;
    font-size: 0.92rem;
    font-weight: 800;
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.8);
    -webkit-overflow-scrolling: touch;
}

.pass-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.pass-table th {
    padding: 10px 12px;
    background: rgba(28, 39, 51, 0.03);
    color: var(--muted);
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.pass-table th:first-child,
.pass-table td:first-child {
    text-align: left;
}

.pass-table td {
    padding: 10px 12px;
    border-top: 1px solid rgba(28, 39, 51, 0.06);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pass-table tr.is-best td {
    background: rgba(15, 118, 110, 0.07);
}

.pass-table tr.is-best td:first-child {
    font-weight: 700;
}

.tag-best {
    margin-left: 5px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.66rem;
    font-style: normal;
    font-weight: 600;
}

.note {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.07);
    color: #14524b;
    font-size: 0.8rem;
    line-height: 1.7;
}

.empty-state {
    padding: 32px 12px;
    color: var(--muted);
    font-size: 0.92rem;
    text-align: center;
    line-height: 1.8;
}

.calendar-panel {
    margin-top: 18px;
}

.calendar-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.76rem;
    color: var(--muted);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.swatch {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    border: 1px solid rgba(28, 39, 51, 0.12);
    background: #fff;
}

.swatch.is-weekend {
    background: #e8effc;
    border-color: #cddbf5;
}

.swatch.is-holiday {
    background: #fde8e8;
    border-color: #f4c7c7;
}

.swatch.is-makeup {
    background: #fdf3df;
    border-color: #efd6a6;
}

.calendar-wrap {
    padding: 16px 20px 22px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.cal-weekday {
    padding: 4px 0 8px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    text-align: center;
}

.cal-weekday.is-weekend {
    color: var(--weekend);
}

.cal-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 74px;
    padding: 6px 7px;
    border: 1px solid rgba(28, 39, 51, 0.07);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
}

.cal-cell.is-empty {
    border-color: transparent;
    background: transparent;
}

.cal-cell.is-weekend {
    background: #e8effc;
    border-color: #cddbf5;
}

.cal-cell.is-holiday {
    background: #fde8e8;
    border-color: #f4c7c7;
}

.cal-cell.is-makeup {
    background: #fdf3df;
    border-color: #efd6a6;
}

.cal-cell.is-today {
    box-shadow: 0 0 0 2px var(--accent);
}

.cal-cell-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.cal-num {
    font-size: 0.86rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.is-weekend .cal-num {
    color: var(--weekend);
}

.is-holiday .cal-num {
    color: var(--holiday);
}

.is-makeup .cal-num {
    color: var(--makeup);
}

.is-today .cal-num {
    color: var(--accent);
}

.cal-badge {
    padding: 2px 4px;
    border-radius: 5px;
    background: var(--holiday);
    color: #fff;
    font-size: 0.62rem;
    line-height: 1;
}

.is-makeup .cal-badge {
    background: var(--makeup);
}

.cal-name {
    overflow: hidden;
    color: var(--holiday);
    font-size: 0.66rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.is-makeup .cal-name {
    color: var(--makeup);
}

.notice {
    margin: 0 20px 22px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.08);
    color: #14524b;
    font-size: 0.84rem;
    line-height: 1.6;
}

.notice.is-warn {
    background: #fdf3df;
    color: #8a5a06;
}

@media (max-width: 980px) {
    /* 移动端以滚动帧率为先：去掉固定背景、实时模糊与大范围阴影 */
    body {
        background: linear-gradient(165deg, #f1f5f9 0%, #e7f0ed 55%, #fbfcfe 100%);
        background-attachment: scroll;
    }

    .hero,
    .panel {
        background: rgba(255, 255, 255, 0.97);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    }

    .workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .breakdowns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .page {
        width: calc(100% - 20px);
        padding: 14px 0 40px;
    }

    .hero {
        flex-direction: column;
        align-items: stretch;
        padding: 22px;
        border-radius: 22px;
    }

    .fare-link {
        justify-content: center;
    }

    .totals {
        grid-template-columns: 1fr;
    }

    .panel-head {
        padding: 18px 16px 0;
    }

    .fields {
        padding: 14px 16px 20px;
    }

    #resultBody {
        padding: 14px 14px 18px;
    }

    .calendar-head {
        padding: 18px 16px 0;
    }

    .calendar-wrap {
        padding: 12px 10px 16px;
    }

    .calendar-grid {
        gap: 4px;
    }

    .cal-weekday {
        font-size: 0.7rem;
        padding-bottom: 6px;
    }

    .cal-cell {
        min-height: 58px;
        padding: 4px 5px;
        border-radius: 9px;
    }

    .cal-num {
        font-size: 0.78rem;
    }

    .cal-name {
        font-size: 0.58rem;
    }

    .cal-badge {
        font-size: 0.56rem;
        padding: 1px 3px;
    }

    .notice {
        margin: 0 14px 16px;
    }

    .verdict {
        padding: 18px;
    }

    .verdict-title {
        font-size: 1.3rem;
    }
}
