/* vapor.chromoshub.ru — solvent vapor volume calculator */
:root {
    --bg: #0d1117;
    --bg-2: #161b22;
    --bg-3: #1c2430;
    --card: #10151d;
    --line: #26303c;
    --line-2: #313d4d;
    --txt: #e6edf3;
    --txt-2: #9aa7b4;
    --txt-3: #6b7684;
    --accent: #4bd0b0;
    --accent-2: #16a085;
    --err: #f85149;
    --ok: #2fbf4c;
    --warn: #d29922;
    --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", "DejaVu Sans Mono", "Consolas", monospace;
    --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] {
    --bg: #f2f6f5;
    --bg-2: #ffffff;
    --bg-3: #eef2f4;
    --card: #ffffff;
    --line: #dde4e6;
    --line-2: #c9d3d4;
    --txt: #14201d;
    --txt-2: #52616a;
    --txt-3: #808d92;
    --accent: #0f9b81;
    --accent-2: #0c7d68;
    --err: #cf222e;
    --ok: #1a9e33;
    --warn: #b8860b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
    font-family: var(--ui);
    background:
        radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%),
        var(--bg);
    color: var(--txt);
    min-height: 100vh;
}

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; }
.brand__mark { font-size: 18px; }
.actions { display: flex; align-items: center; gap: 10px; }
.lang { display: inline-flex; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.lang__btn {
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    padding: 0 9px; border: 0; background: var(--bg-3); color: var(--txt-2); cursor: pointer;
    transition: background .12s, color .12s;
}
.lang__btn + .lang__btn { border-left: 1px solid var(--line-2); }
.lang__btn:hover { color: var(--accent); }
.lang__btn.is-active { background: var(--accent-2); color: #fff; }
.icon-btn {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-3); color: var(--txt-2); cursor: pointer;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn.is-ok { color: #fff; background: var(--accent-2); border-color: var(--accent-2); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .i-moon { display: none; }
:root[data-theme="light"] .icon-btn .i-sun { display: none; }
:root[data-theme="light"] .icon-btn .i-moon { display: block; }

.wrap {
    max-width: 880px; margin: 0 auto; padding: 22px 18px 40px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    align-items: start;
}
.panel {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 18px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.panel--accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.panel--wide { grid-column: 1 / -1; }
.panel__title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--txt-2); margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--txt-3); margin-top: 10px; line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--txt-2); margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field--row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.field--row > span { flex: 1; }

input, select {
    font-family: var(--mono); font-size: 14px;
    padding: 8px 10px; background: var(--bg-3); color: var(--txt);
    border: 1px solid var(--line-2); border-radius: 8px; outline: none;
}
.field--row input, .field--row select { width: 150px; text-align: right; }
.field--row select { text-align: left; }
input:focus, select:focus { border-color: var(--accent); }
select { cursor: pointer; }

/* slider + number pair */
.slide { display: flex; align-items: center; gap: 10px; }
.slide input[type="number"] { width: 88px; text-align: right; flex: none; }
input[type="range"] {
    flex: 1; -webkit-appearance: none; appearance: none;
    height: 6px; padding: 0; border: 0; border-radius: 4px;
    background: var(--bg-3); cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--card); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--card); cursor: pointer;
}
input[type="range"]:focus { outline: none; }
input[type="range"]:focus::-webkit-slider-thumb { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

/* segmented control */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; width: 100%; }
.seg__btn {
    flex: 1; font-family: var(--ui); font-size: 12.5px;
    padding: 8px 6px; border: 0; background: var(--bg-3); color: var(--txt-2); cursor: pointer;
    transition: background .12s, color .12s;
}
.seg__btn + .seg__btn { border-left: 1px solid var(--line-2); }
.seg__btn:hover { color: var(--accent); }
.seg__btn.is-active { background: var(--accent-2); color: #fff; }

.mono { font-family: var(--mono); }
.err { margin-top: 10px; color: var(--err); font-size: 13px; }

/* ---------------------------------------------------------- hero */
.hero {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, var(--card)), var(--card));
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.hero.is-caution {
    background: linear-gradient(180deg, color-mix(in srgb, var(--warn) 14%, var(--card)), var(--card));
    border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
}
.hero.is-overload {
    background: linear-gradient(180deg, color-mix(in srgb, var(--err) 14%, var(--card)), var(--card));
    border-color: color-mix(in srgb, var(--err) 45%, var(--line));
}
.hero__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero__main { display: flex; flex-direction: column; gap: 2px; }
.hero__label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--txt-2); }
.hero__val b { font-family: var(--mono); font-size: 2.6rem; color: var(--accent); line-height: 1.1; }
.hero.is-caution .hero__val b { color: var(--warn); }
.hero.is-overload .hero__val b { color: var(--err); }
.hero__val em { font-style: normal; font-size: 1rem; color: var(--txt-2); }
.hero__pct { display: flex; align-items: baseline; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.hero__pct b { font-family: var(--mono); font-size: 1.8rem; color: var(--txt); }
.hero__pct em { font-style: normal; font-size: .95rem; color: var(--txt-2); }
.hero__pctlbl { width: 100%; text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--txt-3); }

/* traffic light */
.lights {
    display: inline-flex; gap: 8px; padding: 7px 10px;
    background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 10px;
}
.light { width: 18px; height: 18px; border-radius: 50%; background: var(--line-2); opacity: .3; transition: opacity .15s, box-shadow .15s; }
.lights.is-ok .light--g { background: var(--ok); opacity: 1; box-shadow: 0 0 10px var(--ok); }
.lights.is-caution .light--y { background: var(--warn); opacity: 1; box-shadow: 0 0 10px var(--warn); }
.lights.is-overload .light--r { background: var(--err); opacity: 1; box-shadow: 0 0 10px var(--err); }

/* fill bar */
.bar {
    position: relative; height: 14px; margin: 16px 0 12px;
    background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
}
.bar__fill { height: 100%; width: 0; background: var(--ok); transition: width .15s, background .15s; }
.hero.is-caution .bar__fill { background: var(--warn); }
.hero.is-overload .bar__fill { background: var(--err); }
.bar__mark { position: absolute; top: 0; bottom: 0; width: 2px; }
.bar__mark--c { background: color-mix(in srgb, var(--warn) 70%, transparent); }
.bar__mark--o { background: color-mix(in srgb, var(--err) 70%, transparent); }

.hero__stats { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-family: var(--mono); font-size: 12px; color: var(--txt-3); }
.hero__stats b { color: var(--txt-2); }

.verdict { margin-top: 12px; font-size: 13px; line-height: 1.55; color: var(--txt-2); text-align: center; }
.verdict b { color: var(--txt); }
.verdict.is-caution { color: var(--warn); }
.verdict.is-overload { color: var(--err); }
.verdict .warn-bp { display: block; margin-top: 6px; color: var(--warn); }

/* chart */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--txt-3); font-family: var(--mono); font-size: 11px; }
.chart .axis-title { fill: var(--txt-2); font-family: var(--ui); font-size: 12px; }
.chart .curve { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .op-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.chart .op-label { fill: var(--txt); font-family: var(--mono); font-size: 11px; }
.chart .lim-line { stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .lim-line--c { stroke: var(--warn); }
.chart .lim-line--o { stroke: var(--err); }
.chart .lim-label { font-family: var(--mono); font-size: 10px; }
.chart .lim-label--c { fill: var(--warn); }
.chart .lim-label--o { fill: var(--err); }
.chart .ok-band { fill: var(--ok); opacity: .13; }
.chart .cross { stroke: var(--txt-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .cross-dot { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.chart .tip-bg { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 1; }
.chart .tip-tx { fill: var(--txt); font-family: var(--mono); font-size: 11px; }

.note { grid-column: 1 / -1; font-size: 12px; color: var(--txt-3); text-align: center; line-height: 1.5; }
.chart-def { margin-top: 8px; font-size: 12.5px; color: var(--txt-2); line-height: 1.6; }
.chart-def b { color: var(--txt); }
.chart-def sub { font-size: .78em; }

@media (max-width: 680px) {
    .wrap { grid-template-columns: 1fr; }
    .hero, .note { grid-column: 1 / -1; }
    .hero__top { justify-content: center; text-align: center; }
    .hero__pct { justify-content: center; }
    .hero__pctlbl { text-align: center; }
}
