:root {
  color-scheme: dark;
  --bg: #071320;
  --surface: #0d1d2b;
  --surface-2: #12283a;
  --line: #274357;
  --text: #eef7f2;
  --muted: #9db2c0;
  --green: #39d98a;
  --amber: #ffbf47;
  --red: #ff7373;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; overflow-x: hidden; background: radial-gradient(circle at 80% -20%, #173e4c 0, transparent 38rem), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
.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 { max-width: 1240px; margin: 0 auto; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 780; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--green); border-radius: 9px; color: var(--green); font-size: .75rem; letter-spacing: .08em; }
.privacy-note { color: var(--muted); font-size: .82rem; }

main { max-width: 1240px; margin: 0 auto; padding: 46px 24px 70px; }
.intro { max-width: 760px; margin-bottom: 34px; }
.eyebrow { color: var(--green); text-transform: uppercase; letter-spacing: .15em; font-weight: 800; font-size: .76rem; margin: 0 0 12px; }
h1 { font-size: clamp(2.25rem, 6vw, 4.7rem); line-height: .98; letter-spacing: -.055em; margin: 0; max-width: 13ch; }
.intro > p:last-child { color: var(--muted); max-width: 62ch; font-size: 1.08rem; line-height: 1.6; margin: 20px 0 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(290px, .82fr); gap: 16px; align-items: start; }
.panel, .result-panel { border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 92%, transparent); padding: 22px; box-shadow: 0 18px 45px rgba(0,0,0,.18); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 24px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.step { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--green); font-size: .72rem; font-weight: 850; }
h2 { margin: 0; font-size: 1.1rem; letter-spacing: -.02em; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 8px; }
.text-button:hover, .text-button:focus-visible { color: var(--text); }

.segmented { border: 0; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; background: #081722; overflow: hidden; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { min-height: 44px; padding: 10px; display: grid; place-items: center; color: var(--muted); font-size: .88rem; border: 1px solid transparent; border-radius: 10px; }
.segmented input:checked + span { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--green) 35%, transparent); }

.field-grid { display: grid; gap: 14px; margin-bottom: 15px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 8px; color: var(--muted); font-size: .85rem; }
.input-with-unit { display: flex; align-items: center; background: #081722; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.input-with-unit:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(57,217,138,.12); }
.input-with-unit input { width: 100%; min-width: 0; color: var(--text); border: 0; outline: 0; background: transparent; padding: 12px 10px; }
.input-with-unit b { padding: 0 10px; color: var(--muted); font-size: .8rem; }
.input-with-unit.compact input { padding: 10px 8px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 8px 11px; font-size: .78rem; }
.chip:hover, .chip:focus-visible { color: var(--text); border-color: var(--green); }

.load-total { color: var(--amber); font-variant-numeric: tabular-nums; }
.load-list { display: grid; gap: 10px; }
.load-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 72px 36px; gap: 8px; }
.load-row > label > input { width: 100%; height: 42px; border: 1px solid var(--line); background: #081722; color: var(--text); border-radius: 10px; padding: 9px 10px; outline: 0; }
.load-row > label > input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(57,217,138,.12); }
.remove-load { width: 36px; height: 42px; border: 0; background: transparent; color: var(--muted); font-size: 1.35rem; border-radius: 8px; }
.remove-load:hover, .remove-load:focus-visible { color: var(--red); background: rgba(255,115,115,.08); }
.add-button { width: 100%; margin-top: 12px; min-height: 44px; border: 1px dashed var(--line); background: transparent; color: var(--green); border-radius: 10px; }

.result-panel { position: sticky; top: 18px; background: linear-gradient(145deg, rgba(27,69,72,.92), rgba(13,29,43,.96)); border-color: rgba(57,217,138,.42); }
.result-label { display: block; color: var(--green); text-transform: uppercase; letter-spacing: .13em; font-weight: 800; font-size: .72rem; }
.runtime { margin: 10px 0 3px; font-size: clamp(3rem, 7vw, 5rem); font-weight: 850; letter-spacing: -.07em; line-height: 1; font-variant-numeric: tabular-nums; }
.result-panel > p { color: #bdd0d4; line-height: 1.5; }
.energy-meter { height: 8px; background: rgba(255,255,255,.09); border-radius: 999px; overflow: hidden; margin: 24px 0; }
.energy-meter span { display: block; height: 100%; width: 68%; background: linear-gradient(90deg, var(--green), var(--amber)); border-radius: inherit; }
.result-stats { display: grid; gap: 0; margin: 0; }
.result-stats div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid rgba(255,255,255,.11); }
.result-stats dt { color: #a7bdc5; }
.result-stats dd { margin: 0; font-weight: 760; font-variant-numeric: tabular-nums; }
.result-warning { font-size: .79rem; margin: 18px 0 0; }
.target-box { margin-top: 18px; padding: 16px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(4,18,26,.34); display: grid; grid-template-columns: 1fr 128px; gap: 9px 12px; align-items: center; }
.target-box label { color: #a7bdc5; font-size: .86rem; }
.target-box strong, .target-box small { grid-column: 1 / -1; }
.target-box strong { color: var(--amber); font-size: 1.05rem; }
.target-box small { color: #a7bdc5; line-height: 1.45; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.result-actions button { min-height: 42px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; color: var(--text); background: rgba(255,255,255,.06); }
.result-actions button:hover, .result-actions button:focus-visible { border-color: var(--green); background: rgba(57,217,138,.1); }

.explainers { margin-top: 26px; padding-top: 30px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; }
.explainers article { padding: 22px; border-radius: var(--radius); background: rgba(13,29,43,.6); border: 1px solid rgba(39,67,87,.72); }
.explainers h2 { font-size: 1.55rem; line-height: 1.15; }
.explainers h3 { margin: 0 0 12px; }
.explainers p, .explainers li { color: var(--muted); line-height: 1.6; }
.explainers code { color: var(--green); overflow-wrap: anywhere; }
.explainers ul { margin: 0; padding-left: 19px; }
.faq { max-width: 820px; margin: 64px auto 0; }
.faq > h2 { font-size: 2rem; margin-bottom: 22px; }
.faq details { border-top: 1px solid var(--line); padding: 18px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 720; }
.faq details p { color: var(--muted); line-height: 1.65; }
footer { max-width: 1240px; margin: 0 auto; padding: 0 24px 44px; }
footer p { max-width: 78ch; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.privacy-details { max-width: 78ch; color: var(--muted); font-size: .82rem; line-height: 1.55; border-top: 1px solid var(--line); padding-top: 14px; }
.privacy-details summary { cursor: pointer; color: var(--text); font-weight: 720; }
.privacy-settings { padding-left: 0; color: var(--green); }
.consent-banner { position: fixed; z-index: 20; left: 20px; right: 20px; bottom: 20px; max-width: 980px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 18px 20px; border: 1px solid rgba(57,217,138,.55); border-radius: 14px; background: #0d1d2b; box-shadow: 0 16px 60px rgba(0,0,0,.45); }
.consent-banner[hidden] { display: none; }
.consent-banner strong { display: block; margin-bottom: 5px; }
.consent-banner p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .88rem; }
.consent-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.consent-actions button { min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); }
.consent-actions .primary { border-color: var(--green); background: var(--green); color: #052014; font-weight: 800; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr 1fr; }
  .result-panel { grid-column: 1 / -1; position: static; }
  .explainers { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .privacy-note { display: none; }
  main { padding-top: 26px; }
  .workspace { grid-template-columns: 1fr; }
  .result-panel { grid-column: auto; grid-row: 1; }
  .controls { grid-row: 2; }
  .loads { grid-row: 3; }
  .panel, .result-panel { padding: 18px; }
  .field-grid.two { grid-template-columns: 1fr; }
  .load-row { grid-template-columns: minmax(0, 1fr) 82px 66px 34px; gap: 6px; }
  .consent-banner { align-items: stretch; flex-direction: column; left: 12px; right: 12px; bottom: 12px; gap: 14px; }
  .consent-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 430px) {
  .topbar, main, footer { padding-left: 16px; padding-right: 16px; }
  .load-row { grid-template-columns: minmax(0, 1fr) 78px 62px 34px; }
  .load-row > label:first-child { grid-column: 1 / -1; }
  .target-box { grid-template-columns: 1fr; }
  .target-box strong, .target-box small { grid-column: auto; }
}

@media print {
  :root { color-scheme: light; }
  body { background: white; color: #111; }
  .topbar, .intro, .controls, .loads, .explainers, .faq, footer, .result-actions { display: none; }
  main { padding: 0; }
  .workspace { display: block; }
  .result-panel { color: #111; background: white; border: 2px solid #111; box-shadow: none; }
  .result-panel p, .result-panel dt, .target-box label, .target-box small { color: #333; }
}

@media (prefers-reduced-motion: no-preference) {
  .runtime { transition: opacity .15s ease, transform .15s ease; }
  button { transition: color .15s ease, border-color .15s ease, background-color .15s ease; }
}
