/* TRUCK Gloves theme, matched to truckgloves.com: clean white, Oswald
   headings, Poppins body, dark buttons, rust and lime accents. */
:root {
  --bg: #ffffff;
  --surface: #f6f6f4;
  --border: #e5e5e5;
  --text: #5c5c5c;
  --head: #171717;
  --btn: #232323;
  --rust: #c16452;
  --lime: #b4cc24;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 "Poppins", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* ---------- Header ---------- */

.topbar {
  display: flex;
  justify-content: center;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border);
}
.brand img { display: block; height: 30px; width: auto; }
/* More room for the photo while taking and marking it */
body[data-screen="camera"] .announce,
body[data-screen="measure"] .announce { display: none; }
body[data-screen="camera"] #app,
body[data-screen="measure"] #app { padding-top: 16px; }

.announce {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--head);
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 16px calc(32px + env(safe-area-inset-bottom));
}

/* ---------- Type ---------- */

h1, h2, .eyebrow, .size-badge {
  font-family: "Oswald", Impact, sans-serif;
  font-weight: 700;
  color: var(--head);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
h1 { font-size: 2.6rem; line-height: 1.05; margin: 0 0 12px; text-align: center; }
h2 { font-size: 1.35rem; line-height: 1.2; margin: 32px 0 14px; }
.lead { margin: 0; text-align: center; font-size: 1.05rem; }

/* ---------- Reference choices ---------- */

.choices { display: grid; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--head);
  font: 500 1rem/1.35 "Poppins", sans-serif;
  text-align: left;
  cursor: pointer;
}
.choice[aria-pressed="true"] {
  border-color: var(--head);
  box-shadow: inset 0 0 0 1px var(--head);
}
.choice .icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--surface);
  color: var(--head);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}
.choice[aria-pressed="true"] .icon { background: var(--lime); }
.choice small { display: block; font-weight: 400; font-size: 0.85rem; color: var(--text); }

/* ---------- Photo tips ---------- */

/* Photo checklist: full-width black block with lime icon tiles */
.checklist {
  position: relative;
  overflow: hidden;
  margin: 36px -16px 0;
  padding: 30px 20px 10px;
  background: var(--head);
  color: #c9c9c9;
}
/* Large faint TRUCK "A" mark in the corner */
.checklist::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -30px;
  width: 220px;
  height: 220px;
  background: url("assets/apple-touch-icon.png") center / contain no-repeat;
  filter: invert(1);
  opacity: 0.06;
  pointer-events: none;
}
.checklist h2 { margin: 0 0 22px; color: #fff; }
.steps { position: relative; z-index: 1; padding: 0; margin: 0; list-style: none; }
.steps li { display: flex; gap: 16px; margin-bottom: 22px; }
.steps p { margin: 0; }
.steps strong { color: #fff; font-weight: 600; }
.step-num {
  display: block;
  margin-bottom: 2px;
  font: 700 0.95rem/1.2 "Oswald", sans-serif;
  letter-spacing: 0.08em;
  color: var(--lime);
}
.step-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  background: var(--lime);
  color: var(--head);
  /* angled corner, like the cut on the TRUCK "A" */
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}
.step-icon svg, .choice .icon svg, .share-btn svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Buttons ---------- */

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 18px;
  border: 1px solid var(--btn);
  border-radius: 3px;
  background: var(--bg);
  color: var(--btn);
  font: 500 0.95rem/1.2 "Poppins", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn.primary { background: var(--btn); color: #fff; }
.btn.primary:active, .btn.primary:hover { background: var(--rust); border-color: var(--rust); }
.btn:not(.primary):active { background: var(--surface); }
.btn.ghost { border-color: var(--border); }
.file-btn { width: 100%; margin-top: 28px; }
.file-btn input { display: none; }

.actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- Measuring ---------- */

.step-count {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
}
.step-header h2 { margin: 6px 0 6px; }
.step-header p { margin: 0 0 16px; }
.step-header strong { color: var(--head); font-weight: 600; }

.canvas-wrap {
  position: relative;
  overflow: hidden;
  background: #111;
  border-radius: 3px;
  touch-action: none;
}
#canvas { display: block; width: 100%; }
#loupe {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* ---------- Camera ---------- */

.camera-wrap {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: #111;
  border-radius: 3px;
  aspect-ratio: 3 / 4;
}
#camera-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.camera-frame {
  position: absolute;
  inset: 6% 12%;
  border: 3px dashed rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  pointer-events: none;
  transition: border-color 0.2s;
}
.camera-wrap.is-level .camera-frame { border-style: solid; border-color: var(--lime); }
.frame-label {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  white-space: nowrap;
  border-radius: 0 0 6px 6px;
}
/* Line to put the middle finger and card on, so both measurements run
   straight up the photo */
.center-line {
  position: absolute;
  top: 12%;
  bottom: 12%;
  left: 50%;
  border-left: 2px dashed rgba(255, 255, 255, 0.7);
}
.center-label {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  white-space: nowrap;
  border-radius: 4px;
}
.capture-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  overflow: hidden;
  border-radius: 0 0 9px 9px;
}
#capture-progress {
  display: block;
  height: 100%;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left;
}
.level {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.2);
  pointer-events: none;
}
.level::before {
  /* target circle the bubble should sit in */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
}
.level-bubble {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.countdown {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font: 700 6rem/1 "Oswald", sans-serif;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.camera-wrap.counting .level { opacity: 0.25; }
.camera-wrap.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  animation: flash 0.35s ease-out forwards;
  pointer-events: none;
}
@keyframes flash {
  from { opacity: 0.9; }
  to { opacity: 0; }
}
.camera-wrap.is-level .level { border-color: var(--lime); }
.camera-wrap.is-level .level-bubble { background: var(--lime); }
.camera-status { margin: 12px 0 0; text-align: center; color: var(--head); font-weight: 500; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.text-link {
  display: block;
  margin-top: 14px;
  text-align: center;
  color: var(--head);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.text-link input { display: none; }
.privacy { margin: 10px 0 0; text-align: center; font-size: 0.85rem; }

/* ---------- Zoom ---------- */

.zoom-reset {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 10px;
  border: 0;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font: 500 0.75rem/1 "Poppins", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}
.zoom-hint { margin: 8px 0 0; text-align: center; font-size: 0.8rem; }

/* ---------- Result ---------- */

.result-head { text-align: center; }
.eyebrow {
  margin: 0 0 14px;
  font: 500 0.85rem/1.2 "Poppins", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.size-badge {
  display: inline-block;
  min-width: 120px;
  padding: 6px 28px;
  background: var(--head);
  color: #fff;
  font-size: 4.5rem;
  line-height: 1.1;
  border-radius: 3px;
}
.size-letter {
  margin: 10px 0 0;
  font: 700 1.6rem/1 "Oswald", sans-serif;
  letter-spacing: 0.06em;
  color: var(--head);
}
.measured { margin: 14px 0 0; color: var(--head); font-weight: 500; }

/* Size chart */
.chart { margin-top: 36px; }
.chart-title { margin: 0 0 22px; text-align: center; }

.ruler { position: relative; height: 76px; margin: 0 14px 22px; }
.ruler-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 26px;
  height: 10px;
  border-radius: 5px;
  background: var(--lime);
}
.tick {
  position: absolute;
  top: 22px;
  width: 2px;
  height: 18px;
  margin-left: -1px;
  background: rgba(23, 23, 23, 0.35);
}
.tick-label {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  font: 500 0.85rem/1 "Oswald", sans-serif;
  color: var(--text);
}
.tick.is-match { background: var(--head); }
.tick-label small {
  display: block;
  margin-top: 3px;
  font: 500 0.6rem/1 "Poppins", sans-serif;
  letter-spacing: 0.04em;
  color: var(--text);
}
.tick.is-match .tick-label, .tick.is-match .tick-label small { color: var(--head); font-weight: 700; }
.pin {
  position: absolute;
  top: 0;
  width: 0;
  height: 36px;
  border-left: 3px solid var(--rust);
  margin-left: -1.5px;
}
.pin::after {
  content: "";
  position: absolute;
  left: -7.5px;
  bottom: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--rust);
  border: 2px solid #fff;
}
.pin-label {
  position: absolute;
  top: -4px;
  left: 6px;
  font: 600 0.7rem/1 "Poppins", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
}

.size-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 2px solid var(--head);
  border-bottom: 2px solid var(--head);
}
.size-table th {
  padding: 12px 14px;
  font: 600 0.75rem/1.2 "Poppins", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--head);
  text-align: left;
  border-bottom: 1px solid var(--head);
}
.size-table th:last-child, .size-table td:last-child { text-align: right; }
.size-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--head);
}
.size-table tr:last-child td { border-bottom: 0; }
.row-size { font: 500 1.35rem/1 "Oswald", sans-serif; display: inline-block; min-width: 2ch; }
.row-letter {
  display: inline-block;
  margin-left: 10px;
  font: 500 0.85rem/1 "Poppins", sans-serif;
  letter-spacing: 0.04em;
  color: var(--text);
}
.size-table tr.is-match .row-letter { color: #fff; }
.size-table .mm { color: var(--text); }
.size-table td:last-child { white-space: nowrap; vertical-align: top; padding-top: 14px; }
.size-table td:first-child { vertical-align: top; }
.size-table tr.is-match td { background: var(--head); color: #fff; border-bottom-color: var(--head); }
.size-table tr.is-match .mm { color: #c9c9c9; }
.your-size {
  display: block;
  width: fit-content;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--lime);
  color: var(--head);
  font: 600 0.65rem/1.2 "Poppins", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: middle;
}
.chart-caption { margin: 12px 0 0; font-size: 0.85rem; text-align: center; }

.note {
  margin: 22px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--rust);
  background: var(--surface);
  color: var(--head);
}
.disclaimer { font-size: 0.85rem; }

/* ---------- Sharing ---------- */

.gift {
  display: flex;
  gap: 14px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--lime);
  border-radius: 3px;
}
.gift p { margin: 0 0 12px; font-size: 0.9rem; }
.gift .gift-title {
  margin: 0 0 2px;
  font: 700 1.15rem/1.2 "Oswald", sans-serif;
  text-transform: uppercase;
  color: var(--head);
}
.share-btn { gap: 10px; }
.share-btn svg { width: 20px; height: 20px; }
.gift .share-btn { width: auto; min-height: 44px; padding: 10px 16px; font-size: 0.8rem; }

.share-result { margin-top: 24px; text-align: center; }
.share-result .share-btn { width: 100%; }
button.text-link {
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  background: var(--head);
  color: #fff;
  border-radius: 3px;
  font-size: 0.9rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

/* ---------- Shop links on the result ---------- */

.shop {
  margin: 28px -16px 0;
  padding: 24px 20px;
  background: var(--head);
  text-align: center;
}
.shop-title {
  margin: 0 0 14px;
  font: 700 1.35rem/1.2 "Oswald", sans-serif;
  text-transform: uppercase;
  color: #fff;
}
.shop .shop-all {
  width: 100%;
  background: var(--lime);
  border-color: var(--lime);
  color: var(--head);
  text-decoration: none;
}
.shop-links { display: flex; gap: 8px; margin-top: 10px; }
.shop-links a {
  flex: 1;
  padding: 12px 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  color: #fff;
  font: 500 0.85rem/1 "Poppins", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}
