:root {
    --sky: #e8f4ff;
    --ink: #18222d;
    --white: #fffdf8;
    --blue: #58a6ff;
    --purple: #a682ff;
    --pink: #ff83b6;
    --yellow: #ffd95c;
    --mint: #8de5bf;
    --orange: #ffad5b;
    --red: #ff7070;
    --shadow: 8px 8px 0 var(--ink);
    --shadow-sm: 4px 4px 0 var(--ink);
    --radius: 26px;
    --sans:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
}
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--sky);
    overflow-x: hidden;
}
button,
input,
select {
    font: inherit;
    color: inherit;
}
button {
    cursor: pointer;
}
.blob {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    border: 2px solid var(--ink);
}
.blob.a {
    width: 260px;
    height: 180px;
    border-radius: 58% 42% 65% 35%/48% 55% 45% 52%;
    background: var(--yellow);
    right: -80px;
    top: 60px;
    transform: rotate(12deg);
}
.blob.b {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: var(--pink);
    left: -80px;
    bottom: -60px;
}
.blob.c {
    width: 120px;
    height: 120px;
    border-radius: 30px;
    background: var(--mint);
    left: 5vw;
    top: 30vh;
    transform: rotate(22deg);
}
.grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.25;
    background-image:
        linear-gradient(rgba(24, 34, 45, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 34, 45, 0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, black, transparent 82%);
}
.shell {
    position: relative;
    z-index: 2;
    width: min(1280px, calc(100% - 32px));
    margin: auto;
    padding: 24px 0 50px;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 28px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 950;
    letter-spacing: -0.03em;
}
.mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 2px solid var(--ink);
    border-radius: 18px;
    background: var(--purple);
    color: white;
    box-shadow: var(--shadow-sm);
    transform: rotate(-6deg);
    font-size: 23px;
}
.brand small {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 2px;
}
.pill {
    padding: 10px 14px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--white);
    box-shadow: 3px 3px 0 var(--ink);
    font: 700 10px var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.hero {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 34px;
}
.hero h1 {
    margin: 0;
    font-size: clamp(62px, 9vw, 132px);
    line-height: 0.82;
    letter-spacing: -0.075em;
    font-weight: 950;
}
.hero h1 span {
    display: inline-block;
}
.formula-word {
    background: var(--blue);
    border: 2px solid var(--ink);
    border-radius: 0.18em;
    padding: 0.04em 0.13em 0.08em;
    box-shadow: 7px 7px 0 var(--ink);
    transform: rotate(-1.5deg);
}
.hero-copy {
    max-width: 520px;
    justify-self: end;
}
.hero-copy p {
    font-size: clamp(17px, 1.6vw, 21px);
    line-height: 1.48;
    margin: 0 0 16px;
    font-weight: 650;
}
.stickers {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}
.sticker {
    padding: 8px 11px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--mint);
    box-shadow: 3px 3px 0 var(--ink);
    font: 700 10px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transform: rotate(-2deg);
}
.sticker:nth-child(2) {
    background: var(--yellow);
    transform: rotate(2deg);
}
.sticker:nth-child(3) {
    background: var(--pink);
    transform: rotate(-1deg);
}
.workspace {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 24px;
    align-items: start;
}
.card {
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 2px solid var(--ink);
    background: var(--yellow);
}
.result-card .card-head {
    background: var(--mint);
}
.card-head strong {
    font-size: 16px;
}
.card-head span {
    font: 700 10px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.controls {
    padding: 24px;
}
.section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 28px 0 14px;
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.section-label:first-child {
    margin-top: 0;
}
.section-label::after {
    content: "";
    height: 2px;
    background: var(--ink);
    flex: 1;
    opacity: 0.2;
}
.field {
    margin-bottom: 18px;
}
.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    font-weight: 850;
    margin-bottom: 8px;
}
.meta {
    font: 700 10px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.req {
    color: #d43838;
}
input,
select {
    width: 100%;
    height: 52px;
    border: 2px solid var(--ink);
    border-radius: 16px;
    padding: 0 14px;
    background: #fff;
    outline: none;
    transition: 0.18s ease;
}
input:focus,
select:focus {
    box-shadow: 4px 4px 0 var(--purple);
    transform: translate(-2px, -2px);
    background: #fffef4;
}
.help {
    font-size: 11px;
    line-height: 1.5;
    color: #505a63;
    margin-top: 7px;
}
.checkrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--ink);
    border-radius: 16px;
    background: #fff;
    padding: 12px 14px;
}
.checkcopy strong {
    display: block;
    font-size: 13px;
}
.checkcopy small {
    display: block;
    color: #59636d;
    font-size: 10px;
    margin-top: 2px;
}
.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex: 0 0 auto;
}
.switch input {
    opacity: 0;
    position: absolute;
}
.slider {
    position: absolute;
    inset: 0;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: #ddd;
}
.slider:before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: white;
    left: 3px;
    top: 3px;
    transition: 0.2s;
}
.switch input:checked + .slider {
    background: var(--mint);
}
.switch input:checked + .slider:before {
    transform: translateX(20px);
}
.presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.preset {
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: #fff;
    padding: 8px 11px;
    font: 800 10px var(--mono);
    box-shadow: 2px 2px 0 var(--ink);
}
.preset:nth-child(1) {
    background: #dbeeff;
}
.preset:nth-child(2) {
    background: #ffe5f0;
}
.preset:nth-child(3) {
    background: #e6ddff;
}
.preset:nth-child(4) {
    background: #fff1ba;
}
.actions {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 10px;
}
.btn {
    min-height: 50px;
    border: 2px solid var(--ink);
    border-radius: 16px;
    background: white;
    font-weight: 900;
    box-shadow: 4px 4px 0 var(--ink);
    transition: 0.15s ease;
}
.btn:hover:not(:disabled) {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
}
.btn:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--ink);
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-primary {
    background: var(--blue);
}
.btn-copy {
    background: var(--purple);
    color: #fff;
}
.btn-clear {
    width: 100%;
    margin-top: 10px;
    background: var(--pink);
}
.error {
    display: none;
    margin-top: 7px;
    font-size: 11px;
    font-weight: 800;
    color: #c53232;
}
.result-card {
    position: sticky;
    top: 16px;
}
.result-body {
    padding: 24px;
}
.formula-stage {
    min-height: 280px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    border: 2px solid var(--ink);
    border-radius: 22px;
    background: #f8fbff;
    padding: 28px;
    overflow: hidden;
}
.molecule {
    position: absolute;
    border: 2px solid var(--ink);
    border-radius: 50%;
}
.molecule.a {
    width: 92px;
    height: 92px;
    background: var(--orange);
    right: -24px;
    top: -22px;
}
.molecule.b {
    width: 58px;
    height: 58px;
    background: var(--pink);
    left: 18px;
    bottom: -20px;
}
.formula-line {
    position: relative;
    z-index: 2;
    border: 2px solid var(--ink);
    border-radius: 14px;
    padding: 11px 13px;
    background: white;
    box-shadow: 3px 3px 0 var(--ink);
    font: 800 11px var(--mono);
    word-break: break-word;
}
.formula-line.base {
    background: #dbeeff;
}
.formula-line.source {
    background: #e3f8ef;
}
.formula-line.medium {
    background: #fff2ba;
}
.formula-line.campaign {
    background: #ffe5f0;
}
.formula-line.optional {
    background: #eee8ff;
}
.formula-key {
    opacity: 0.62;
    margin-right: 6px;
}
.output-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 22px 0 8px;
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}
.output-box {
    min-height: 115px;
    border: 2px solid var(--ink);
    border-radius: 18px;
    background: white;
    padding: 16px;
    font: 12px/1.55 var(--mono);
    word-break: break-all;
}
.output-box.empty {
    color: #75808a;
    display: flex;
    align-items: center;
}
.quality {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin-top: 14px;
}
.quality-item {
    border: 2px solid var(--ink);
    border-radius: 14px;
    padding: 10px;
    background: #fff;
    text-align: center;
}
.quality-item strong {
    display: block;
    font-size: 18px;
}
.quality-item span {
    font: 700 9px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.status {
    margin-top: 14px;
    border: 2px solid var(--ink);
    border-radius: 15px;
    padding: 11px 13px;
    background: var(--mint);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    font-weight: 800;
}
.status-dot {
    width: 10px;
    height: 10px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: white;
    display: inline-block;
    margin-right: 7px;
}
.status-dot.ok {
    background: #56d77a;
}
.status-dot.warn {
    background: var(--yellow);
}
.status-dot.err {
    background: var(--red);
}
.open-link {
    display: none;
    margin-top: 10px;
    text-decoration: none;
    color: inherit;
}
.tip {
    margin-top: 20px;
    border: 2px solid var(--ink);
    border-radius: 18px;
    background: var(--orange);
    box-shadow: 4px 4px 0 var(--ink);
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 800;
}
.footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 26px;
    font: 700 10px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
@media (max-width: 950px) {
    .hero,
    .workspace {
        grid-template-columns: 1fr;
    }
    .hero-copy {
        justify-self: start;
    }
    .result-card {
        position: relative;
        top: auto;
    }
}
@media (max-width: 650px) {
    .shell {
        width: min(100% - 20px, 1280px);
    }
    .pill {
        display: none;
    }
    .hero h1 {
        font-size: clamp(58px, 23vw, 96px);
    }
    .field-grid,
    .actions,
    .quality {
        grid-template-columns: 1fr;
    }
    .controls,
    .result-body {
        padding: 18px;
    }
    .footer {
        flex-direction: column;
    }
    .blob.c {
        display: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
