:root {
  --bg: #070B14;
  --panel: #0C1220;
  --card: #111A2E;
  --line: #1E2A44;
  --input: #111A2E;
  --input-line: #334155;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --accent: #2B9FD3;
  --accent-soft: #5CC4F0;
  --danger: #F87171;
  --ok: #4ADE80;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--accent-soft); }
[hidden] { display: none !important; }
main { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }
h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.15; margin: 8px 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(7, 11, 20, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.brand span { color: var(--accent-soft); }
.cart-btn {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center;
}
.badge {
  min-width: 22px; height: 22px; border-radius: 999px; padding: 0 6px;
  background: var(--accent); color: #fff; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* hero */
.hero { padding: 32px 0 20px; max-width: 720px; }
.eyebrow { color: var(--accent-soft); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 600; margin: 0; }
.lede { color: var(--muted); margin: 0 0 16px; }
.facts { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.key { color: var(--muted); font-size: 13px; margin: 0; }
.key b { color: var(--text); }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.card.soldout { opacity: 0.55; }
.card h3 { margin: 0; font-size: 16px; }
.card .size { color: var(--muted); font-size: 13px; }
.tests { display: flex; gap: 4px; flex-wrap: wrap; }
.tests span {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px;
  background: rgba(43, 159, 211, 0.12); color: var(--accent-soft); border: 1px solid rgba(43, 159, 211, 0.3);
}
.price { font-size: 20px; font-weight: 700; color: var(--accent-soft); }
.stock { font-size: 12px; color: var(--muted); }
.stock.low { color: #FBBF24; }
.card-controls { display: flex; gap: 8px; margin-top: auto; }
.card select { flex: 1; }
.coa { font-size: 12px; }

/* inputs and buttons */
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--input); border: 1px solid var(--input-line); border-radius: 8px;
  padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43, 159, 211, 0.35); }
input[type="radio"], input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 10px 16px; border: 1px solid transparent;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--input-line); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
.icon-btn { font-size: 26px; line-height: 1; background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.link-back { background: none; border: none; color: var(--accent-soft); font: inherit; cursor: pointer; padding: 20px 0 0; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(420px, 100%); background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 16px; }
.drawer-foot { padding: 16px; border-top: 1px solid var(--line); }
.drawer-total { display: flex; justify-content: space-between; font-size: 16px; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: none; }
.line .name { font-weight: 600; }
.line .sub { color: var(--muted); font-size: 13px; }
.line .amt { text-align: right; font-weight: 600; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--input-line); border-radius: 8px; overflow: hidden; }
.qty button { background: none; border: none; color: var(--text); font: inherit; width: 30px; height: 30px; cursor: pointer; }
.qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.qty span { min-width: 26px; text-align: center; }
.remove { background: none; border: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; justify-self: end; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* checkout */
.checkout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 500; }
label input, label select, label textarea { margin-top: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.three { grid-template-columns: 1.4fr 1.2fr 0.9fr; }
.trap { position: absolute; left: -9999px; }
.pay-option {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer;
}
.pay-option:has(input:checked) { border-color: var(--accent); background: rgba(43, 159, 211, 0.08); }
.pay-option small { color: var(--muted); }
.tag { font-style: normal; font-size: 11px; font-weight: 600; background: rgba(74, 222, 128, 0.15); color: var(--ok); padding: 1px 6px; border-radius: 4px; }
.member { margin-top: 4px; }
.member-row { display: flex; gap: 8px; }
.member-row input { flex: 1; }
#memberMsg.ok { color: var(--ok); }
#memberMsg.bad { color: var(--danger); }
.terms { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.terms summary { cursor: pointer; font-weight: 600; color: var(--accent-soft); }
.terms h3 { font-size: 13px; margin: 14px 0 4px; }
.terms ul { margin: 0; padding-left: 18px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.error { color: var(--danger); background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.35); border-radius: 8px; padding: 10px 12px; }
.summary { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 80px; }
.totals { margin: 12px 0 0; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 17px; font-weight: 700; }
.totals .grand dt { color: var(--text); }

/* done */
.done { max-width: 620px; padding-top: 32px; }
.pay-box { background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); padding: 18px; margin: 20px 0; }
.pay-box dl { margin: 0; }
.pay-box dl div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; padding: 6px 0; align-items: center; }
.pay-box dt { color: var(--muted); }
.pay-box dd { margin: 0; font-weight: 600; }
.pay-box code { word-break: break-all; font-size: 13px; background: var(--card); padding: 2px 6px; border-radius: 4px; }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; padding: 20px 16px; }
.foot p { margin: 4px 0; }

@media (max-width: 820px) {
  .checkout { grid-template-columns: 1fr; }
  .summary { position: static; order: -1; }
  .row, .row.three { grid-template-columns: 1fr; }
}
