:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #242426;
  background: #eaeaed;
  font-synthesis: none;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #737378;
  outline-offset: 3px;
}
.page-shell {
  width: 100%; max-width: 600px; min-height: 100svh; margin: 0 auto;
  background: #fff;
}
.tabs-bar {
  position: sticky; top: 0; z-index: 2;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  background: #fff;
}
.page-tabs {
  display: flex; gap: 4px;
  margin: 0; padding: 6px;
  border-radius: 15px;
  background: #efeff1;
}
.page-tabs a {
  display: flex; align-items: center; justify-content: center;
  flex: 1; min-height: 44px; padding: 10px 8px; border-radius: 9px;
  color: #626269; text-decoration: none; font-size: 16px; font-weight: 500;
  transition: background .15s, color .15s, box-shadow .15s;
}
.page-tabs a:hover { color: #242426; background: #e5e5e8; }
.page-tabs a[aria-current="page"] {
  background: #fff; color: #242426; font-weight: 650;
  box-shadow: 0 1px 4px #19191c1a, 0 0 0 1px #19191c06;
}
.converter { padding: 8px 20px max(28px, env(safe-area-inset-bottom)); }
label, h2 { display: block; font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.unit-fields, .calculator-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.select-field, .calculator-inputs > div { min-width: 0; }
.calculator-page .unit-fields, .calculator-page .calculator-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.amount-wrap { position: relative; }
.amount-wrap input, select {
  width: 100%; min-width: 0; height: 52px;
  border: 1px solid #e1e1e5; border-radius: 11px; background: #f6f6f7;
  font-size: 16px; font-weight: 400;
  transition: border-color .15s, background .15s;
}
.amount-wrap input { padding: 0 130px 0 14px; appearance: textfield; -moz-appearance: textfield; }
select { padding: 0 10px; }
.amount-wrap input:focus, select:focus { background: #fff; border-color: #737378; }
.amount-wrap input::-webkit-inner-spin-button, .amount-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.amount-wrap input:disabled { background: #f6f6f7; color: #737378; border-color: #ededf0; padding-right: 14px; cursor: not-allowed; }
.amount-wrap input::placeholder { color: #737378; opacity: 1; }
.amount-wrap input[aria-invalid="true"] { border-color: #b23624; }
.amount-wrap span {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 16px; color: #66666d; pointer-events: none;
}
.calculator-inputs .amount-wrap input { padding-right: 42px; }
.calculator-inputs #fuel { padding-right: 76px; }
.calculator-inputs .amount-wrap input:disabled { padding-right: 12px; }
.calculator-inputs .amount-wrap span { right: 10px; }
.calculator-inputs .amount-wrap span:empty { display: none; }
button:disabled { opacity: .45; cursor: default; }
.result-panel { background: #f1f1f3; color: #242426; border-radius: 16px; padding: 20px; margin-top: 24px; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-heading h2 { margin: 0; font-weight: 500; color: #626269; }
.result-actions { display: flex; gap: 6px; }
.result-heading button {
  min-height: 44px; min-width: 62px; padding: 8px 10px;
  border: 1px solid #dcdce1; border-radius: 9px;
  background: #fafafa; color: #424248; font-size: 16px;
  transition: background .15s;
}
.result-heading button:hover:not(:disabled) { background: #e5e5e8; }
.result-heading button:active:not(:disabled) { background: #dcdce1; }
.result-heading button:focus-visible { outline-color: #737378; }
.result-content { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.result-number { font-size: 36px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -1px; line-height: 1.2; overflow-wrap: anywhere; }
.result-unit { min-height: 1.5em; font-size: 16px; color: #424248; overflow-wrap: anywhere; }
.result-equation { margin: 0; min-height: 1.5em; font-size: 16px; color: #626269; overflow-wrap: anywhere; }
.error { color: #b23624; font-size: 16px; margin: 10px 0 0; }
@media (min-width: 600px) {
  .page-shell { min-height: 0; margin: 40px auto; border: 1px solid #dcdce1; border-radius: 22px; overflow: clip; box-shadow: 0 8px 32px #24242608; }
  .tabs-bar { position: static; padding: 24px; }
  .converter { padding: 8px 28px 28px; }
  .unit-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: end; }
  .page-tabs a, .amount-wrap input, select, .result-unit { font-size: 18px; }
  .result-panel { padding: 24px; }
  .result-number { font-size: 48px; }
}
@media (max-width: 359px) {
  .converter { padding-left: 16px; padding-right: 16px; }
  .tabs-bar { padding-left: 12px; padding-right: 12px; }
  .result-panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
