:root {
    --bg: #f3ede2;
    --bg-deep: #d8c3a4;
    --surface: rgba(255, 252, 246, 0.88);
    --surface-strong: #fffaf0;
    --text: #1f1a14;
    --muted: #6d6255;
    --line: rgba(52, 37, 20, 0.12);
    --accent: #0f766e;
    --accent-strong: #0b5d57;
    --warm: #c26b2f;
    --shadow: 0 18px 46px rgba(59, 41, 19, 0.12);
    --radius-xl: 24px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --font-display: "Segoe UI", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-body: "Segoe UI", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-number: "Segoe UI", "DIN Alternate", "Arial", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-variant-numeric: tabular-nums;
    color: var(--text);
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 30%),
        radial-gradient(circle at right center, rgba(194, 107, 47, 0.16), transparent 26%),
        linear-gradient(135deg, var(--bg) 0%, #efe5d4 48%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 14px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 28px;
    pointer-events: none;
}

.page-shell {
    width: min(1280px, calc(100% - 24px));
    margin: 0 auto;
    padding: 14px 0 28px;
}

.hero,
.workspace {
    animation: rise-in 0.6s ease both;
}

.hero {
    margin-bottom: 12px;
}

.hero-copy,
.card {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.hero-copy {
    position: relative;
    overflow: hidden;
    padding: 18px 22px 16px;
    border-radius: 16px;
}

.hero-copy::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 12px;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 180, 106, 0.22), transparent 64%);
    pointer-events: none;
}

.hero-top {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    filter: drop-shadow(0 10px 18px rgba(15, 118, 110, 0.18));
    animation: mark-float 4.2s ease-in-out infinite;
}

.feature-menu {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding: 4px;
    border-radius: 14px;
    background: rgba(31, 26, 20, 0.05);
    width: fit-content;
}

.menu-btn {
    min-width: 0;
    min-height: 38px;
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    box-shadow: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.menu-btn.is-active {
    background: rgba(255, 252, 246, 0.9);
    color: var(--accent-strong);
    box-shadow: 0 8px 20px rgba(59, 41, 19, 0.08);
}

.menu-btn:hover {
    background: rgba(255, 252, 246, 0.72);
}


.eyebrow {
    margin: 0 0 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.74rem;
    color: var(--accent);
    font-weight: 700;
}

h1,
h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.05;
}

.hero-text,
.status-text,
.summary-box p,
.metric-label {
    color: var(--muted);
}

.hero-text {
    margin: 12px 0 0;
    max-width: 72ch;
    line-height: 1.5;
    font-size: 0.94rem;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 14px;
}

.app-view[hidden] {
    display: none;
}

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

.card {
    padding: 18px;
    border-radius: 14px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover {
    border-color: rgba(15, 118, 110, 0.18);
    box-shadow: 0 20px 48px rgba(59, 41, 19, 0.15);
    transform: translateY(-1px);
}

.input-card {
    position: relative;
    z-index: 3;
    align-self: start;
}

.result-card {
    position: relative;
    z-index: 1;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.table-card {
    grid-column: 1 / -1;
}

.card-head {
    margin-bottom: 12px;
}

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

.calc-form {
    display: grid;
    gap: 12px;
}

.mode-switch {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
    background: rgba(31, 26, 20, 0.06);
}

.material-switch {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 2px;
}

.mode-btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    box-shadow: none;
}

.mode-btn.is-active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #f5f7f4;
    box-shadow: 0 12px 28px rgba(15, 118, 110, 0.16);
}

.field {
    display: grid;
    gap: 7px;
}

.field span {
    font-weight: 700;
    font-size: 0.94rem;
}

input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid rgba(31, 26, 20, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
    transform: translateY(-1px);
}

input.is-invalid {
    border-color: rgba(180, 35, 24, 0.62);
    background: rgba(255, 247, 246, 0.94);
    box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.1);
}

.custom-select {
    position: relative;
    z-index: 20;
}

.select-trigger {
    position: relative;
    width: 100%;
    padding: 11px 42px 11px 13px;
    border: 1px solid rgba(31, 26, 20, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.84);
    color: var(--text);
    text-align: left;
    box-shadow: none;
}

.select-trigger::after {
    content: "";
    position: absolute;
    right: 17px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--accent-strong);
    border-bottom: 2px solid var(--accent-strong);
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.2s ease;
}

.select-trigger.is-open {
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.select-trigger.is-open::after {
    transform: translateY(-35%) rotate(225deg);
}

.select-menu {
    position: absolute;
    z-index: 50;
    inset: calc(100% + 8px) 0 auto;
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(31, 26, 20, 0.12);
    border-radius: 14px;
    background: rgba(255, 252, 246, 0.98);
    box-shadow: 0 18px 34px rgba(59, 41, 19, 0.16);
}

.select-menu[hidden] {
    display: none;
}

.select-option {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
    box-shadow: none;
}

.select-option:hover,
.select-option.is-selected {
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent-strong);
}

.actions {
    display: grid;
    margin-top: 2px;
}

button {
    border: 0;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
}

.primary-btn {
    min-height: 44px;
    color: #f5f7f4;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
}

.ghost-btn {
    color: var(--text);
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(31, 26, 20, 0.1);
}

.status-text {
    position: relative;
    margin: 12px 0 0;
    min-height: 40px;
    padding: 10px 12px 10px 38px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 12px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--accent-strong);
    font-size: 0.88rem;
    line-height: 1.45;
    font-weight: 700;
}

.status-text::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 13px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
}

.status-text.is-empty {
    display: none;
}

.status-text--error {
    border-color: rgba(180, 35, 24, 0.26);
    background: rgba(255, 247, 246, 0.94);
    color: #912018;
}

.status-text--error::before {
    background: #b42318;
}

.status-text--success {
    border-color: rgba(12, 116, 63, 0.22);
    background: rgba(236, 253, 243, 0.9);
    color: #067647;
}

.status-text--success::before {
    background: #12b76a;
}

.result-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.2fr 1.35fr 1.15fr;
    gap: 12px;
    margin-bottom: 14px;
}

.metric {
    min-height: 98px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(31, 26, 20, 0.08);
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(1.16rem, 1.5vw, 1.55rem);
    font-family: var(--font-number);
    line-height: 1.08;
    letter-spacing: 0;
}

.metric.accent strong,
.metric.warm strong {
    font-size: clamp(1.6rem, 2.5vw, 2.45rem);
}

.metric.accent {
    background: rgba(15, 118, 110, 0.1);
}

.metric.warm {
    background: rgba(194, 107, 47, 0.12);
}

.summary-box {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--surface-strong);
    border: 1px dashed rgba(31, 26, 20, 0.12);
    line-height: 1.6;
}

#calculator-view .result-card .summary-box {
    flex: 1;
    display: flex;
    align-items: center;
}

.summary-box p {
    margin: 0;
}

.answer-result-box {
    flex: 1;
    padding: 0;
    border: 0;
    background: transparent;
}

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

.answer-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(31, 26, 20, 0.08);
}

.answer-item span {
    color: var(--muted);
    line-height: 1.5;
}

.answer-item strong {
    color: var(--accent-strong);
    font-size: 1.22rem;
    white-space: nowrap;
}

.table-wrap {
    overflow: auto;
    border-radius: var(--radius-md);
    border: 1px solid rgba(31, 26, 20, 0.08);
    background: rgba(255, 252, 246, 0.8);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-variant-numeric: tabular-nums;
}

th,
td {
    padding: 11px 12px;
    text-align: right;
    white-space: nowrap;
}

th:first-child,
td:first-child {
    width: 9%;
    text-align: left;
}

th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3) {
    width: 13%;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
    width: 17%;
}

th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7) {
    width: 14%;
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

td {
    border-top: 1px solid rgba(31, 26, 20, 0.06);
    color: var(--text);
    font-size: 0.92rem;
}

thead {
    background: rgba(31, 26, 20, 0.045);
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.52);
}

tbody tr:hover {
    background: rgba(15, 118, 110, 0.07);
}

.empty-row {
    text-align: center;
    color: var(--muted);
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mark-float {
    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-3px) rotate(2deg);
    }
}

@media (max-width: 1120px) {
    .result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .hero-top {
        display: grid;
    }

    .feature-menu {
        width: 100%;
    }

    .menu-btn {
        flex: 1 1 0;
    }

    .hero-copy,
    .card {
        padding: 22px;
    }
}

@media (max-width: 560px) {
    body::before {
        display: none;
    }

    .page-shell {
        width: calc(100% - 16px);
        padding: 8px 0 18px;
    }

    .hero {
        margin-bottom: 8px;
    }

    .hero-copy,
    .card {
        padding: 14px;
        border-radius: 12px;
        box-shadow: 0 12px 30px rgba(59, 41, 19, 0.1);
    }

    .hero-top {
        gap: 12px;
    }

    h1 {
        font-size: 1.58rem;
        line-height: 1.12;
    }

    .brand-lockup {
        gap: 10px;
    }

    .brand-mark {
        width: 44px;
        height: 44px;
    }

    .hero-text {
        font-size: 0.88rem;
        line-height: 1.55;
    }

    .mode-switch {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        padding: 4px;
        border-radius: 12px;
    }

    .feature-menu {
        padding: 8px;
    }

    .menu-btn,
    .mode-btn {
        min-width: 0;
        border-radius: 10px;
        font-size: 0.86rem;
    }

    .menu-btn {
        padding: 9px 10px;
    }

    .mode-btn {
        padding: 9px 8px;
        white-space: nowrap;
    }

    .workspace {
        gap: 8px;
    }

    .calc-form {
        gap: 9px;
    }

    input,
    .select-trigger {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
        font-size: 16px;
    }

    .actions button {
        width: 100%;
        min-height: 42px;
    }

    .status-text {
        min-height: 38px;
        margin-top: 10px;
        padding: 9px 11px 9px 36px;
        font-size: 0.84rem;
    }

    .status-text::before {
        left: 12px;
        top: 12px;
    }

    .result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 8px;
    }

    .metric {
        min-height: 78px;
        padding: 11px 12px;
        border-radius: 10px;
    }

    .metric strong,
    .metric.accent strong,
    .metric.warm strong {
        margin-top: 6px;
        font-size: 1.24rem;
        line-height: 1.12;
        word-break: break-word;
    }

    .metric-label {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    #calculator-view .result-card .summary-box {
        display: block;
    }

    .summary-box {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .table-card {
        padding-left: 0;
        padding-right: 0;
        overflow: hidden;
    }

    .table-card .card-head {
        padding: 0 14px;
    }

    .table-wrap {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    table {
        min-width: 680px;
    }

    th,
    td {
        padding: 9px 10px;
        font-size: 0.84rem;
    }

    .answer-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

@media (max-width: 380px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}
