:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #030303;
    color: #f4f4f4;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% -18%, rgba(255, 255, 255, 0.075), transparent 38rem),
        linear-gradient(180deg, #050505 0%, #020202 100%);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.shell {
    width: min(1170px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 26px;
}

.pagehead,
.panelhead,
.resulttop,
.resultactions {
    display: flex;
    align-items: center;
}

.pagehead,
.panelhead,
.resulttop {
    justify-content: space-between;
}

.pagehead {
    gap: 24px;
    margin-bottom: 46px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(30px, 4vw, 38px);
    line-height: 1;
    letter-spacing: -0.035em;
    background: linear-gradient(180deg, #ffffff, #a7a7a7);
    -webkit-background-clip: text;
    color: transparent;
}

h2 {
    margin: 5px 0 0;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: -0.015em;
}

.pagehead p {
    margin-bottom: 0;
    color: #c1c1c1;
    font-size: 17px;
}

.ready,
.label {
    color: #b8b8b8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ready {
    padding: 8px 11px;
    border: 1px solid #3a3a3a;
    border-radius: 7px;
    background: linear-gradient(180deg, #202020, #111111);
    letter-spacing: 0.02em;
    text-transform: none;
}

.panel {
    border: 1px solid #303030;
    border-radius: 9px;
    background: linear-gradient(145deg, #151515 0%, #0f0f0f 58%, #0b0b0b 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 20px 55px rgba(0, 0, 0, 0.2);
}

.calculator,
.resultpanel,
.toolpanel,
.sessionpanel {
    padding: 24px 34px 30px;
}

.panelhead {
    gap: 18px;
    padding-bottom: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid #333333;
}

.compacthead {
    margin-bottom: 18px;
}

.formgrid {
    display: grid;
    gap: 18px;
}

.primarygrid {
    grid-template-columns: 1fr 1fr 190px;
}

.optiongrid {
    grid-template-columns: 1fr 1fr 1fr 150px;
    margin-top: 18px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #f0f0f0;
    font-size: 14px;
    font-weight: 650;
}

input,
select {
    width: 100%;
    height: 48px;
    border: 1px solid #444444;
    border-radius: 8px;
    outline: none;
    background: #050505;
    color: #f4f4f4;
    padding: 0 16px;
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

input:hover,
select:hover {
    border-color: #5a5a5a;
}

input:focus,
select:focus {
    border-color: #929292;
    background: #080808;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.055);
}

input::placeholder {
    color: #777777;
}

.button {
    min-height: 48px;
    border-radius: 7px;
    padding: 0 20px;
    font-weight: 700;
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.button:active {
    transform: translateY(1px);
}

.primary {
    width: 100%;
    border: 1px solid #777777;
    background: linear-gradient(180deg, #5c5c5c, #454545);
    color: #ffffff;
}

.primary:hover {
    background: linear-gradient(180deg, #696969, #4e4e4e);
}

.secondary {
    border: 1px solid #454545;
    background: linear-gradient(180deg, #242424, #1a1a1a);
    color: #f2f2f2;
}

.secondary:hover {
    border-color: #656565;
    background: linear-gradient(180deg, #2b2b2b, #1d1d1d);
}

.actioncell {
    display: flex;
    align-items: end;
}

.compactactions .button {
    width: 100%;
}

.error {
    margin-top: 18px;
    border: 1px solid #633c3c;
    border-radius: 7px;
    background: #1a0c0c;
    color: #f2c4c4;
    padding: 12px 14px;
    font-size: 13px;
}

.results {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.resulttop {
    gap: 24px;
    align-items: flex-end;
}

.bigage {
    margin: 9px 0 10px;
    font-size: clamp(31px, 5vw, 51px);
    line-height: 1.04;
    font-weight: 780;
    letter-spacing: -0.045em;
    background: linear-gradient(180deg, #ffffff 0%, #b7b7b7 100%);
    -webkit-background-clip: text;
    color: transparent;
}

.muted,
.toolintro,
.stat small {
    color: #979797;
}

.muted {
    margin: 0;
    font-size: 13px;
}

.resultactions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.resultactions .button {
    min-height: 39px;
    padding: 0 13px;
    font-size: 12px;
}

.statgrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #303030;
}

.stat {
    min-height: 105px;
    border: 1px solid #2d2d2d;
    border-radius: 7px;
    background: linear-gradient(180deg, #121212, #0b0b0b);
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat span,
.stat small {
    font-size: 12px;
}

.stat span {
    color: #a8a8a8;
    font-weight: 650;
}

.stat strong {
    margin: 8px 0 3px;
    font-size: 21px;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
}

.stat small {
    min-height: 15px;
}

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

.toolintro {
    margin-bottom: 17px;
    font-size: 13px;
    line-height: 1.55;
}

.bandgrid,
.targetgrid,
.comparegrid {
    display: grid;
    gap: 10px;
}

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

.targetgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 120px;
}

.comparegrid {
    grid-template-columns: 1fr 120px;
}

.bandgrid label,
.targetgrid label {
    font-size: 12px;
}

.inlineResult {
    margin-top: 14px;
    min-height: 42px;
    display: flex;
    align-items: center;
    border: 1px solid #303030;
    border-radius: 7px;
    background: #090909;
    color: #c7c7c7;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 650;
}

.inlineResult.good {
    border-color: #4b5e4b;
    color: #d7ead7;
}

.inlineResult.bad {
    border-color: #674747;
    color: #f0cccc;
}

.details {
    margin: 16px 0 0;
}

.details div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 0;
    border-top: 1px solid #2d2d2d;
}

dt,
dd {
    font-size: 13px;
}

dt {
    color: #989898;
}

dd {
    margin: 0;
    color: #ededed;
    font-weight: 700;
    text-align: right;
}

.tablewrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 12px 10px;
    border-top: 1px solid #2d2d2d;
    text-align: left;
    font-size: 12px;
}

th {
    color: #a2a2a2;
    font-weight: 700;
}

td {
    color: #e7e7e7;
}

.emptyrow td {
    color: #777777;
    text-align: center;
    padding: 24px 10px;
}

footer {
    margin-top: 58px;
    padding: 28px 0 0;
    border-top: 1px solid #2c2c2c;
    color: #777777;
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
}

footer p {
    margin-bottom: 0;
}

.hidden {
    display: none;
}

@media (max-width: 900px) {
    .primarygrid,
    .optiongrid {
        grid-template-columns: 1fr 1fr;
    }

    .primarygrid .actioncell,
    .optiongrid .actioncell {
        grid-column: 1 / -1;
    }

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

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

@media (max-width: 620px) {
    .shell {
        width: min(100% - 20px, 1170px);
        padding-top: 24px;
    }

    .pagehead {
        margin-bottom: 28px;
        align-items: flex-start;
        flex-direction: column;
    }

    .calculator,
    .resultpanel,
    .toolpanel,
    .sessionpanel {
        padding: 20px;
    }

    .panelhead,
    .resulttop {
        align-items: flex-start;
    }

    .resulttop {
        flex-direction: column;
    }

    .resultactions {
        width: 100%;
        justify-content: flex-start;
    }

    .primarygrid,
    .optiongrid,
    .statgrid,
    .bandgrid,
    .targetgrid,
    .comparegrid {
        grid-template-columns: 1fr;
    }

    .primarygrid .actioncell,
    .optiongrid .actioncell {
        grid-column: auto;
    }

    .targetgrid .button,
    .comparegrid .button {
        width: 100%;
    }

    .details div {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    dd {
        text-align: left;
    }
}
