:root {
  --bg: #131210;
  --bg-2: #1a1815;
  --panel: #211e1a;
  --panel-2: #2a2621;
  --line: #3d382f;
  --text: #f3eee6;
  --muted: #9a9286;
  --brass: #c4a15a;
  --brass-dim: #8a703c;
  --ok: #8fad6e;
  --pad-x: 16px;
  --thumb: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Barlow", "Segoe UI", sans-serif;
  --cond: "Barlow Condensed", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

.app {
  width: min(480px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--pad-x);
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}
html[data-hand="left"] .topbar { flex-direction: row-reverse; }

.icon-btn {
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  place-items: center;
  flex: 0 0 var(--thumb);
}
.icon-btn svg { width: 22px; height: 22px; }

.topbar h1 {
  margin: 0;
  flex: 1;
  font-family: var(--cond);
  font-size: clamp(17px, 4.8vw, 22px);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.1;
}
html[data-hand="left"] .topbar h1 { text-align: right; }

.hand-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.page {
  flex: 1;
  padding: 16px var(--pad-x) calc(24px + var(--safe-b));
}
.page.pad-keys { padding-bottom: 300px; }

.lede {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  background: #0c0b09;
  display: block;
}
.brand small {
  color: var(--brass);
  font-size: 12px;
  letter-spacing: 0.01em;
  font-weight: 600;
  line-height: 1.25;
  text-transform: none;
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 168px;
  padding: 0 0 12px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
  overflow: hidden;
}
.tile.soon {
  opacity: 0.55;
  pointer-events: none;
}
.tile .art {
  height: 108px;
  background: #0c0b09;
}
.tile .art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile strong {
  display: block;
  margin-top: 10px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
}
.tile span {
  color: var(--muted);
  font-size: 12px;
  padding: 0 12px;
}

.section-label {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.pills {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  overflow-x: auto;
}
.pills.wrap {
  flex-wrap: wrap;
  overflow: visible;
}
.pill {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 auto;
}
.pill.active {
  background: var(--brass);
  border-color: var(--brass);
  color: #1a160f;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  padding: 3px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.tab.active {
  background: var(--brass);
  border-color: var(--brass);
  color: #1a160f;
}

.chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.chips.tight {
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.chips.tight .chip {
  height: 44px;
  font-size: 16px;
  border-radius: 12px;
}
.chip {
  height: var(--thumb);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--cond);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.chip.active {
  background: var(--brass);
  border-color: var(--brass);
  color: #1a160f;
}

.results { display: flex; flex-direction: column; gap: 10px; }

.card {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.card .code {
  font-family: var(--cond);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}
.card .dims {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.metric {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.metric b {
  display: block;
  font-family: var(--cond);
  font-size: 22px;
  font-weight: 700;
}
.metric small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sibling {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
}
.sibling .code { font-family: var(--cond); font-size: 22px; color: var(--text); }
.sibling em { font-style: normal; font-size: 12px; }

.sheet-wrap {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 40;
}
.sheet-wrap.open { display: block; }
.sheet-wrap .dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  transform: translateX(-50%);
  max-height: 92dvh;
  overflow: auto;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 12px var(--pad-x) calc(20px + var(--safe-b));
}
.grab {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  margin: 4px auto 14px;
}
.sheet .code {
  font-family: var(--cond);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}
.sheet .sub {
  color: var(--muted);
  margin: 4px 0 12px;
  font-size: 14px;
}

.schematic {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  margin: 8px 0 14px;
}
.page > .schematic { margin: 0 0 16px; }
.schematic svg {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 360 / 176;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.spec-table th,
.spec-table td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.spec-table th {
  color: var(--muted);
  font-weight: 500;
  width: 58%;
}
.spec-table td {
  font-family: var(--mono);
  text-align: right;
}

.suffixes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.suffix {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 600;
}
.suffix.active {
  background: var(--brass);
  border-color: var(--brass);
  color: #1a160f;
}

.cta-row {
  display: flex;
  gap: 8px;
}
html[data-hand="right"] .cta-row { flex-direction: row-reverse; }
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  min-height: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--brass);
  color: #1a160f;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
.cta.ghost {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.list-bar {
  display: block;
  width: 100%;
  flex-shrink: 0;
  padding: 10px var(--pad-x) calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.list-bar .cta {
  display: flex;
  width: 100%;
  min-height: 52px;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.qty-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 22px;
  font-weight: 700;
  flex: 0 0 44px;
}
.qty-row .qty {
  flex: 1;
  text-align: center;
  font-family: var(--cond);
  font-size: 24px;
  font-weight: 700;
}
.qty-row .drop {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.totals {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.totals .big {
  font-family: var(--cond);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}
.totals .muted { color: var(--muted); margin-top: 6px; font-size: 14px; }

.confirm-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}
.confirm-wrap.open { display: block; }
.confirm-wrap .dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.confirm-box {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  transform: translateX(-50%);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 22px var(--pad-x) calc(20px + var(--safe-b));
}
.confirm-box h2 {
  margin: 0 0 8px;
  font-family: var(--cond);
  font-size: 26px;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.note a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.hint { color: var(--brass-dim); font-size: 13px; margin: 0 0 16px; }

.field + .chips { margin-top: 8px; }
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 12px;
}
.field {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 56px;
  padding: 10px 14px;
  margin: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}
.field.active {
  border-color: var(--brass);
  background: var(--panel-2);
}
.field-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 36px;
}
.field .label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  flex: 0 1 auto;
}
.field .val {
  display: inline;
  font-family: var(--cond);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
.field .unit {
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
}

.keypad-wrap {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  transform: translateX(-50%);
  z-index: 50;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 12px var(--pad-x) calc(16px + var(--safe-b));
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.35);
}
.keypad-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.keypad-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.keypad-head b {
  font-family: var(--cond);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}
.keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.keys button {
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--cond);
  font-size: 24px;
  font-weight: 700;
}
.keys .muted {
  color: var(--muted);
  font-size: 18px;
  font-family: var(--font);
}
.keys .ok {
  grid-column: span 2;
  background: var(--brass);
  border-color: var(--brass);
  color: #1a160f;
  font-family: var(--font);
  font-size: 16px;
}

.pwa-install {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  z-index: 50;
  padding: 14px var(--pad-x) calc(14px + var(--safe-b));
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.35);
}
.pwa-install p {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
}
.pwa-install .cta-row { width: 100%; }
.pwa-install .cta { width: 100%; }
body.pwa-banner-on .app { padding-bottom: 140px; }

.prose h2 {
  margin: 22px 0 8px;
  font-family: var(--cond);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brass);
}
.prose h2:first-child { margin-top: 0; }
.prose p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}
.prose a {
  color: var(--brass);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.disclaimer {
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.disclaimer h2 { margin-top: 0; }

.mail-box {
  display: grid;
  gap: 10px;
  margin: 4px 0 20px;
}
.mail-box .addr {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--brass);
  word-break: break-all;
}
.mail-box .cta {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.site-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.site-foot nav,
.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
html[data-hand="left"] .site-foot nav,
html[data-hand="left"] .foot-nav { flex-direction: row-reverse; }
.site-foot nav a,
.foot-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--brass);
  color: var(--brass);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.site-foot .note { margin: 0; }
.site-foot .note a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
