:root {
    --bg: #f6f4ee;
    --surface: #ffffff;
    --ink: #15140f;
    --ink-soft: #5c5748;
    --line: #e6e1d3;
    --dark: #131210;
    --dark-soft: #c9c4b6;
    --accent: #f4c60c;
    --accent-ink: #131210;
    --navy: #1c2a3a;
    font-family: "Inter","Segoe UI",Arial,sans-serif;
    color: var(--ink);
    background: var(--bg)
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

.shell {
    min-height: 100vh
}

header {
    height: 76px;
    background: var(--dark);
    color: #fff;
    padding: 0 5%;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.brand {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -.02em
}

.sub {
    opacity: .7;
    font-size: .9rem
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 20px 60px
}

.hero {
    margin-bottom: 26px
}

    .hero h1 {
        font-size: 2.6rem;
        margin: .2rem 0;
        font-weight: 800;
        letter-spacing: -.03em
    }

    .hero p, .hint {
        color: var(--ink-soft);
        line-height: 1.55
    }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 10px 28px #1312100a
}

.grid.two {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 18px
}

.grid.three {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 18px
}

.grid.four {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 18px
}

label {
    font-weight: 650;
    display: flex;
    flex-direction: column;
    gap: 7px
}

input, select, textarea {
    border: 1px solid #d8d3c3;
    border-radius: 9px;
    padding: 10px;
    font-size: 1rem;
    background: #fff;
    color: var(--ink);
    font-family: inherit
}

textarea {
    resize: vertical;
    min-height: 84px
}

.row {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr 1fr auto;
    gap: 8px;
    margin: 10px 0
}

.button, button {
    border: 0;
    border-radius: 9px;
    padding: 11px 18px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 750;
    cursor: pointer
}

    button.secondary {
        background: #efece2;
        color: var(--ink)
    }

    button.danger {
        background: #fbe8e2;
        color: #8a2f18
    }

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px
}

.option {
    margin-top: 18px;
    display: flex;
    gap: 8px;
    align-items: center
}

    .option label {
        display: block
    }

.summary {
    display: grid;
    grid-template-columns: repeat(5,1fr);
    gap: 10px;
    margin-bottom: 20px
}

    .summary div {
        background: #f1eee3;
        border-radius: 12px;
        padding: 13px
    }

    .summary span {
        display: block;
        margin-top: 4px;
        color: var(--ink-soft)
    }

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: .88rem;
    white-space: nowrap
}

th, td {
    padding: 9px 11px;
    border-bottom: 1px solid #efece0;
    text-align: right
}

    th:first-child, td:first-child {
        text-align: left;
        position: sticky;
        left: 0;
        background: #fff
    }

thead th {
    background: #f1eee3;
    font-weight: 800
}

.notes {
    margin-top: 18px;
    background: #f1eee3;
    border-radius: 12px;
    padding: 14px;
    color: var(--ink-soft);
    line-height: 1.5
}

@media(max-width:800px) {
    .grid.two, .grid.three, .grid.four, .summary {
        grid-template-columns: 1fr
    }

    .row {
        grid-template-columns: 1fr
    }

    .hero h1 {
        font-size: 1.9rem
    }
}

.results-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px
}

/* Nav header */
header .brand {
    color: #fff;
    text-decoration: none
}

.site-nav {
    display: flex;
    gap: 22px
}

    .site-nav a {
        color: var(--dark-soft);
        text-decoration: none;
        font-weight: 600;
        font-size: .95rem
    }

        .site-nav a:hover {
            color: var(--accent)
        }

        .site-nav a.active {
            color: var(--accent)
        }

/* Footer */
.site-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: space-between;
    align-items: center;
    color: var(--ink-soft);
    font-size: .85rem;
    border-top: 1px solid var(--line)
}

    .site-footer nav {
        display: flex;
        gap: 16px
    }

    .site-footer a {
        color: var(--ink-soft)
    }

/* Article pages (Guide / Privacy) */
.article h2 {
    margin-top: 1.6em;
    font-weight: 800;
    letter-spacing: -.02em
}

    .article h2:first-child {
        margin-top: 0
    }

.article p, .article li {
    color: var(--ink-soft);
    line-height: 1.65
}

.article ul {
    padding-left: 1.2em
}

a.button {
    display: inline-block;
    text-decoration: none
}

/* Ad slots */
.ad-slot {
    margin: 26px 0;
    padding: 10px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    text-align: center;
    min-height: 60px
}

    .ad-slot::before {
        content: attr(data-label);
        display: block;
        font-size: .7rem;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: #a49f8e;
        margin-bottom: 6px
    }

/* Cookie / consent banner */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--dark);
    color: #f6f4ee;
    padding: 16px 5%;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -6px 24px #0000002e
}

    .cookie-banner p {
        margin: 0;
        max-width: 640px;
        font-size: .9rem;
        line-height: 1.5;
        color: var(--dark-soft)
    }

    .cookie-banner a {
        color: var(--accent)
    }

.cookie-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0
}

@media(max-width:800px) {
    .site-nav {
        gap: 14px
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start
    }
}

/* WASM boot / error UI */
.wasm-loading {
    padding: 60px 20px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 1.1rem
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 12px 20px;
    text-align: center;
    box-shadow: 0 -4px 16px #00000022
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        float: right;
        padding: 0 6px
    }

    #blazor-error-ui .reload {
        color: var(--accent-ink);
        text-decoration: underline;
        margin-left: 8px
    }

/* Calculator tab switcher */
.calc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0
}

.calc-tab {
    background: #efece2;
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: .92rem;
    border: 1px solid transparent
}

    .calc-tab.active {
        background: var(--navy);
        color: #fff
    }

    .calc-tab:hover:not(.active) {
        border-color: var(--line)
    }

/* Calculator result panels */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(190px,1fr));
    gap: 12px;
    margin-top: 6px
}

.result-item {
    background: #f1eee3;
    border-radius: 12px;
    padding: 16px
}

    .result-item b {
        display: block;
        font-size: 1.3rem;
        letter-spacing: -.01em
    }

    .result-item span {
        display: block;
        margin-top: 4px;
        color: var(--ink-soft);
        font-size: .85rem
    }

.result-highlight {
    background: var(--navy);
    color: #fff;
    border-radius: 14px;
    padding: 20px;
    margin: 18px 0
}

    .result-highlight b {
        display: block;
        font-size: 1.7rem;
        letter-spacing: -.02em
    }

    .result-highlight span {
        display: block;
        margin-top: 6px;
        color: var(--dark-soft);
        font-size: .9rem
    }

.field-note {
    color: var(--ink-soft);
    font-size: .82rem;
    margin-top: -8px;
    margin-bottom: 14px
}

.swap-note {
    background: #fdf3d9;
    border: 1px solid #f0dd9c;
    color: #7a5b06;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: .9rem
}

textarea::placeholder, input::placeholder {
    color: lightgray
}