:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #66717b;
  --paper: #ffffff;
  --canvas: #f4f6f7;
  --soft: #edf1f3;
  --line: #d9e0e4;
  --accent: #f3c74b;
  --accent-strong: #d8a915;
  --accent-soft: #fff7d8;
  --green: #156f56;
  --green-soft: #e7f5ef;
  --orange: #965018;
  --orange-soft: #fff0df;
  --red: #a13e38;
  --red-soft: #fff0ef;
  --blue-soft: #eaf2f8;
  --radius-lg: 24px;
  --radius-md: 15px;
  --shadow: 0 22px 55px rgba(16, 24, 32, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  color: var(--ink);
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 92% 4%, rgba(243, 199, 75, 0.18), transparent 28rem),
    var(--canvas);
}

button, input, select { font: inherit; }
button, label, summary, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(16, 24, 32, 0.09);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.header-links { display: flex; align-items: center; gap: 8px; }
.header-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 40px; min-height: 40px; padding: 8px; border-radius: 10px; color: #46515a; text-decoration: none; }
.header-link svg { width: 21px; height: 21px; flex: 0 0 auto; }
.telegram-link { color: #1678a7; }
.telegram-link svg { fill: currentColor; }
.header-link:hover { background: var(--soft); }
.header-link:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.sky-link { color: #6c5410; background: var(--accent-soft); font-size: 0.875rem; font-weight: 750; }

.page-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 28px;
}

.intro { max-width: 760px; margin-bottom: 24px; }
.eyebrow, .step-kicker {
  margin: 0 0 7px;
  color: #7a6213;
  font-size: 0.77rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 9px;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.intro > #intro-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.wizard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 20px;
  align-items: start;
}

.wizard-layout.is-result { grid-template-columns: minmax(0, 860px); justify-content: center; }
.wizard-layout.is-result .wizard-card { width: 100%; }

.wizard-card, .live-summary {
  border: 1px solid rgba(16, 24, 32, 0.09);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.wizard-card { padding: 24px; }
.live-summary { position: sticky; top: 82px; padding: 22px; }

.progress-head {
  display: none;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-track {
  display: none;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--soft);
}

.progress-track span {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-strong);
  transition: width 0.22s ease;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8a939b;
  font-size: 0.81rem;
  font-weight: 750;
}

.steps li span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
}

.steps li.is-current, .steps li.is-complete { color: var(--ink); }
.steps li.is-current span { background: var(--accent); color: var(--ink); }
.steps li.is-complete span { background: var(--ink); color: var(--paper); }

.wizard-step { padding-top: 26px; }
.step-heading { max-width: 650px; margin-bottom: 22px; }
.step-heading h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -0.035em;
}
.step-heading > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.preset-button {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr 22px;
  gap: 11px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.preset-button:hover, .preset-button:focus-visible {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  transform: translateY(-1px);
  outline: 0;
}

.preset-button.is-selected { border-color: var(--accent-strong); background: var(--accent-soft); }
.preset-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 1.05rem;
}
.preset-text strong, .preset-text small { display: block; }
.preset-text strong { font-size: 0.93rem; line-height: 1.25; }
.preset-text small { margin-top: 3px; color: var(--muted); font-size: 0.75rem; }
.preset-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: transparent;
  font-size: 0.72rem;
}
.preset-button.is-selected .preset-check { border-color: var(--ink); color: var(--paper); background: var(--ink); }

.selection-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.selection-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.selection-heading h3 { margin: 0; font-size: 1rem; }
.text-button, .inline-button, .small-edit-button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}
.text-button { padding: 7px 8px; color: var(--muted); }
.text-button:hover, .text-button:focus-visible { color: var(--ink); background: var(--soft); }
.inline-button { margin-top: 8px; padding: 0; color: #745c0d; text-decoration: underline; text-underline-offset: 3px; }

.selected-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.selected-empty {
  width: 100%;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}
.selected-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 7px 5px 10px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 0.88rem;
  font-weight: 700;
}
.selected-icon { font-size: 0.9rem; }
.remove-selected, .remove-device, .dialog-close {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #7c858d;
  cursor: pointer;
  line-height: 1;
}
.remove-selected { width: 28px; height: 28px; border-radius: 7px; font-size: 1.15rem; }
.remove-selected:hover, .remove-device:hover { color: var(--red); background: var(--red-soft); }

.add-custom {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px dashed #aeb7be;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
  font-weight: 750;
}
.add-custom:hover, .add-custom:focus-visible { border-color: var(--accent-strong); background: var(--accent-soft); outline: 0; }

.custom-device-form { margin-top: 14px; padding: 16px; border: 1px solid var(--accent-strong); border-radius: 13px; background: var(--accent-soft); }
.custom-device-form h3 { margin: 0 0 14px; font-size: 1rem; }
.custom-device-fields { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; }
.custom-device-fields > div { min-width: 0; }
#custom-device-name { width: 100%; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); font: inherit; }
#custom-device-name:focus { outline: 3px solid rgba(243, 199, 75, 0.4); border-color: var(--accent-strong); }
#custom-device-hint { margin: 12px 0; color: #684b0d; font-size: 0.875rem; line-height: 1.55; }
.custom-device-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.custom-device-actions .text-button { min-height: 44px; }
.selected-item { max-width: 100%; }
.selected-name, .edit-selected { overflow-wrap: anywhere; min-width: 0; }
.edit-selected { min-height: 32px; padding: 3px 0; border: 0; color: inherit; background: transparent; font-weight: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 4px; }
.edit-selected:hover { text-decoration-style: solid; }
.selected-item .remove-selected { flex: 0 0 auto; }
.runtime-table .term-help { font-weight: inherit; text-align: right; line-height: 1.5; }

@media (max-width: 680px) {
  .custom-device-fields { grid-template-columns: 1fr; }
  .edit-selected { min-height: 44px; }
}

.step-error { margin: 12px 0 0; color: var(--red); font-weight: 700; }
.step-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.step-actions.only-next { justify-content: flex-end; }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 800;
}
.primary-button { border: 1px solid var(--ink); color: var(--paper); background: var(--ink); }
.primary-button:hover, .primary-button:focus-visible { background: #26323b; outline: 3px solid rgba(243, 199, 75, 0.45); }
.secondary-button { border: 1px solid var(--line); background: var(--paper); }
.secondary-button:hover, .secondary-button:focus-visible { border-color: #9ca6ae; background: var(--soft); outline: 0; }

.notice {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 13px;
}
.warning-notice { margin-bottom: 16px; color: #684b0d; background: var(--accent-soft); }
.neutral-notice { color: #365262; background: var(--blue-soft); }
.notice-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 900;
}
.notice strong { display: block; margin-bottom: 3px; }
.notice p { margin: 0; font-size: 0.88rem; line-height: 1.48; }

.devices-editor { display: grid; gap: 12px; }
.device-editor-card { padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fbfcfc; }
.device-editor-head { display: grid; grid-template-columns: 36px 1fr 34px; gap: 9px; align-items: center; }
.device-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--soft); }
.device-name {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-weight: 800;
}
.device-name:hover, .device-name:focus { border-color: var(--line); background: var(--paper); outline: 0; }
.remove-device { width: 34px; height: 34px; border-radius: 9px; font-size: 1.3rem; }
.power-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.power-fields > label > span:first-child, .custom-capacity > label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}
.number-with-unit {
  display: flex;
  align-items: center;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}
.number-with-unit input { width: 100%; min-width: 0; height: 100%; padding: 0 4px 0 10px; border: 0; outline: 0; background: transparent; }
.number-with-unit > span { padding-right: 9px; color: var(--muted); font-size: 0.76rem; font-weight: 750; }
.power-fields select, .device-details select {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper);
}
.number-with-unit:focus-within, .power-fields select:focus, .device-details select:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(243, 199, 75, 0.22);
  outline: 0;
}
.delay-explanation { margin: 9px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.device-details { margin-top: 11px; color: var(--muted); font-size: 0.82rem; }
.device-details summary { width: fit-content; cursor: pointer; }
.duty-field { display: grid; grid-template-columns: 1fr 210px; align-items: center; gap: 12px; margin-top: 10px; }
.duty-example { margin: 10px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--blue-soft); color: #365262; font-size: 0.875rem; line-height: 1.5; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset legend { margin-bottom: 10px; font-weight: 800; }
.chemistry-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chemistry-picker legend { grid-column: 1 / -1; }
.chemistry-option { cursor: pointer; }
.chemistry-option input { position: absolute; opacity: 0; pointer-events: none; }
.chemistry-card {
  display: block;
  min-height: 105px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
}
.chemistry-card strong, .chemistry-card small { display: block; }
.chemistry-card strong { margin-bottom: 7px; font-size: 1.05rem; }
.chemistry-card small { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.chemistry-option input:checked + .chemistry-card { border-color: var(--accent-strong); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-strong); }
.chemistry-option input:focus-visible + .chemistry-card { outline: 3px solid rgba(243, 199, 75, 0.45); }

.chemistry-info { margin-top: 12px; padding: 15px; border-radius: 13px; background: var(--soft); }
.chemistry-info h3 { margin-bottom: 8px; font-size: 0.95rem; }
.tradeoffs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tradeoffs p { margin: 0; color: #46515a; font-size: 0.82rem; line-height: 1.5; }
.tradeoffs strong { color: var(--ink); }
.tradeoff h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; font-size: 0.875rem; }
.tradeoff-icon { display: inline-grid; place-items: center; width: 23px; height: 23px; flex: 0 0 auto; border-radius: 50%; font-weight: 850; }
.advantages h4 { color: var(--green); }
.advantages .tradeoff-icon { background: #d5ece2; }
.disadvantages h4 { color: var(--orange); }
.disadvantages .tradeoff-icon { background: #ffe3c3; }
.tradeoff ul { margin: 0; padding-left: 19px; color: #46515a; font-size: 0.875rem; line-height: 1.55; }
.tradeoff li + li { margin-top: 6px; }
.advantages li::marker { color: var(--green); }
.disadvantages li::marker { color: var(--orange); }

.capacity-picker { margin-top: 22px; }
.capacity-options { display: flex; flex-wrap: wrap; gap: 8px; }
.capacity-option { cursor: pointer; }
.capacity-option input { position: absolute; opacity: 0; pointer-events: none; }
.capacity-option span {
  display: grid;
  place-items: center;
  min-width: 92px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  font-weight: 800;
}
.capacity-option input:checked + span { border-color: var(--ink); color: var(--paper); background: var(--ink); }
.capacity-option input:focus-visible + span { outline: 3px solid rgba(243, 199, 75, 0.45); }
.custom-capacity { display: grid; grid-template-columns: 1fr 160px; align-items: end; gap: 14px; margin-top: 12px; padding: 13px; border-radius: 12px; background: var(--soft); }
.custom-capacity > label { margin: 0; align-self: center; color: var(--ink); font-size: 0.88rem; }

.mode-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.mode-preview article { padding: 13px; border-radius: 12px; background: var(--green-soft); }
.mode-preview article:last-child { background: var(--orange-soft); }
.mode-preview strong { display: block; margin-bottom: 4px; font-size: 0.86rem; }
.mode-preview p { margin: 0; color: #486159; font-size: 0.78rem; line-height: 1.45; }
.mode-preview article:last-child p { color: #754b28; }

.live-summary .eyebrow { margin-bottom: 7px; }
.live-summary h2 { margin-bottom: 8px; font-size: 1.3rem; letter-spacing: -0.025em; }
.summary-empty { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.summary-main { padding: 15px; border-radius: 13px; background: var(--accent-soft); }
.summary-main span, .summary-main strong { display: block; }
.summary-main span { margin-bottom: 5px; color: #745d0e; font-size: 0.78rem; font-weight: 700; }
.summary-main strong { font-size: 1.65rem; letter-spacing: -0.04em; }
.live-summary dl { margin: 13px 0 0; }
.live-summary dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.live-summary dt { color: var(--muted); }
.live-summary dd { margin: 0; font-weight: 800; text-align: right; }
.summary-hint { margin: 12px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }

.result-heading { margin-bottom: 18px; }
.ups-result { position: relative; overflow: hidden; padding: 22px; border-radius: 17px; color: var(--paper); background: var(--ink); }
.ups-result::after { content: "ϟ"; position: absolute; right: 20px; top: 4px; color: rgba(243, 199, 75, 0.16); font-size: 8rem; font-weight: 900; line-height: 1; }
.result-label { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; margin-bottom: 10px; color: #cad2d7; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.result-label span { padding: 4px 7px; border-radius: 999px; color: #203128; background: var(--green-soft); font-size: 0.7rem; letter-spacing: 0; }
.ups-result h3 { position: relative; z-index: 1; max-width: 520px; margin-bottom: 8px; font-size: clamp(1.7rem, 4vw, 2.55rem); line-height: 1.12; letter-spacing: -0.045em; }
.ups-result > p { position: relative; z-index: 1; margin-bottom: 14px; color: #d2d9dd; }
.sine-badge { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 9px; color: #1c372c; background: var(--green-soft); font-size: 0.8rem; font-weight: 800; }

.calculation-details, .result-disclosure { margin-top: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfc; }
.calculation-details summary, .result-disclosure summary { padding: 14px 15px; cursor: pointer; font-weight: 800; }
.calculation-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 14px 14px; }
.calculation-facts div { padding: 11px; border-radius: 10px; background: var(--soft); }
.calculation-facts span, .calculation-facts strong { display: block; }
.calculation-facts span { margin-bottom: 4px; color: var(--muted); font-size: 0.73rem; }

.scope-warning { margin-top: 12px; padding: 13px; border-radius: 12px; color: #724317; background: var(--orange-soft); font-size: 0.86rem; line-height: 1.5; }
.battery-result { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; }
.battery-result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.battery-result-head p { margin-bottom: 2px; color: var(--muted); font-size: 0.75rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; }
.battery-result-head h3 { margin: 0; font-size: 1.15rem; }
.small-edit-button { padding: 7px 9px; color: #66520f; background: var(--accent-soft); }
.runtime-cards { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 10px; }
.runtime-card { padding: 16px; border-radius: 13px; }
.runtime-card.daily { background: var(--green-soft); }
.runtime-card.reserve { background: var(--orange-soft); }
.runtime-mode, .runtime-card strong { display: block; }
.runtime-mode { margin-bottom: 6px; color: #3d6356; font-size: 0.75rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.06em; }
.runtime-card.reserve .runtime-mode { color: #865021; }
.runtime-card > strong { margin-bottom: 7px; font-size: 1.6rem; letter-spacing: -0.04em; }
.runtime-card p { margin: 0; color: #446057; font-size: 0.79rem; line-height: 1.47; }
.runtime-card.reserve p { color: #794e2a; }
.estimate-note { margin: 12px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.48; }

.runtime-table-wrap { overflow-x: auto; padding: 0 14px 14px; }
.runtime-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.runtime-table th, .runtime-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.runtime-table th:first-child, .runtime-table td:first-child { padding-left: 0; text-align: left; }
.runtime-table th { color: var(--muted); font-size: 0.73rem; }
.runtime-table td { font-size: 0.87rem; font-weight: 750; }
.runtime-table tr.is-selected { background: var(--accent-soft); }
.runtime-table tr.is-selected td:first-child { padding-left: 8px; }
.your-badge { display: inline-block; margin-left: 5px; padding: 2px 5px; border-radius: 999px; color: #68520c; background: var(--accent); font-size: 0.62rem; text-transform: uppercase; }
.disclosure-note { margin: 0; padding: 0 15px 12px; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.product-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; padding: 0 14px 14px; }
.product-card, .product-empty { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.product-card.is-best { border-color: var(--accent-strong); background: var(--accent-soft); }
.product-badge { display: block; margin-bottom: 7px; color: #715b10; font-size: 0.66rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.06em; }
.product-card h3, .product-empty strong { margin-bottom: 8px; font-size: 0.88rem; line-height: 1.35; }
.product-specs { display: flex; flex-wrap: wrap; gap: 5px; }
.product-specs span { padding: 3px 6px; border-radius: 6px; color: #4c575f; background: var(--soft); font-size: 0.68rem; font-weight: 750; }
.product-empty { grid-column: 1 / -1; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.product-empty strong { display: block; color: var(--ink); }
.result-actions { align-items: center; }
.restart-button { margin-left: auto; }

.help-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 90px rgba(16, 24, 32, 0.28);
}
.help-dialog[open] { display: flex; flex-direction: column; }
.power-help-open { overflow: hidden; }
.help-dialog::backdrop { background: rgba(16, 24, 32, 0.55); backdrop-filter: blur(4px); }
.dialog-head, .dialog-actions { flex: 0 0 auto; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 22px 15px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.025em; }
.dialog-close { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; background: var(--soft); font-size: 1.4rem; }
.dialog-body { min-height: 0; padding: 20px 22px; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.dialog-body > p { color: var(--muted); line-height: 1.55; }
.label-locations { margin: 0 0 18px; padding-left: 21px; }
.label-locations li { margin-bottom: 9px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; padding: 14px 22px 20px; border-top: 1px solid var(--line); }

.power-examples { margin-top: 20px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfc; }
.power-examples > summary { padding: 15px; border-radius: 12px; background: var(--accent-soft); cursor: pointer; font-weight: 800; line-height: 1.5; }
.power-examples-body { padding: 14px; }
.examples-intro { margin: 0 0 14px; color: var(--muted); font-size: 0.875rem; line-height: 1.55; }
.power-example { border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.power-example + .power-example { margin-top: 9px; }
.power-example > summary { min-height: 52px; padding: 12px; border-radius: 10px; cursor: pointer; font-weight: 750; line-height: 1.5; }
.power-example > summary small { display: block; margin: 3px 0 0 18px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.power-example[open] > summary { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; background: var(--soft); }
.power-example-body { padding: 14px; font-size: 0.9375rem; line-height: 1.55; overflow-wrap: anywhere; }
.power-example-body > p { margin: 0 0 14px; }
.example-reading { padding: 12px; border-radius: 9px; background: var(--accent-soft); }
.example-photo { margin: 0; }
.example-photo img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.example-photo figcaption { margin: 5px 0 0; }
.power-example a { color: #17627a; text-underline-offset: 3px; }
.power-example a:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 3px; border-radius: 3px; }
.example-photo a { display: inline-block; padding: 8px 0; font-size: 0.875rem; }
.example-image-status { margin: 0; padding: 20px 14px; border-radius: 8px; color: var(--muted); background: var(--soft); }
.power-example-body > .example-source { margin: 4px 0 0; color: var(--muted); font-size: 0.8125rem; }
.example-video { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.example-video p { margin: 0 0 12px; }
.example-video-link { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); font-size: 0.875rem; font-weight: 750; text-decoration: none; }
.example-video-link:hover { background: var(--accent-soft); }

@media (max-width: 680px) {
  .dialog-head { padding: 16px; gap: 10px; }
  .dialog-head h2 { font-size: 1.125rem; }
  .dialog-close { width: 44px; height: 44px; }
  .dialog-body { padding: 16px; }
  .dialog-actions { padding: 12px 16px; }
  .power-examples-body { padding: 10px; }
  .power-example-body { padding: 10px; }
}

footer { padding: 22px 4px 0; color: var(--muted); font-size: 0.78rem; text-align: center; }
footer p { margin: 0; }

@media (max-width: 900px) {
  .wizard-layout { grid-template-columns: 1fr; }
  .live-summary { position: static; }
  .live-summary .summary-content { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .live-summary dl { margin-top: 0; }
  .summary-hint { grid-column: 1 / -1; margin-top: 0; }
}

@media (max-width: 680px) {
  .topbar { height: 58px; padding: 0 16px; }
  .header-links { gap: 2px; }
  .sky-link span { display: none; }
  .header-link { min-width: 36px; min-height: 40px; padding: 7px; }
  .brand { min-width: 0; font-size: 0.875rem; gap: 7px; }
  .brand-mark { width: 30px; height: 32px; flex: 0 0 auto; }
  .page-shell { width: min(100% - 24px, 1120px); padding-top: 24px; }
  .intro { margin-bottom: 18px; }
  h1 { font-size: clamp(1.85rem, 9vw, 2.55rem); }
  .wizard-card, .live-summary { padding: 16px; border-radius: 18px; }
  .steps { display: none; }
  .progress-head, .progress-track { display: flex; }
  .wizard-step { padding-top: 22px; }
  .preset-grid, .chemistry-picker, .tradeoffs, .mode-preview, .runtime-cards, .product-list { grid-template-columns: 1fr; }
  .preset-button { min-height: 60px; }
  .power-fields { grid-template-columns: 1fr 1fr; }
  .power-fields > :last-child { grid-column: 1 / -1; }
  .duty-field { grid-template-columns: 1fr; gap: 7px; }
  .step-actions { flex-wrap: wrap; }
  .step-actions .primary-button { margin-left: auto; }
  .custom-capacity { grid-template-columns: 1fr; }
  .live-summary .summary-content { grid-template-columns: 1fr; }
  .calculation-facts { grid-template-columns: 1fr; }
  .ups-result::after { font-size: 6rem; }
  .runtime-card > strong { font-size: 1.45rem; }
  .result-actions .secondary-button { width: 100%; }
  .restart-button { width: 100%; margin: 0; }
}

@media (max-width: 430px) {
  .power-fields { grid-template-columns: 1fr; }
  .power-fields > :last-child { grid-column: auto; }
  .step-actions .primary-button, .step-actions .secondary-button { width: 100%; margin-left: 0; }
  .capacity-option { flex: 1 1 calc(50% - 8px); }
  .capacity-option span { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* The guided steps become a single workspace after the first calculation. */
.return-calculator { margin-top: 14px; }
.capacity-help { margin: 10px 0 0; color: var(--red); font-size: 0.875rem; }
.mobile-result-bar { display: none; }
.calculator-mode .page-shell { width: min(1320px, calc(100% - 48px)); }
.calculator-mode .intro { max-width: none; }
.calculator-mode h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.wizard-layout.is-result { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 24px; }
.calculator-controls { display: grid; gap: 20px; min-width: 0; }
.workspace-card, .is-result > .result-step {
  min-width: 0;
  padding: 24px;
  border: 1px solid rgba(16, 24, 32, 0.09);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.workspace-card { scroll-margin-top: 82px; }
.workspace-card .wizard-step { padding: 0; }
.workspace-card .step-actions, .workspace-card .step-kicker,
.workspace-card [data-step="2"] .step-heading,
.workspace-card .selected-list, .workspace-card .selection-heading h3,
.workspace-card .mode-preview { display: none; }
.workspace-card .step-heading { margin-bottom: 18px; }
.workspace-card .step-heading h2 { font-size: 1.3rem; }
.workspace-card .step-heading p { font-size: 0.875rem; }
.workspace-card .selection-block { display: flex; gap: 12px; margin: 12px 0 18px; padding: 0; border: 0; }
.workspace-card .selection-heading { order: 2; }
.workspace-card .add-custom { margin: 0; }
.workspace-card .notice p { font-size: 0.875rem; }
.workspace-card .preset-grid { gap: 8px; }
.workspace-card .preset-button { padding: 10px; }
.workspace-card .preset-icon { width: 30px; height: 30px; }
.workspace-card .preset-text small { font-size: 0.8125rem; }
.workspace-card .power-fields > label > span:first-child,
.workspace-card .number-with-unit > span,
.workspace-card .device-details, .workspace-card .delay-explanation,
.workspace-card .chemistry-card small, .workspace-card .tradeoffs p { font-size: 0.875rem; }
.is-result > .result-step { position: sticky; top: 82px; scroll-margin-top: 82px; }
.is-result .result-heading { margin-bottom: 16px; }
.is-result .result-heading .step-kicker { display: none; }
.is-result .result-heading h2 { font-size: 1.3rem; margin-bottom: 5px; }
.is-result .result-heading p { font-size: 0.875rem; }
.is-result .ups-result { padding: 20px; }
.is-result .ups-result h3 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
.is-result .runtime-cards { grid-template-columns: 1fr 1fr; }
.is-result .runtime-card { padding: 13px; }
.is-result .runtime-card > strong { font-size: clamp(1.2rem, 1.7vw, 1.6rem); }
.is-result .runtime-card p, .is-result .estimate-note, .is-result .runtime-table th,
.is-result .disclosure-note, .is-result .calculation-facts span { font-size: 0.875rem; }
.is-result .runtime-mode { font-size: 0.8125rem; letter-spacing: 0; }
.is-result .your-badge { font-size: 0.75rem; }
.is-result .runtime-table th { vertical-align: top; }
.is-result .calculation-facts { grid-template-columns: 1fr; }
.is-result .calculation-facts div { display: flex; justify-content: space-between; gap: 12px; }
.is-result .calculation-facts span { margin: 0; }
.is-result .product-list { grid-template-columns: 1fr; }
.is-result .product-specs span { font-size: 0.8125rem; }
.is-result .result-actions { gap: 6px; margin-top: 18px; padding-top: 12px; }
.result-empty { padding: 24px; border: 1px dashed var(--line); border-radius: 16px; background: var(--soft); }
.result-empty h3 { margin-bottom: 8px; font-size: 1.125rem; }
.result-empty p { margin: 0; color: var(--muted); line-height: 1.6; }
input:user-invalid { box-shadow: inset 0 0 0 2px var(--red); }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 3px; }

@media (max-width: 1000px) {
  .wizard-layout.is-result { grid-template-columns: minmax(0, 1fr); }
  .is-result > .result-step { position: static; }
  .calculator-mode .page-shell { width: min(740px, calc(100% - 32px)); padding-bottom: 110px; }
  .mobile-result-bar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 25;
    display: flex; justify-content: center; align-items: center; gap: 20px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: var(--paper);
    box-shadow: 0 -8px 24px rgba(16, 24, 32, 0.08);
  }
  .mobile-result-bar span, .mobile-result-bar strong { display: block; }
  .mobile-result-bar span { color: var(--muted); font-size: 0.8125rem; }
  .mobile-result-bar strong { margin-top: 3px; font-size: 0.9375rem; }
  .mobile-result-bar button { min-height: 44px; font-size: 0.875rem; }
  .is-result .runtime-card > strong { font-size: 1.5rem; }
  .is-result .runtime-table th { font-size: 0.8125rem; }
}

@media (max-width: 680px) {
  .workspace-card, .is-result > .result-step { padding: 16px; border-radius: 18px; }
  .workspace-card .preset-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
  .workspace-card .preset-button { grid-template-columns: 1fr; gap: 6px; align-content: start; }
  .workspace-card .preset-icon, .workspace-card .preset-check { display: none; }
  .workspace-card .preset-button.is-selected { box-shadow: inset 0 0 0 1px var(--accent-strong); }
  .workspace-card .power-fields { grid-template-columns: 1fr 1fr; }
  .workspace-card .power-fields > :last-child { grid-column: 1 / -1; }
  .is-result .result-actions { flex-wrap: wrap; }
  .is-result .restart-button { width: auto; margin-left: auto; }
  .is-result .battery-result-head { align-items: flex-start; gap: 8px; }
  .is-result .battery-result-head .small-edit-button { font-size: 0.875rem; }
  .is-result .runtime-cards { grid-template-columns: 1fr; }
  .is-result .runtime-table th, .is-result .runtime-table td { padding: 10px 4px; }
  .is-result .runtime-table td { font-size: 0.8125rem; }
  .mobile-result-bar { gap: 12px; padding-left: 12px; padding-right: 12px; }
  .mobile-result-bar span { font-size: 0.75rem; }
}

/* The same explanation works on hover, with the keyboard, and on touch. */
.term-help { padding: 0; border: 0; border-radius: 2px; color: inherit; background: transparent; cursor: help; text-align: left; text-decoration: underline dotted; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.term-help:hover, .term-help[aria-expanded="true"] { text-decoration-style: solid; }
.term-help:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 4px; }
.field-caption { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.875rem; font-weight: 750; line-height: 1.45; }
.power-field { min-width: 0; }
.duty-field .term-help { font-size: 0.875rem; line-height: 1.5; }
.term-help.sine-badge { padding: 7px 10px; border-radius: 9px; color: #1c372c; background: var(--green-soft); }
.term-popover {
  position: fixed; inset: auto; z-index: 100; width: min(400px, calc(100vw - 24px));
  margin: 0; padding: 18px; overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--paper);
  box-shadow: 0 12px 50px rgba(16,24,32,0.22); font-size: 0.9375rem; line-height: 1.55;
}
.term-popover-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.term-popover h2 { margin: 0 0 10px; font-size: 1rem; line-height: 1.4; }
.term-popover p { margin: 0 0 10px; }
.term-popover p:last-child { margin-bottom: 0; }
#close-term { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; margin: -6px -6px 0 0; border: 0; border-radius: 8px; color: var(--muted); background: var(--soft); font-size: 1.4rem; cursor: pointer; }

@media (max-width: 680px) {
  .topbar { height: auto; min-height: 58px; gap: 8px; padding: 8px 12px; }
  .brand > span:last-child { overflow-wrap: anywhere; }
  .header-links { flex: 0 0 auto; }
  #close-term { width: 40px; height: 40px; }
}
