:root {
  --red: #7e1417;
  --red-strong: #a3292d;
  --red-soft: #f7e9e8;
  --ink: #1d1b1a;
  --ink-soft: #36312f;
  --muted: #706866;
  --paper: #fbf9f7;
  --surface: #fffdfb;
  --warm: #f1ebe6;
  --line: #ded6d0;
  --line-strong: #b9ada5;
  --green: #1e7452;
  --green-soft: #eaf5ef;
  --amber: #a85f10;
  --amber-soft: #fbf0df;
  --dark: #211f1e;
  --dark-soft: #2a2725;
  --dark-line: #403a37;
  --dark-muted: #9d938e;
  --shadow: 0 24px 70px rgba(47, 29, 24, 0.1);
  --radius-card: 18px;
  --radius-control: 10px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  line-height: 1.5;
  overflow-x: hidden;
}

button,
input,
select { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }

svg { display: block; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  padding: 10px 14px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.blueprint-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(126, 20, 23, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 20, 23, 0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, #000 0, transparent 68%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(222, 214, 208, 0.86);
  background: rgba(251, 249, 247, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav-shell {
  width: min(1200px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border: 2px solid var(--red);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-mark::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.brand-mark i {
  position: absolute;
  width: 14px;
  height: 2px;
  background: var(--red);
}

.brand-mark i:first-child { left: -8px; }
.brand-mark i:last-child { right: -8px; }

.brand-copy { display: grid; line-height: 1.05; }

.brand-copy strong {
  font-size: 12px;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--red);
  font: 700 8px/1 var(--mono);
  letter-spacing: 0.23em;
}

.nav-shell nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 12px;
  font-weight: 700;
}

.nav-shell nav a {
  position: relative;
  transition: color 0.2s ease;
}

.nav-shell nav a:not(.nav-home)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-shell nav a:hover { color: var(--red); }
.nav-shell nav a:hover::after { transform: scaleX(1); }

.nav-shell .nav-home {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.menu-button span {
  display: block;
  width: 16px;
  height: 1.5px;
  margin: 4px auto;
  background: var(--ink);
}

main { position: relative; }

.hero {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.hero-layout {
  width: min(1200px, calc(100% - 40px));
  min-height: 590px;
  margin: 0 auto;
  padding: 76px 0 84px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(410px, 0.82fr);
  align-items: center;
  gap: clamp(52px, 7vw, 108px);
}

.hero-copy { position: relative; z-index: 1; }

.eyebrow,
.tool-index,
.form-kicker,
.choice-kicker,
.result-kicker {
  margin: 0;
  color: var(--red);
  font: 700 10px/1.3 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(30, 116, 82, 0.1);
  animation: pulse-dot 2.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  50% { box-shadow: 0 0 0 9px rgba(30, 116, 82, 0); }
}

.hero h1 {
  max-width: 670px;
  margin: 24px 0 22px;
  font-size: clamp(48px, 6vw, 78px);
  line-height: 0.99;
  letter-spacing: -0.065em;
  font-weight: 780;
}

.hero-lead {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.journey-steps {
  max-width: 520px;
  margin-top: 44px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.journey-step {
  display: grid;
  gap: 8px;
}

.journey-step span {
  color: var(--red);
  font: 700 9px var(--mono);
}

.journey-step strong { font-size: 11px; }

.hero-choice-panel {
  position: relative;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.choice-head { padding-bottom: 21px; }

.choice-head h2 {
  margin: 10px 0 7px;
  font-size: 27px;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.choice-head > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.choice-list { display: grid; gap: 10px; }

.choice-card {
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  display: grid;
  grid-template-columns: 73px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.choice-card:hover {
  border-color: var(--red);
  background: var(--red-soft);
  box-shadow: 0 10px 22px rgba(126, 20, 23, 0.08);
  transform: translateY(-2px);
}

.choice-art {
  position: relative;
  width: 73px;
  height: 73px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.art-dieline i {
  position: absolute;
  top: 25px;
  height: 26px;
  border: 1px solid var(--red);
}

.art-dieline i:nth-child(1) { left: 8px; width: 18px; }
.art-dieline i:nth-child(2) { left: 26px; width: 12px; }
.art-dieline i:nth-child(3) { left: 38px; width: 18px; }
.art-dieline i:nth-child(4) { left: 56px; width: 10px; }
.art-dieline::before,
.art-dieline::after {
  content: "";
  position: absolute;
  left: 8px;
  width: 58px;
  border-top: 1px dashed var(--line-strong);
}
.art-dieline::before { top: 17px; }
.art-dieline::after { top: 51px; }
.art-dieline b {
  position: absolute;
  top: 37px;
  left: 8px;
  width: 58px;
  border-top: 1px solid var(--red);
}

.art-resistor { display: flex; align-items: center; justify-content: center; gap: 0; }
.art-resistor::before,
.art-resistor::after {
  content: "";
  width: 17px;
  height: 1px;
  background: var(--ink-soft);
}
.art-resistor i { width: 7px; height: 29px; background: var(--red); }
.art-resistor i:nth-child(2) { background: #161514; }
.art-resistor b { width: 7px; height: 29px; background: var(--amber); }
.art-resistor::after { background: var(--ink-soft); }

.choice-copy { min-width: 0; display: grid; gap: 5px; }
.choice-copy strong { font-size: 13px; }
.choice-copy > span { color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.choice-copy small { margin-top: 4px; color: var(--red); font: 700 9px var(--mono); }
.choice-copy small b { margin-left: 4px; font-size: 13px; }
.choice-arrow { align-self: start; color: var(--red); font-size: 18px; }

.choice-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.choice-note strong { margin-right: 5px; color: var(--green); font-weight: 750; }

.tool-section,
.principles {
  scroll-margin-top: 88px;
  padding: 96px max(20px, calc((100vw - 1200px) / 2));
}

.tool-section {
  border-bottom: 1px solid var(--line);
  background: rgba(241, 235, 230, 0.7);
}

.resistor-section { background: var(--paper); }

.section-heading {
  margin-bottom: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 0.72fr);
  align-items: end;
  gap: 60px;
}

.section-title h2 {
  max-width: 620px;
  margin: 12px 0 0;
  font-size: clamp(40px, 5vw, 63px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.tool-index { display: inline-flex; align-items: center; gap: 10px; }

.tool-index sup {
  padding: 4px 6px;
  border: 1px solid rgba(126, 20, 23, 0.2);
  border-radius: 4px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 7px;
  letter-spacing: 0.1em;
}

.section-summary { max-width: 430px; }
.section-summary p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.section-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--red); font-size: 11px; font-weight: 750; }
.section-link span { font-size: 16px; }

.tool-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.revpack-shell { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(380px, 0.84fr); }

.tool-form { padding: 40px 43px 36px; }

.form-intro { padding-bottom: 28px; }
.form-intro h3,
.camera-intro h3 { margin: 10px 0 8px; font-size: 25px; line-height: 1.05; letter-spacing: -0.04em; }
.form-intro p,
.camera-intro p { max-width: 520px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.form-step {
  padding: 28px 0 30px;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 17px;
  border-top: 1px solid var(--line);
}

.step-number {
  width: 27px;
  height: 27px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--red);
  font: 700 8px var(--mono);
}

.step-content { min-width: 0; }
.field-heading { margin: 3px 0 13px; display: flex; justify-content: space-between; gap: 18px; }
.field-heading label,
.mode-fieldset legend,
.output-fieldset legend { font-size: 13px; font-weight: 750; }
.field-heading span { color: var(--muted); font: 9px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }

.drop-zone {
  min-height: 140px;
  padding: 22px;
  border: 1.5px dashed #c6b9b0;
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.drop-zone:hover,
.drop-zone.is-dragging { border-color: var(--red); background: var(--red-soft); transform: translateY(-1px); }
.drop-zone.has-file { border-style: solid; border-color: rgba(30, 116, 82, 0.42); background: var(--green-soft); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { margin-top: 10px; font-size: 13px; }
.drop-zone small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.upload-icon,
.camera-icon {
  width: 39px;
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--red);
  background: var(--surface);
}

.upload-icon svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.mode-fieldset legend { margin: 3px 0 13px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.mode-card {
  position: relative;
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  grid-template-columns: 17px 1fr;
  align-items: start;
  gap: 10px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.mode-card:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.mode-card input { position: absolute; opacity: 0; }
.radio-mark { width: 16px; height: 16px; margin-top: 1px; border: 1.5px solid #aaa09a; border-radius: 50%; background: var(--surface); }
.mode-card input:checked + .radio-mark { border: 4.5px solid var(--red); }
.mode-card > span:last-child { display: grid; gap: 5px; }
.mode-card strong { font-size: 11.5px; line-height: 1.35; }
.mode-card small { color: var(--muted); font-size: 10px; line-height: 1.5; }

.text-dimension-field {
  margin-top: 10px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
}

.text-dimension-field label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 750; }
.text-dimension-field label span { color: var(--muted); font-weight: 500; }
.text-dimension-field input,
.field-row input {
  width: 100%;
  height: 41px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}
.text-dimension-field > small { display: block; margin-top: 7px; color: var(--muted); font-size: 9.5px; }

.advanced-options { border-top: 1px solid var(--line); }
.advanced-options summary { padding: 18px 0; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 9px; }
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary::before { content: "+"; width: 19px; height: 19px; border: 1px solid var(--line-strong); border-radius: 50%; display: grid; place-items: center; color: var(--red); font-size: 14px; line-height: 1; }
.advanced-options[open] summary::before { content: "-"; }
.advanced-options summary span { font-size: 11px; font-weight: 750; }
.advanced-options summary small { color: var(--muted); font-size: 10px; }
.advanced-content { padding: 0 0 25px 28px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field-row label { display: grid; gap: 7px; font-size: 10.5px; font-weight: 700; }
.field-row label small { color: var(--muted); font-size: 9px; font-weight: 500; }

.output-fieldset { margin-top: 19px; }
.output-fieldset legend { margin-bottom: 9px; }
.output-fieldset label { margin: 0 17px 8px 0; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 10.5px; font-weight: 650; }
.output-fieldset input { position: absolute; opacity: 0; }
.output-fieldset label > span { width: 15px; height: 15px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
.output-fieldset input:checked + span { border-color: var(--red); background: var(--red); box-shadow: inset 0 0 0 3px var(--surface); }
.output-fieldset b { padding: 3px 5px; border-radius: 4px; color: var(--green); background: var(--green-soft); font: 700 7px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }

.submit-row {
  padding: 26px 0 0 48px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 17px;
}

.button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.button:hover:not(:disabled) { transform: translateY(-2px); }
.button:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
.mode-card:focus-within,
.drop-zone:focus-within,
.choice-card:focus-visible {
  outline: 3px solid rgba(126, 20, 23, 0.22);
  outline-offset: 2px;
}
.button-primary { color: #fff; background: var(--red); box-shadow: 0 9px 22px rgba(126, 20, 23, 0.18); }
.button-primary:hover:not(:disabled) { background: var(--red-strong); box-shadow: 0 13px 28px rgba(126, 20, 23, 0.25); }
.button-ghost { color: var(--ink); border-color: var(--line); background: var(--surface); }
.button-dark { color: #fff; background: var(--dark); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.analyze-button { min-width: 169px; }
.button-spinner { display: none; width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, 0.32); border-top-color: #fff; border-radius: 50%; animation: spin 0.75s linear infinite; }
.tool-form.is-loading .button-label { opacity: 0.7; }
.tool-form.is-loading .button-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.submit-row p { margin: 0; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.submit-row p svg { width: 15px; fill: none; stroke: var(--green); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.form-message,
.resistor-message { min-height: 18px; margin: 11px 0 0 48px; color: var(--red); font-size: 10.5px; }
.form-message.success,
.resistor-message.success { color: var(--green); }

.result-panel {
  min-height: 690px;
  padding: 34px;
  border-left: 1px solid var(--dark-line);
  color: #fff;
  background: var(--dark);
}

.empty-result { min-height: 620px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-result .result-kicker { margin-top: 27px; color: #a99e98; }
.empty-result h3 { max-width: 290px; margin: 10px 0 8px; font-size: 23px; line-height: 1.05; letter-spacing: -0.04em; }
.empty-result > p:not(.result-kicker) { max-width: 320px; margin: 0; color: var(--dark-muted); font-size: 11px; line-height: 1.65; }

.result-preview-list { margin-top: 25px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.result-preview-list span { padding: 6px 8px; border: 1px solid var(--dark-line); border-radius: 5px; color: #b7ada8; background: var(--dark-soft); font: 8px var(--mono); }

.dieline-graphic { position: relative; width: 248px; height: 154px; opacity: 0.6; }
.dieline-graphic span { position: absolute; top: 46px; height: 67px; border: 1px solid #bd7a7d; }
.dieline-graphic span:nth-child(1) { left: 8px; width: 67px; }
.dieline-graphic span:nth-child(2) { left: 75px; width: 48px; }
.dieline-graphic span:nth-child(3) { left: 123px; width: 67px; }
.dieline-graphic span:nth-child(4) { left: 190px; width: 50px; }
.dieline-graphic i { position: absolute; left: 8px; width: 232px; border: 1px dashed #655d59; }
.dieline-graphic i:nth-of-type(1) { top: 16px; height: 30px; transform: skewX(-15deg); }
.dieline-graphic i:nth-of-type(2) { top: 113px; height: 32px; transform: skewX(12deg); }
.dieline-graphic i:nth-of-type(3) { top: 79px; border-color: #c05d61; box-shadow: 0 0 12px rgba(192, 93, 97, 0.48); }

.result-top { padding-bottom: 22px; border-bottom: 1px solid var(--dark-line); display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.result-top .result-kicker { color: #a99e98; }
.result-top h3 { max-width: 245px; margin: 7px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.confidence-pill { padding: 7px 9px; border: 1px solid rgba(115, 212, 168, 0.25); border-radius: 6px; color: #73d4a8; background: rgba(29, 115, 81, 0.15); font: 700 8px var(--mono); letter-spacing: 0.1em; white-space: nowrap; }
.confidence-pill.medium { color: #e8af6c; border-color: rgba(232, 175, 108, 0.25); background: rgba(168, 92, 11, 0.15); }
.confidence-pill.low { color: #ef999d; border-color: rgba(239, 153, 157, 0.25); background: rgba(126, 20, 23, 0.18); }

.dimension-grid { padding: 32px 0; border-bottom: 1px solid var(--dark-line); display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 8px; }
.dimension-grid div { min-width: 0; }
.dimension-grid div span { display: block; margin-bottom: 7px; color: #847a75; font: 9px var(--mono); }
.dimension-grid div strong { display: inline; font-size: clamp(25px, 2.7vw, 36px); letter-spacing: -0.06em; }
.dimension-grid div small { margin-left: 3px; color: #968b85; font: 8px var(--mono); }
.dimension-grid > b { color: #5e5652; font-weight: 400; }

.result-details { margin: 23px 0 0; }
.result-details div { padding: 10px 0; border-bottom: 1px solid #332f2d; display: grid; grid-template-columns: 115px 1fr; gap: 12px; }
.result-details dt { color: #827873; font-size: 9.5px; }
.result-details dd { margin: 0; text-align: right; color: #d4cfcc; font: 9px/1.5 var(--mono); }
.result-warning { margin: 17px 0 0; padding: 11px 12px; border: 1px solid rgba(232, 175, 108, 0.2); border-radius: 8px; color: #dcb37d; background: rgba(168, 92, 11, 0.12); font-size: 9px; line-height: 1.6; }
.download-list { margin-top: 18px; display: grid; gap: 7px; }
.download-link { min-height: 46px; padding: 0 12px; border: 1px solid #463f3b; border-radius: 8px; display: flex; align-items: center; gap: 10px; color: #e8e4e1; background: var(--dark-soft); transition: border-color 0.18s ease, transform 0.18s ease; }
.download-link:hover { border-color: #786c66; transform: translateY(-1px); }
.download-link svg { width: 17px; fill: none; stroke: #c27c7e; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.download-link div { min-width: 0; display: grid; }
.download-link strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; }
.download-link small { margin-top: 2px; color: #827873; font: 8px var(--mono); text-transform: uppercase; }
.download-link > span { margin-left: auto; color: #9a8d87; font-size: 15px; }
.download-link.archive { border-color: rgba(194, 124, 126, 0.45); background: rgba(126, 20, 23, 0.19); }

.accuracy-note { margin-top: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: start; gap: 12px; background: rgba(255, 253, 251, 0.72); }
.note-icon { flex: 0 0 auto; width: 21px; height: 21px; border: 1px solid var(--red); border-radius: 50%; display: grid; place-items: center; color: var(--red); font: italic 700 10px Georgia, serif; }
.accuracy-note strong { font-size: 10.5px; }
.accuracy-note p { margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.camera-panel { padding: 33px; }
.camera-intro { margin-bottom: 22px; }
.camera-stage { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 12px; color: #fff; background: #181716; }
#resistorFrame { width: 100%; height: 100%; display: block; object-fit: cover; }
#cameraVideo { position: absolute; width: 1px; height: 1px; opacity: 0; }
.camera-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at center, #2c2826, #171615 72%); }
.camera-placeholder::before { content: ""; position: absolute; inset: 18px; border: 1px solid #393330; border-radius: 9px; }
.camera-placeholder strong { position: relative; margin-top: 13px; font-size: 13px; }
.camera-placeholder span { position: relative; margin-top: 5px; color: #847b76; font-size: 10px; }
.camera-icon { position: relative; width: 45px; height: 45px; border-color: #48413e; border-radius: 50%; color: #aaa19c; background: transparent; }
.camera-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }

.resistor-guide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0.62; pointer-events: none; }
.resistor-guide .lead { width: 15%; height: 1px; background: #fff; box-shadow: 0 0 4px #000; }
.resistor-guide .body { position: relative; width: 54%; height: 22%; min-height: 38px; border: 1.5px dashed rgba(255, 255, 255, 0.92); border-radius: 999px; display: flex; justify-content: space-evenly; align-items: stretch; }
.resistor-guide .body::before,
.resistor-guide .body::after { content: ""; position: absolute; top: 50%; width: 8px; height: 8px; border-color: #fff; border-style: solid; transform: translateY(-50%) rotate(45deg); }
.resistor-guide .body::before { left: -4px; border-width: 0 0 1px 1px; }
.resistor-guide .body::after { right: -4px; border-width: 1px 1px 0 0; }
.resistor-guide .body i { width: 4%; height: 100%; background: rgba(255, 255, 255, 0.13); }
.scan-line { position: absolute; left: 23%; top: 38%; width: 54%; height: 1px; opacity: 0; background: #d75a5e; box-shadow: 0 0 8px #d75a5e; pointer-events: none; }
.camera-stage.is-scanning .scan-line { opacity: 1; animation: scan-line 1.15s ease-in-out infinite; }
@keyframes scan-line { 0%, 100% { top: 38%; } 50% { top: 62%; } }
.local-badge { position: absolute; top: 12px; right: 12px; padding: 6px 8px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 6px; color: #d0c9c5; background: rgba(20, 19, 18, 0.72); backdrop-filter: blur(8px); font: 700 7px var(--mono); letter-spacing: 0.08em; }
.local-badge i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: #65c99b; }
.detected-bands { position: absolute; inset: 0; pointer-events: none; }
.detected-bands i { position: absolute; top: 36%; height: 28%; width: 3px; border: 1px solid rgba(255, 255, 255, 0.9); border-radius: 3px; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25); }

.camera-controls { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.camera-controls .button { min-height: 42px; padding: 0 14px; font-size: 10px; }
.photo-upload { position: relative; overflow: hidden; }
.photo-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.icon-button { width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink); background: var(--surface); }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.is-on { color: #fff; border-color: var(--amber); background: var(--amber); }
.camera-tip { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.camera-tip strong { color: var(--ink); }

.resistor-shell { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(330px, 0.84fr); }
.resistor-result { padding: 34px; border-left: 1px solid var(--line); background: var(--paper); }
.resistor-result-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.resistor-result-head h3 { margin: 8px 0 0; font-size: 20px; letter-spacing: -0.035em; }
.client-chip { padding: 6px 7px; border: 1px solid #cce1d7; border-radius: 5px; color: var(--green); background: var(--green-soft); font: 700 7px var(--mono); text-transform: uppercase; white-space: nowrap; }
.resistance-value { margin: 32px 0 2px; display: flex; align-items: baseline; gap: 7px; }
.resistance-value strong { font-size: clamp(46px, 5vw, 68px); line-height: 1; letter-spacing: -0.075em; }
.resistance-value span { color: var(--red); font: 700 14px var(--mono); }
.resistance-detail { min-height: 38px; margin: 8px 0 22px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }

.band-editor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.band-control { min-width: 0; }
.band-control label { display: block; margin-bottom: 5px; color: var(--muted); font: 8px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.band-select-wrap { position: relative; }
.band-select-wrap::after { content: "⌄"; position: absolute; top: 50%; right: 8px; color: #716a66; font-size: 9px; transform: translateY(-55%); pointer-events: none; }
.band-swatch { position: absolute; top: 50%; left: 6px; width: 11px; height: 21px; border: 1px solid rgba(0, 0, 0, 0.18); border-radius: 3px; transform: translateY(-50%); pointer-events: none; }
.band-control select { width: 100%; height: 39px; padding: 0 18px 0 22px; border: 1px solid var(--line); border-radius: 7px; appearance: none; color: var(--ink); background: var(--surface); font-size: 8px; }

.scan-confidence { margin-top: 18px; display: flex; align-items: center; gap: 9px; }
.scan-confidence > span { width: 68px; height: 5px; overflow: hidden; border-radius: 999px; background: #e1d9d4; }
.scan-confidence > span i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width 0.3s ease; }
.scan-confidence p { margin: 0; color: var(--muted); font-size: 9px; }
.scan-confidence strong { color: var(--ink); }
.resistor-message { margin-left: 0; }
.supported-box { margin-top: 22px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.supported-box strong { font-size: 10px; }
.supported-box ul { margin: 9px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.supported-box li { padding: 5px 7px; border-radius: 5px; color: #615b58; background: var(--warm); font: 8px var(--mono); }

.principles {
  border-bottom: 1px solid var(--dark-line);
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1.35fr);
  gap: 78px;
  color: #fff;
  background: var(--dark);
}

.principles .eyebrow { color: #c98183; }
.principles h2 { max-width: 400px; margin: 12px 0 14px; font-size: clamp(39px, 4.5vw, 57px); line-height: 0.98; letter-spacing: -0.06em; }
.principles-copy > p:last-child { max-width: 330px; margin: 0; color: var(--dark-muted); font-size: 11px; line-height: 1.65; }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--dark-line); background: var(--dark-line); }
.principle-grid article { min-height: 245px; padding: 24px; background: var(--dark-soft); }
.principle-grid article > span { color: #8b817d; font: 9px var(--mono); }
.principle-grid h3 { margin: 52px 0 11px; font-size: 14px; }
.principle-grid p { margin: 0; color: #938b87; font-size: 10.5px; line-height: 1.65; }

footer {
  min-height: 136px;
  padding: 34px max(20px, calc((100vw - 1200px) / 2));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  background: var(--surface);
}

.footer-brand .brand-mark { width: 33px; height: 33px; }
footer > p { margin: 0; color: var(--muted); font-size: 9.5px; }
footer > div { display: flex; justify-content: flex-end; gap: 20px; font-size: 9.5px; font-weight: 700; }
footer > div a:hover { color: var(--red); }

@media (max-width: 1050px) {
  .hero-layout { grid-template-columns: minmax(0, 1fr) 380px; gap: 42px; }
  .revpack-shell { grid-template-columns: minmax(0, 1fr) 390px; }
  .tool-form { padding: 34px 30px; }
  .result-panel { padding: 29px; }
  .resistor-shell { grid-template-columns: minmax(0, 1.04fr) minmax(300px, 0.96fr); }
  .camera-panel { padding: 28px; }
  .resistor-result { padding: 29px; }
  .principles { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 850px) {
  .nav-shell nav { position: absolute; top: 72px; right: 0; left: 0; padding: 15px 20px 21px; border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; gap: 0; background: var(--paper); transform: translateY(-130%); opacity: 0; pointer-events: none; transition: transform 0.22s ease, opacity 0.22s ease; }
  .nav-shell nav.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-shell nav a { padding: 12px 0; }
  .nav-shell nav a::after { display: none; }
  .nav-shell .nav-home { margin-top: 7px; text-align: center; }
  .menu-button { display: block; }
  .hero-layout { min-height: auto; padding: 72px 0 76px; grid-template-columns: 1fr; }
  .hero-copy { max-width: 690px; }
  .hero-choice-panel { max-width: 600px; }
  .section-heading { grid-template-columns: 1fr; gap: 17px; }
  .section-summary { max-width: 570px; }
  .revpack-shell,
  .resistor-shell { grid-template-columns: 1fr; }
  .result-panel { min-height: auto; border-top: 1px solid var(--dark-line); border-left: 0; }
  .empty-result { min-height: 410px; }
  .resistor-result { border-top: 1px solid var(--line); border-left: 0; }
  .principle-grid { grid-template-columns: repeat(3, 1fr); }
  footer { grid-template-columns: 1fr 1fr; }
  footer > p { display: none; }
}

@media (max-width: 620px) {
  .nav-shell,
  .hero-layout { width: min(100% - 28px, 1200px); }
  .brand-copy strong { font-size: 11px; }
  .brand-mark { width: 34px; height: 34px; }
  .hero-layout { padding: 59px 0 63px; gap: 44px; }
  .hero h1 { margin-top: 21px; font-size: clamp(43px, 13vw, 59px); }
  .hero-lead { font-size: 15px; }
  .journey-steps { margin-top: 34px; gap: 10px; }
  .journey-step strong { font-size: 10px; }
  .hero-choice-panel { padding: 21px; }
  .choice-head h2 { font-size: 24px; }
  .choice-card { min-height: 105px; padding: 11px; grid-template-columns: 59px minmax(0, 1fr) auto; gap: 10px; }
  .choice-art { width: 59px; height: 66px; }
  .art-dieline i:nth-child(1) { left: 6px; width: 15px; }
  .art-dieline i:nth-child(2) { left: 21px; width: 10px; }
  .art-dieline i:nth-child(3) { left: 31px; width: 16px; }
  .art-dieline i:nth-child(4) { left: 47px; width: 7px; }
  .art-dieline::before,
  .art-dieline::after,
  .art-dieline b { left: 6px; width: 48px; }
  .art-dieline::before { top: 15px; }
  .art-dieline b { top: 34px; }
  .art-dieline::after { top: 49px; }
  .art-resistor::before,
  .art-resistor::after { width: 11px; }
  .choice-copy strong { font-size: 11px; }
  .choice-copy > span { font-size: 9.5px; }
  .choice-copy small { font-size: 8px; }
  .tool-section,
  .principles { padding: 73px 14px; }
  .section-heading { padding: 0 3px; margin-bottom: 28px; }
  .section-title h2,
  .principles h2 { font-size: 44px; }
  .section-summary p { font-size: 13px; }
  .tool-shell { border-radius: 14px; }
  .tool-form { padding: 25px 18px 23px; }
  .form-intro h3,
  .camera-intro h3 { font-size: 22px; }
  .form-step { grid-template-columns: 26px minmax(0, 1fr); gap: 11px; padding: 25px 0 26px; }
  .step-number { width: 25px; height: 25px; font-size: 7px; }
  .mode-grid,
  .field-row { grid-template-columns: 1fr; }
  .mode-card { min-height: auto; }
  .advanced-content { padding-left: 0; }
  .submit-row { padding-left: 0; flex-direction: column; align-items: stretch; }
  .submit-row p { justify-content: center; text-align: center; }
  .form-message { margin-left: 0; text-align: center; }
  .result-panel { padding: 25px 19px; }
  .empty-result { min-height: 360px; }
  .dieline-graphic { transform: scale(0.88); }
  .dimension-grid { gap: 5px; }
  .dimension-grid div strong { font-size: 25px; }
  .result-details div { grid-template-columns: 101px 1fr; }
  .accuracy-note { margin-right: 1px; margin-left: 1px; }
  .camera-panel { padding: 18px; }
  .camera-stage { border-radius: 10px; }
  .resistor-guide .body { height: 28%; }
  .camera-controls .button { flex: 1 1 calc(50% - 5px); }
  .resistor-result { padding: 26px 19px; }
  .band-editor { gap: 5px; }
  .band-control select { padding-right: 14px; font-size: 8px; }
  .principle-grid { grid-template-columns: 1fr; }
  .principle-grid article { min-height: 175px; }
  .principle-grid h3 { margin-top: 31px; }
  footer { min-height: 171px; padding-top: 29px; padding-bottom: 29px; grid-template-columns: 1fr; }
  footer > div { justify-content: flex-start; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --red-soft: #3a2021;
    --ink: #f0ebe8;
    --ink-soft: #d1c7c2;
    --muted: #a49a95;
    --paper: #151413;
    --surface: #1e1c1b;
    --warm: #24211f;
    --line: #3d3734;
    --line-strong: #655a54;
    --green-soft: #1b3027;
    --amber-soft: #372816;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  }

  body { background: var(--paper); }
  .blueprint-grid { opacity: 0.12; }
  .site-header { border-color: var(--line); background: rgba(21, 20, 19, 0.9); }
  .nav-shell nav { color: var(--ink); }
  .nav-shell .nav-home,
  .menu-button { background: var(--surface); }
  .hero,
  .tool-section,
  .resistor-section { background: var(--paper); }
  .hero-choice-panel,
  .choice-card,
  .tool-shell,
  .drop-zone,
  .mode-card,
  .text-dimension-field,
  .advanced-options,
  .accuracy-note,
  .supported-box,
  .icon-button,
  .band-control select { background: var(--surface); }
  .choice-card:hover,
  .mode-card:has(input:checked),
  .drop-zone:hover,
  .drop-zone.is-dragging { background: var(--red-soft); }
  .drop-zone.has-file { background: var(--green-soft); }
  .art-dieline::before,
  .art-dieline::after { border-color: var(--line-strong); }
  .choice-art { background: var(--paper); }
  .text-dimension-field input,
  .field-row input { color: var(--ink); background: var(--surface); }
  .radio-mark,
  .output-fieldset label > span { background: var(--surface); }
  .resistor-result { background: var(--surface); }
  .client-chip { border-color: #315b49; background: var(--green-soft); }
  .supported-box li { color: #c8bdb7; background: var(--warm); }
  footer { background: var(--surface); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Portal home and route surfaces */
.home-hero,
.home-showcase,
.home-signup,
.home-notes {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
}

.home-hero {
  min-height: min(720px, calc(100dvh - 78px));
  padding: 92px 0 106px;
  display: grid;
  align-items: center;
}

.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: clamp(52px, 9vw, 138px);
}

.home-hero-copy { max-width: 720px; }
.home-hero-copy h1 { max-width: 650px; margin: 20px 0 23px; font-size: clamp(49px, 7vw, 92px); line-height: 0.94; letter-spacing: -0.075em; text-wrap: balance; }
.home-hero-copy .hero-lead { max-width: 520px; }

.home-hero-actions { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 10px; }
.home-hero-actions .button { min-height: 48px; }

.home-signal {
  position: relative;
  min-height: 425px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid #4a3d3a;
  border-radius: 17px;
  background:
    radial-gradient(circle at 50% 48%, rgba(126, 20, 23, 0.28), transparent 32%),
    linear-gradient(145deg, #272120, #121111 74%);
  box-shadow: var(--shadow);
}

.home-signal::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(213, 106, 110, 0.16);
  border-radius: 11px;
  pointer-events: none;
}

.home-signal-top,
.home-signal-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #cfc3be;
  font: 8px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.signal-live { color: #9bd9bb; }
.signal-live i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(115, 203, 163, 0.12); }

.home-signal-graphic { position: absolute; inset: 67px 25px 65px; }
.signal-ring { position: absolute; top: 50%; left: 50%; width: min(255px, 66%); aspect-ratio: 1; border: 1px solid rgba(206, 105, 109, 0.68); border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 23px rgba(126, 20, 23, 0.06), 0 0 38px rgba(126, 20, 23, 0.28); }
.signal-ring::before,
.signal-ring::after { content: ""; position: absolute; inset: 18%; border: 1px dashed rgba(206, 105, 109, 0.32); border-radius: 50%; }
.signal-ring::after { inset: 42%; border-style: solid; background: var(--red); box-shadow: 0 0 24px rgba(126, 20, 23, 0.7); }
.signal-cross { position: absolute; top: 50%; left: 50%; width: 78%; height: 1px; background: rgba(214, 181, 177, 0.25); transform: translate(-50%, -50%); }
.signal-cross-two { transform: translate(-50%, -50%) rotate(90deg); }
.signal-line { position: absolute; width: 19%; border-top: 1px dashed rgba(214, 181, 177, 0.34); }
.signal-line-one { top: 27%; left: 0; }
.signal-line-two { right: 0; bottom: 27%; }
.signal-label { position: absolute; padding: 5px 7px; border: 1px solid rgba(214, 181, 177, 0.23); border-radius: 4px; color: #d8c2bd; background: rgba(12, 12, 12, 0.68); font: 8px var(--mono); letter-spacing: 0.12em; }
.signal-label-one { top: 22%; left: 10%; }
.signal-label-two { right: 8%; bottom: 22%; }
.home-signal-bottom { position: absolute; right: 20px; bottom: 20px; left: 20px; color: #9d918b; letter-spacing: 0; text-transform: none; }
.home-signal-bottom strong { color: #c3777a; font-weight: 500; letter-spacing: 0.1em; }

.home-showcase { padding: 112px 0 118px; border-top: 1px solid var(--line); }
.home-section-heading { max-width: 680px; margin-bottom: 42px; }
.home-section-heading h2 { margin: 15px 0 14px; color: #f7f2ee; font-size: clamp(38px, 5vw, 66px); line-height: 0.98; letter-spacing: -0.065em; text-wrap: balance; }
.home-section-heading > p:last-child { max-width: 570px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

.home-app-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 14px; }
.home-app-card { min-height: 435px; padding: 26px 28px 30px; border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; align-items: flex-start; background: var(--surface); transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease; }
.home-app-card:hover { border-color: #8f3e41; background: #211d1c; transform: translateY(-4px); }
.home-app-revpack { background: linear-gradient(150deg, #211c1b, #171514 68%); }
.home-app-countor { background: linear-gradient(150deg, #191a19, #171514 68%); }
.home-app-top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #bda9a2; font: 9px var(--mono); letter-spacing: 0.1em; }
.home-app-status { color: #887a75; font-size: 8px; }
.home-app-visual { position: relative; width: 100%; height: 154px; margin: 34px 0 34px; overflow: hidden; border: 1px solid #423735; border-radius: 10px; background: #121111; }
.app-visual-dieline::before,
.app-visual-dieline::after { content: ""; position: absolute; left: 9%; width: 82%; border-top: 1px dashed #644b4a; }
.app-visual-dieline::before { top: 29%; }
.app-visual-dieline::after { bottom: 25%; }
.app-visual-dieline i { position: absolute; top: 40%; height: 35%; border: 1px solid #9b4c50; }
.app-visual-dieline i:nth-child(1) { left: 9%; width: 26%; }
.app-visual-dieline i:nth-child(2) { left: 35%; width: 17%; }
.app-visual-dieline i:nth-child(3) { left: 52%; width: 27%; }
.app-visual-dieline i:nth-child(4) { left: 79%; width: 12%; }
.app-visual-dieline b { position: absolute; top: 57%; left: 9%; width: 82%; border-top: 1px solid #d36a6e; box-shadow: 0 0 18px rgba(211, 106, 110, 0.45); }
.app-visual-resistor { display: flex; align-items: center; justify-content: center; }
.app-visual-resistor::before { content: ""; width: 76%; height: 1px; background: #d9cfcb; box-shadow: 0 0 9px rgba(255, 255, 255, 0.3); }
.app-visual-resistor i,
.app-visual-resistor b { position: absolute; top: 37%; height: 26%; width: 5%; background: #8f3034; }
.app-visual-resistor i:nth-child(1) { left: 39%; }
.app-visual-resistor b { left: 47%; background: #d4a060; }
.app-visual-resistor i:nth-child(3) { left: 55%; background: #bdc2c0; }
.app-visual-resistor i:nth-child(4) { left: 63%; background: #7e1417; }
.app-visual-resistor span { position: absolute; left: 11%; right: 11%; top: 51%; border-top: 1px dashed rgba(214, 181, 177, 0.34); }
.home-app-card h3 { margin: 0 0 11px; color: #f7f2ee; font-size: 28px; letter-spacing: -0.045em; }
.home-app-card p { max-width: 410px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.home-app-card .section-link { margin-top: auto; }

.home-signup { padding: 42px 0 48px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 0.86fr) minmax(390px, 1fr); align-items: center; gap: 70px; }
.signup-copy h2 { max-width: 530px; margin: 13px 0 10px; color: #f7f2ee; font-size: clamp(33px, 4.2vw, 52px); line-height: 0.98; letter-spacing: -0.06em; }
.signup-copy p:last-child { max-width: 410px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.signup-form { display: grid; gap: 10px; }
.signup-form > label { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.signup-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.signup-input-row input { min-width: 0; height: 48px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); color: var(--ink); background: #151413; font-size: 11px; }
.signup-input-row input::placeholder { color: #776c67; }
.signup-input-row input:focus-visible { outline: 3px solid rgba(211, 106, 110, 0.3); outline-offset: 2px; }
.signup-note,
.signup-message { margin: 0; color: #837873; font: 9px/1.5 var(--mono); }
.signup-message { min-height: 15px; color: var(--green); }
.signup-message.is-error { color: #dc8588; }

.home-notes { padding: 112px 0 125px; display: grid; grid-template-columns: minmax(250px, 0.68fr) minmax(0, 1.32fr); gap: 80px; }
.home-notes-intro h2 { max-width: 440px; margin: 14px 0 0; color: #f7f2ee; font-size: clamp(36px, 4.8vw, 57px); line-height: 0.98; letter-spacing: -0.06em; overflow-wrap: anywhere; }
.home-note-list { display: grid; grid-template-columns: 1.1fr 0.95fr 0.95fr; border-top: 1px solid var(--dark-line); border-bottom: 1px solid var(--dark-line); }
.home-note-list article { min-height: 214px; padding: 21px 22px 24px; border-left: 1px solid var(--dark-line); background: #111110; }
.home-note-list article:first-child { border-left: 0; background: #171514; }
.home-note-list article > span { color: #867974; font: 9px var(--mono); }
.home-note-list h3 { margin: 53px 0 10px; color: #f1ebe7; font-size: 13px; }
.home-note-list p { margin: 0; color: #968a84; font-size: 10px; line-height: 1.65; }

.lang-switcher { display: flex; align-items: center; gap: 7px; color: #746964; font: 700 9px var(--mono); letter-spacing: 0.08em; }
.lang-btn { color: #8e817b; transition: color 0.18s ease; }
.lang-btn:hover,
.lang-btn.active { color: #fff; }
.lang-btn.active { text-decoration: underline; text-decoration-color: #c46367; text-decoration-thickness: 1px; text-underline-offset: 4px; }

body:not(.page-revpack):not(.page-countor) .nav-primary a[href="/"],
body.page-revpack .nav-primary a[href="/revpack/"],
body.page-countor .nav-primary a[href="/countor/"] { color: var(--red); }

/* Dedicated app routes use the same tools, but remove the showcase sections. */
body.page-revpack .hero,
body.page-revpack #countor,
body.page-revpack .principles,
body.page-countor .hero,
body.page-countor #revpack,
body.page-countor .principles { display: none; }

body.page-revpack #revpack,
body.page-countor #countor { min-height: calc(100dvh - 78px); padding-top: 88px; }

body.page-revpack #revpack .section-heading,
body.page-countor #countor .section-heading { margin-bottom: 42px; }

body.page-revpack #revpack .section-link,
body.page-countor #countor .section-link { color: #d07a7d; }

@media (max-width: 980px) {
  .home-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(310px, 0.82fr); gap: 45px; }
  .home-signup { grid-template-columns: 1fr; gap: 27px; }
  .home-notes { grid-template-columns: 1fr; gap: 39px; }
}

@media (max-width: 850px) {
  .home-hero,
  .home-showcase,
  .home-signup,
  .home-notes { width: min(100% - 32px, 720px); }
  .home-hero { min-height: auto; padding: 74px 0 86px; }
  .home-hero-grid { grid-template-columns: 1fr; }
  .home-signal { max-width: 620px; min-height: 360px; }
  .home-app-grid { grid-template-columns: 1fr; }
  .home-app-card { min-height: 390px; }
  .home-note-list { grid-template-columns: 1fr; }
  .home-note-list article,
  .home-note-list article:first-child { min-height: 168px; border-top: 1px solid var(--dark-line); border-left: 0; }
  .home-note-list article:first-child { border-top: 0; }
  .home-note-list h3 { margin-top: 33px; }
  .nav-actions .lang-switcher { justify-content: center; padding: 8px 0 3px; }
}

@media (max-width: 620px) {
  .home-hero,
  .home-showcase,
  .home-signup,
  .home-notes { width: calc(100% - 28px); }
  .home-hero { padding: 61px 0 71px; }
  .home-hero-copy h1 { font-size: clamp(46px, 13vw, 63px); }
  .home-hero-actions { align-items: stretch; flex-direction: column; }
  .home-hero-actions .button { width: 100%; }
  .home-signal { min-height: 315px; }
  .home-showcase { padding: 80px 0 86px; }
  .home-section-heading h2 { font-size: 43px; }
  .home-app-card { min-height: 370px; padding: 21px 19px 23px; }
  .home-app-visual { height: 136px; margin: 28px 0; }
  .home-signup { padding: 34px 0 38px; }
  .signup-input-row { grid-template-columns: 1fr; }
  .signup-input-row .button { width: 100%; }
  .home-notes { padding: 82px 0 94px; }
  .home-notes-intro h2 { font-size: 43px; }
  body.page-revpack #revpack,
  body.page-countor #countor { padding-top: 66px; }
}

/* -------------------------------------------------------------------------
   mini MAKERSPACE brand layer
   The AI portal keeps its dark workshop feel while borrowing the main site's
   real logo, navigation rhythm, footer structure, and maker-red accent.
   ------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --red: #7e1417;
  --red-strong: #b43a3f;
  --red-soft: rgba(126, 20, 23, 0.2);
  --ink: #f4f0ec;
  --ink-soft: #d7cec8;
  --muted: #a79d97;
  --paper: #111110;
  --surface: #1b1918;
  --warm: #24211f;
  --line: #393331;
  --line-strong: #5e514c;
  --green: #73cba3;
  --green-soft: rgba(34, 126, 88, 0.2);
  --amber: #e4ad68;
  --amber-soft: rgba(168, 95, 16, 0.2);
  --dark: #0c0c0c;
  --dark-soft: #171514;
  --dark-line: #312b29;
  --dark-muted: #a19892;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Poppins, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
}

::selection { color: #fff; background: rgba(126, 20, 23, 0.7); }

.blueprint-grid {
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(126, 20, 23, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 20, 23, 0.08) 1px, transparent 1px);
}

.site-header {
  border-color: rgba(82, 70, 66, 0.8);
  background: rgba(17, 17, 16, 0.88);
}

.nav-shell {
  width: min(1320px, calc(100% - 40px));
  min-height: 78px;
}

.nav-logo,
.nav-logo-lockup {
  display: inline-flex;
  align-items: center;
}

.nav-logo-lockup { gap: 11px; }

.nav-logo img {
  display: block;
  width: 142px;
  height: auto;
  padding: 7px 9px;
  border-radius: 8px;
  background: #f2ede7;
}

.nav-logo-lockup > span {
  color: #e28a8d;
  font: 700 9px/1 var(--mono);
  letter-spacing: 0.2em;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 34px;
}

.nav-primary,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 25px;
}

.nav-shell nav a { color: var(--ink-soft); }
.nav-shell nav a:hover { color: #fff; }

.nav-shell nav a:not(.nav-home)::after { background: #d36a6e; }

.nav-shell .nav-home {
  padding: 10px 15px;
  border: 1px solid var(--red);
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  box-shadow: 0 10px 24px rgba(126, 20, 23, 0.22);
}

.nav-shell .nav-home:hover {
  color: #fff;
  background: var(--red-strong);
}

.menu-button {
  border-color: var(--line);
  background: var(--surface);
}

.menu-button span { background: var(--ink); }

.hero,
.resistor-section { background: var(--paper); }

.hero {
  border-color: var(--line);
  background:
    radial-gradient(circle at 86% 12%, rgba(126, 20, 23, 0.14), transparent 31%),
    var(--paper);
}

.hero h1,
.section-title h2,
.principles h2 { color: #f7f2ee; }

.hero-lead,
.section-summary p,
.form-intro p,
.camera-intro p { color: var(--muted); }

.hero-choice-panel,
.tool-shell {
  border-color: var(--line);
  background: linear-gradient(145deg, rgba(38, 34, 32, 0.9), var(--surface));
  box-shadow: var(--shadow);
}

.choice-card,
.choice-art,
.drop-zone,
.mode-card,
.text-dimension-field,
.accuracy-note,
.supported-box,
.icon-button,
.band-control select {
  border-color: var(--line);
  background: var(--warm);
}

.choice-card:hover,
.mode-card:has(input:checked),
.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: #b94c50;
  background: var(--red-soft);
}

.choice-copy > span,
.choice-note,
.text-dimension-field > small,
.field-row label small,
.camera-tip,
.accuracy-note p { color: var(--muted); }

.choice-card:hover { box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26); }

.tool-section {
  border-color: var(--line);
  background: #181615;
}

.resistor-section { background: var(--paper); }

.tool-index sup {
  border-color: rgba(214, 106, 110, 0.35);
  background: var(--red-soft);
}

.tool-form,
.camera-panel { background: transparent; }

.drop-zone { border-color: #675853; }
.drop-zone.has-file { border-color: rgba(115, 203, 163, 0.5); background: var(--green-soft); }

.upload-icon,
.camera-icon { border-color: var(--line-strong); background: var(--surface); }

.text-dimension-field input,
.field-row input {
  border-color: var(--line-strong);
  color: var(--ink);
  background: #151413;
}

.radio-mark,
.output-fieldset label > span { border-color: var(--line-strong); background: #151413; }
.output-fieldset input:checked + span { box-shadow: inset 0 0 0 3px #151413; }

.advanced-options { border-color: var(--line); }
.advanced-options summary::before { border-color: var(--line-strong); }

.button-ghost,
.icon-button {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.button-ghost:hover:not(:disabled),
.icon-button:hover:not(:disabled) { border-color: #a99b94; background: var(--warm); }

.button-primary { box-shadow: 0 10px 25px rgba(126, 20, 23, 0.28); }

.accuracy-note { background: #1d1a19; }
.resistor-result { border-color: var(--line); background: var(--surface); }
.supported-box li { color: var(--ink-soft); background: #2a2523; }
.scan-confidence > span { background: #39322f; }

.principles {
  border-color: var(--dark-line);
  background: var(--dark);
}

.principle-grid article { background: var(--dark-soft); }

.footer {
  min-height: 0;
  margin-top: 0;
  padding: 0;
  display: block;
  border-top: 1px solid var(--line);
  color: var(--ink);
  background: #0d0d0c;
}

.footer-inner {
  width: min(1320px, calc(100% - 40px));
  max-width: none;
  margin: 0 auto;
  padding: 48px 0 38px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.65fr) minmax(300px, 1.45fr) minmax(120px, 0.7fr);
  gap: 42px;
  align-items: start;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  text-align: left;
}

.footer-home {
  display: inline-flex;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f2ede7;
}

.footer-logo {
  width: auto;
  height: 64px;
  max-width: 190px;
  margin: 0;
}

.footer-brand .footer-logo { margin-bottom: 14px; }

.footer-brand p {
  margin: 0;
  color: var(--muted);
  font: 11px/1.6 var(--mono);
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 17px;
}

.footer-socials a {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.footer-socials a:hover {
  transform: translateY(-2px);
  border-color: #b94c50;
  background: var(--warm);
}

.footer-socials img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
  opacity: 0.84;
}

.footer-column { text-align: left; }

.footer-title {
  margin-bottom: 15px;
  color: #f5efeb;
  font: 700 10px/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-links { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.footer-links a { color: var(--muted); font-size: 11px; }
.footer-links a:hover { color: #fff; padding-left: 4px; }

.footer-location-column { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }

.footer-contact-details {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 14px;
}

.footer-contact-item {
  margin: 0;
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.footer-contact-item strong { color: var(--ink-soft); font: 700 9px var(--mono); letter-spacing: 0.04em; }
.footer-contact-item a { color: var(--ink-soft); }
.footer-contact-item a:hover { color: #fff; }

.footer-origin {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.footer-country { color: var(--muted); font-size: 10px; white-space: nowrap; }
.footer-bbi-logo { width: auto; height: 56px; max-width: 88px; }

.footer-bottom {
  width: min(1320px, calc(100% - 40px));
  max-width: none;
  margin: 0 auto;
  padding: 16px 0 20px;
  border-top: 1px solid var(--dark-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  color: #867b75;
  font: 9px/1.5 var(--mono);
}

.footer-policy-links { display: flex; gap: 18px; }
.footer-policy-link:hover { color: #fff; }

@media (max-width: 980px) {
  .nav-menu { gap: 22px; }
  .nav-primary,
  .nav-actions { gap: 16px; }
  .footer-inner { grid-template-columns: 1fr 0.75fr; gap: 32px 44px; }
  .footer-location-column { grid-column: 1 / -1; }
  .footer-origin { grid-column: 2; grid-row: 1; justify-self: end; }
}

@media (max-width: 850px) {
  .nav-menu {
    top: 78px;
    right: 0;
    left: 0;
    padding: 15px 20px 21px;
    border-color: var(--line);
    background: rgba(17, 17, 16, 0.98);
  }

  .nav-primary,
  .nav-actions { display: grid; gap: 0; }
  .nav-actions { margin-top: 7px; }
  .nav-shell nav a { padding: 12px 0; }
  .nav-shell .nav-home { text-align: center; }

  .footer-inner { width: min(100% - 32px, 720px); }
  .footer-bottom { width: min(100% - 32px, 720px); }
}

@media (max-width: 620px) {
  .nav-shell { width: calc(100% - 28px); }
  .nav-logo img { width: 116px; padding: 6px 8px; }
  .nav-logo-lockup { gap: 8px; }
  .nav-logo-lockup > span { font-size: 8px; letter-spacing: 0.14em; }
  .footer-inner { width: calc(100% - 28px); grid-template-columns: 1fr; gap: 31px; padding: 38px 0 30px; }
  .footer-brand,
  .footer-column,
  .footer-location-column { align-items: center; text-align: center; }
  .footer-links { align-items: center; }
  .footer-origin { grid-column: auto; grid-row: auto; justify-self: auto; }
  .footer-contact-details { grid-template-columns: 1fr; text-align: center; }
  .footer-contact-item { text-align: center; }
  .footer-bottom { width: calc(100% - 28px); justify-content: center; text-align: center; }
  .footer-policy-links { justify-content: center; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Keep the shared brand frame bright while the AI Lab workspace stays dark. */
:root {
  --chrome-frame-max: 1440px;
  --chrome-gutter: clamp(20px, 4vw, 72px);
}

.site-header {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.nav-shell {
  width: 100%;
  max-width: var(--chrome-frame-max);
  min-height: 62px;
  padding: 10px var(--chrome-gutter);
  gap: 18px;
}

.nav-logo-lockup { gap: 10px; }
.nav-logo img {
  width: auto;
  height: 42px;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.nav-logo-lockup > span { color: var(--red); }
.nav-shell nav a { color: #444; font-size: 13px; font-weight: 600; }
.nav-shell nav a:hover { color: var(--red); }
.nav-menu { gap: 18px; }
.nav-primary,
.nav-actions { gap: 20px; }
.nav-primary a[href="/"],
body.page-revpack .nav-primary a[href="/revpack/"],
body.page-countor .nav-primary a[href="/countor/"] { color: var(--red); }
.lang-switcher {
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid rgba(126, 20, 23, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
}
.lang-switcher > span { color: #aaa; font-size: 11px; }
.lang-btn,
.lang-btn.active {
  color: #777 !important;
  padding: 4px 6px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em;
}
.lang-btn:hover { color: var(--red) !important; }
.lang-btn.active { color: #fff !important; background: var(--red); }
.menu-button { border-color: #d8d0ca; background: #fff; }
.menu-button span { background: #1d1b1a; }

.footer {
  min-height: 0;
  margin-top: 56px;
  padding: 0;
  display: block;
  border-top-color: var(--line);
  color: #555;
  background: #fafafa;
}

.footer-inner {
  width: 100%;
  max-width: var(--chrome-frame-max);
  padding: 22px var(--chrome-gutter) 20px;
  grid-template-columns: 1.05fr 0.55fr 1.45fr 1fr;
  gap: 28px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.footer-home { padding: 0; background: transparent; }
.footer-logo { height: 88px; max-width: 240px; }
.footer-brand p { color: #444; font-family: Poppins, sans-serif; font-size: 14px; font-weight: 400; line-height: 1.7; }
.footer-socials { gap: 12px; margin-top: 16px; }
.footer-socials a { border-color: #ded6d0; background: #fff; }
.footer-socials a:hover { border-color: #b94c50; background: #f7f2ee; }
.footer-socials img { width: 17px; height: 17px; filter: none; opacity: 0.78; }
.footer-title { margin-bottom: 12px; color: #000; font-family: Poppins, sans-serif; font-size: 14px; font-weight: 600; text-transform: none; }
.footer-links { gap: 10px; }
.footer-links a { color: #333; font-size: 14px; }
.footer-links a:hover { color: var(--red); }
.footer-contact-item { color: #555; font-size: 12px; line-height: 1.6; }
.footer-contact-item strong { color: #222; font-family: Poppins, sans-serif; font-size: 12px; font-weight: 600; }
.footer-contact-item span { font-size: 11px; line-height: 1.55; }
.footer-contact-item a { color: #222; }
.footer-contact-item a:hover { color: var(--red); }
.footer-contact-details { column-gap: 30px; row-gap: 15px; }
.footer-country { color: #333; font-size: 13px; }
.footer-bottom {
  width: 100%;
  max-width: var(--chrome-frame-max);
  padding: 14px var(--chrome-gutter) 20px;
  border-top: 1px solid var(--line);
  color: #555;
  font-family: Poppins, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
.footer-policy-link:hover { color: var(--red); }

@media (max-width: 850px) {
  .nav-shell nav.nav-menu {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 24px rgba(46, 35, 30, 0.1);
  }
}

@media (max-width: 768px) {
  :root { --chrome-gutter: 16px; }
  .nav-shell { padding: 10px var(--chrome-gutter) 12px; }
  .nav-shell nav a { font-size: 12px; }
  .lang-btn,
  .lang-btn.active { font-size: 12px !important; font-weight: 600 !important; }
  .nav-actions .lang-switcher { padding: 5px 8px; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 20px; padding: 22px var(--chrome-gutter) 18px; }
  .footer-location-column { grid-column: 1; align-items: flex-start; text-align: left; }
  .footer-origin { grid-column: 2; }
}

@media (min-width: 1100px) {
  .footer-inner { column-gap: clamp(28px, 4vw, 64px); }
}

@media (max-width: 620px) {
  .nav-logo img { height: 34px; }
  .nav-shell nav a { font-size: 12px; }
  .nav-shell .nav-home { padding: 8px 12px; }
  .footer-inner { width: 100%; grid-template-columns: 1fr; gap: 24px; padding: 24px var(--chrome-gutter) 20px; }
  .footer-brand,
  .footer-column,
  .footer-location-column { align-items: center; text-align: center; }
  .footer-location-column,
  .footer-origin { grid-column: auto; }
  .footer-contact-details { grid-template-columns: 1fr; text-align: center; }
  .footer-contact-item { text-align: center; }
  .footer-links { align-items: center; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
