:root {
  --bg: #f3f6fb;
  --card: #fff;
  --card2: #f6f8fc;
  --line: #dde3ee;
  --text: #0f172a;
  --muted: #5b6679;
  --accent: #2563eb;
  --accent-soft: #e3ecff;
  --ok: #1a7f37;
  --okfg: #fff;
  --bad: #c62828;
  --code: #eef2f8;
  --track: #dde3ee;
  --chip: #eef2f8;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e16;
    --card: #0f1420;
    --card2: #131a28;
    --line: #212b3d;
    --text: #f1f5fb;
    --muted: #9aa6ba;
    --accent: #4c8dff;
    --accent-soft: #16264a;
    --ok: #238636;
    --okfg: #fff;
    --bad: #ff7b72;
    --code: #05070b;
    --track: #222c3f;
    --chip: #1a2233;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0e16;
  --card: #0f1420;
  --card2: #131a28;
  --line: #212b3d;
  --text: #f1f5fb;
  --muted: #9aa6ba;
  --accent: #4c8dff;
  --accent-soft: #16264a;
  --ok: #238636;
  --okfg: #fff;
  --bad: #ff7b72;
  --code: #05070b;
  --track: #222c3f;
  --chip: #1a2233;
  color-scheme: dark;
}
html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  transition:
    background 0.2s,
    color 0.2s;
}
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.wrap {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 0 16px;
}
.feature-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 20px;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.feature-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), rgba(37, 99, 235, 0.25));
}
.feature-card:hover,
.feature-card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.12);
  border-color: rgba(37, 99, 235, 0.35);
}
.feature-card h3 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.feature-card button,
.feature-card a {
  margin-top: auto;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
}
.feature-card button:hover,
.feature-card button:focus-visible,
.feature-card a:hover,
.feature-card a:focus-visible {
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}
@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}
.footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 14px 16px 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer a {
  color: var(--accent);
  text-decoration: none;
}
.footer a:hover,
.footer a:focus-visible {
  text-decoration: underline;
}
.footer .dot {
  color: var(--muted);
}
.footer > span:first-child {
  font-weight: 600;
  color: var(--text);
}
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
h1 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
header p {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
}
.theme {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.theme svg {
  width: 22px;
  height: 22px;
}
.theme .sun {
  display: none;
}
:root[data-theme="dark"] .theme .sun {
  display: block;
}
:root[data-theme="dark"] .theme .moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme .moon {
    display: none;
  }
}
.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 880px) {
  .grid {
    grid-template-columns: 1.15fr 1fr;
    align-items: start;
  }
  .result {
    position: sticky;
    top: calc(16px + env(safe-area-inset-top, 0px));
  }
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.sec {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}
.sec:last-child {
  border-bottom: 0;
}
.sh {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sh h2 {
  margin: 0;
  font-size: 1.15rem;
}
.sh small {
  color: var(--muted);
  font-size: 0.9rem;
}
label,
.lab {
  font-weight: 600;
}
.field {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card2);
  border-radius: 10px;
  padding: 0 14px;
  height: 48px;
}
.field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field.err {
  border-color: var(--bad);
}
.field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.field span {
  color: var(--muted);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  white-space: nowrap;
}
.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 8px 0 14px;
  min-height: 1.3em;
}
.hint.err {
  color: var(--bad);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--accent);
}
.chip.on {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--okfg);
}
.chip:focus-visible,
.theme:focus-visible,
.seg button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card2);
}
.seg button {
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 14px;
  cursor: pointer;
}
.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.row .field {
  width: 170px;
  height: 42px;
}
.big {
  font-size: 1.5rem;
  font-weight: 700;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: none;
  margin: 0;
  cursor: pointer;
  --p: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--accent) var(--p),
    var(--track) var(--p)
  );
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--accent) var(--p),
    var(--track) var(--p)
  );
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--accent);
  margin-top: -8px;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--accent);
}
input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}
.ends {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 4px 0 12px;
}
.badge {
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 99px;
  padding: 2px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
}
.cost {
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  font-weight: 800;
  margin: 8px 0 6px;
  line-height: 1.1;
}
.sub {
  color: var(--muted);
  font-size: 0.9rem;
}
.mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mini div {
  border: 1px solid var(--line);
  background: var(--card2);
  border-radius: 10px;
  padding: 14px;
}
.mini .k {
  color: var(--muted);
  font-size: 0.85rem;
}
.mini .v {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2px 0;
}
pre {
  margin: 10px 0 0;
  background: var(--code);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.82rem;
  overflow-x: auto;
  line-height: 1.7;
}
h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}
h4 {
  margin: 0;
  font-size: 0.95rem;
}
