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

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 187, 0, .10), transparent 28rem),
        radial-gradient(circle at 85% 90%, rgba(69, 129, 255, .08), transparent 30rem),
        #090e14;
}

button,
input {
    font: inherit;
}

.page-shell {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 24px;
}

.calculator {
    width: min(100%, 680px);
    padding: clamp(24px, 5vw, 48px);
    border: 1px solid #24313e;
    border-radius: 28px;
    background: rgba(17, 24, 33, .94);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
    backdrop-filter: blur(16px);
}

.hero {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.logo {
    display: grid;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    place-items: center;
    border-radius: 18px;
    background: #3a2d0a;
}

.logo svg {
    width: 30px;
    fill: #ffbb00;
}

.eyebrow {
    margin: 2px 0 6px;
    color: #ffbb00;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}

h1 {
    margin: 0;
    font-size: clamp(26px, 5vw, 38px);
    line-height: 1.1;
    letter-spacing: -.035em;
}

.subtitle {
    max-width: 520px;
    margin: 12px 0 0;
    color: #9dabb9;
    font-size: 15px;
    line-height: 1.6;
}

.formula {
    display: flex;
    margin: 30px 0;
    padding: 16px;
    gap: 11px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    border: 1px solid #283747;
    border-radius: 15px;
    background: #0d141c;
    color: #aab7c4;
    font-size: 14px;
}

.formula strong {
    color: #ffbb00;
    font-size: 18px;
}

.fraction {
    display: inline-grid;
    text-align: center;
}

.fraction span:first-child {
    padding: 0 7px 3px;
    border-bottom: 1px solid #758391;
}

.fraction span:last-child {
    padding-top: 3px;
}

.fields {
    display: grid;
    gap: 19px;
}

label > span {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
}

label small {
    color: #7f8d9b;
    font-size: 12px;
    font-weight: 500;
}

input {
    width: 100%;
    height: 56px;
    padding: 0 16px;
    border: 1px solid #2a3744;
    border-radius: 13px;
    outline: none;
    background: #151c24;
    color: #f1f5f9;
    font-size: 17px;
    transition: border-color .18s, box-shadow .18s, background .18s;
}

input::placeholder {
    color: #61707f;
}

input:focus {
    border-color: #ffbb00;
    background: #19232c;
    box-shadow: 0 0 0 4px rgba(255, 187, 0, .1);
}

.error {
    display: flex;
    margin-top: 16px;
    padding: 12px 14px;
    gap: 10px;
    align-items: center;
    border: 1px solid rgba(255, 140, 140, .28);
    border-radius: 12px;
    background: rgba(255, 140, 140, .08);
    color: #ffaaaa;
    font-size: 14px;
}

.error span {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 140, 140, .15);
    font-weight: 800;
}

.actions {
    display: grid;
    grid-template-columns: 1fr auto;
    margin-top: 25px;
    gap: 10px;
}

button {
    min-height: 54px;
    padding: 0 22px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .15s, background .15s, border-color .15s;
}

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

.primary {
    border: 0;
    background: #ffbb00;
    color: #211700;
}

.primary:hover {
    background: #ffc622;
}

.secondary {
    border: 1px solid #354453;
    background: transparent;
    color: #aab7c4;
}

.secondary:hover {
    border-color: #526273;
    background: #18212a;
}

.download-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    margin-top: 22px;
    padding: 18px;
    gap: 15px;
    align-items: center;
    border: 1px solid #2a4050;
    border-radius: 18px;
    background: linear-gradient(145deg, #131d27, #111922);
}

.android-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 13px;
    background: #3a2d0a;
}

.android-icon svg {
    width: 28px;
    fill: #ffbb00;
}

.download-copy {
    min-width: 0;
}

.download-copy p {
    margin: 0 0 3px;
    color: #ffbb00;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
}

.download-copy strong,
.download-copy span {
    display: block;
}

.download-copy strong {
    color: #edf4f8;
    font-size: 15px;
}

.download-copy span {
    margin-top: 3px;
    color: #8393a2;
    font-size: 12px;
}

.download-button {
    display: inline-flex;
    min-height: 42px;
    padding: 0 17px;
    align-items: center;
    justify-content: center;
    border: 1px solid #ffbb00;
    border-radius: 11px;
    color: #ffbb00;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: background .15s, transform .15s;
}

.download-button:hover {
    background: rgba(255, 187, 0, .08);
}

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

.result-card {
    display: grid;
    grid-template-columns: 1fr auto;
    margin-top: 22px;
    padding: 22px;
    gap: 16px;
    align-items: center;
    border: 1px solid #cc7e00;
    border-radius: 18px;
    background: linear-gradient(145deg, #352900, #291f00);
    animation: reveal .25s ease-out;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(7px);
    }
}

.result-card p {
    margin: 0;
}

.result-card > div > p {
    color: #d7c58c;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.result-card strong {
    display: block;
    margin: 3px 0 1px;
    color: #ffbb00;
    font-size: 48px;
    line-height: 1;
}

.result-card > div > span {
    color: #b9aa7a;
    font-size: 13px;
}

.copy-button {
    min-height: 44px;
    border: 1px solid #ffbb00;
    background: transparent;
    color: #ffbb00;
    font-size: 13px;
}

.copy-button:hover {
    background: rgba(255, 187, 0, .08);
}

.result-help {
    grid-column: 1 / -1;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 187, 0, .18);
    color: #d8cda8;
    font-size: 13px;
    line-height: 1.55;
}

footer {
    max-width: 680px;
    padding-top: 18px;
    color: #647280;
    font-size: 12px;
    text-align: center;
}

.version {
    display: inline-block;
    margin-left: 8px;
    padding-left: 10px;
    border-left: 1px solid #35414d;
    color: #7f8d9b;
}

@media (max-width: 560px) {
    .page-shell {
        justify-content: flex-start;
        padding: 18px 12px;
    }

    .calculator {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .hero {
        gap: 14px;
    }

    .logo {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
        border-radius: 14px;
    }

    .logo svg {
        width: 25px;
    }

    .formula {
        margin: 24px 0;
    }

    .actions,
    .result-card,
    .download-card {
        grid-template-columns: 1fr;
    }

    .android-icon {
        display: none;
    }

    .copy-button {
        width: 100%;
    }

    .download-button {
        width: 100%;
    }

    .version {
        display: block;
        width: fit-content;
        margin: 6px auto 0;
        padding: 0;
        border: 0;
    }
}
