@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-wdth-normal.woff2) format('woff2-variations');
}

:root {
  --felt: #16302b;
  --felt-deep: #0b1b18;
  --bench: #eef0ea;
  --bench-2: #e2e6dd;
  --ink: #18211e;
  --ink-2: #56625c;
  --line: #c6cdc1;
  --rouge: #9c2f2a;
  --on-felt: #e6ece4;
  --on-felt-2: #9db3a9;
  --focus: #1f6f8b;
  font-family: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bench); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.app {
  display: grid;
  grid-template-columns: minmax(300px, 372px) 1fr;
  height: 100vh;
  height: 100dvh;
}

/* ---------- the bench: controls ---------- */

.bench {
  overflow-y: auto;
  padding: 22px 22px 40px;
  border-right: 1px solid var(--line);
}
.bench-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
  font-weight: 640;
  font-stretch: 122%;
  letter-spacing: -0.02em;
}
.bench-head p { margin: 8px 0 0; color: var(--ink-2); max-width: 34ch; }

.group { border: 0; margin: 22px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); min-width: 0; }
.group legend {
  float: left; width: 100%; padding: 0; margin: 0 0 10px;
  font-weight: 640; font-stretch: 112%; font-size: 15px;
}
.group legend + * { clear: both; }
.note { margin: 8px 0 0; color: var(--ink-2); font-size: 13px; font-stretch: 94%; }

.weaves { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.weave {
  display: block; text-align: left; cursor: pointer;
  padding: 8px 10px 9px; border: 1px solid var(--line); border-radius: 3px;
  background: transparent;
}
.weave b { display: block; font-weight: 600; font-stretch: 104%; line-height: 1.15; }
.weave small { display: block; margin-top: 2px; font-size: 12px; font-stretch: 88%; color: var(--ink-2); }
.weave:hover { background: var(--bench-2); }
.weave[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--bench); }
.weave[aria-checked="true"] small { color: #b9c4bc; }

.metals { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px; }
.metal {
  display: flex; align-items: center; gap: 9px; cursor: pointer; text-align: left;
  padding: 5px 8px 5px 5px; border: 1px solid transparent; border-radius: 99px; background: transparent;
}
.metal i {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 6%, var(--c) 34%, color-mix(in srgb, var(--c) 62%, #000) 100%);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.18);
}
.metal:hover { background: var(--bench-2); }
.metal[aria-checked="true"] { border-color: var(--ink); background: #fff; }

.row { display: flex; align-items: center; gap: 12px; }
.num {
  width: 5.2em; padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: #fff;
  font-variant-numeric: tabular-nums; font-weight: 560; font-size: 16px;
}
.num-unit { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; }
.slide { flex: 1; min-width: 0; accent-color: var(--ink); height: 28px; }
.readout { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 16px; }
.ends { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; font-stretch: 88%; color: var(--ink-2); }
.link { border: 0; background: none; padding: 0; cursor: pointer; color: var(--rouge); text-decoration: underline; text-underline-offset: 2px; font-size: 12px; }
.link[hidden] { display: none; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--bench); }

#by-thick, #by-weight { margin-top: 12px; }
#by-weight .row { flex-wrap: wrap; }
[hidden] { display: none !important; }
.chip[aria-checked="true"] { border-color: var(--ink); background: var(--ink); color: var(--bench); }
#clasps { margin-top: 0; }
.mouse { margin-left: auto; }
.warn { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--rouge); background: #fff; font-size: 13px; }
.warn .link { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 99px; cursor: pointer;
  padding: 3px 10px; font-size: 13px; font-stretch: 92%;
}
.chip:hover { background: var(--bench-2); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: #fff; }

.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.price { margin-top: 12px; justify-content: space-between; }

/* ---------- the stage: preview and answer ---------- */

.stage { display: grid; grid-template-rows: 1fr auto; min-width: 0; min-height: 0; }
.viewer { position: relative; min-height: 0; background: radial-gradient(120% 90% at 50% 38%, var(--felt) 0%, var(--felt-deep) 100%); overflow: hidden; }
.viewer.paper { background: radial-gradient(120% 90% at 50% 38%, #f3f1ea 0%, #d5d3ca 100%); }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }

.tools { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.tools > * { pointer-events: auto; }
.seg.on-felt, .tool { border-color: rgb(230 236 228 / 0.28); color: var(--on-felt); background: rgb(11 27 24 / 0.55); backdrop-filter: blur(6px); }
.seg.on-felt button + button { border-left-color: rgb(230 236 228 / 0.28); }
.seg.on-felt button[aria-checked="true"] { background: var(--on-felt); color: var(--felt-deep); }
.tool { border: 1px solid rgb(230 236 228 / 0.28); border-radius: 3px; padding: 6px 12px; cursor: pointer; }
.tool[aria-pressed="true"] { background: var(--on-felt); color: var(--felt-deep); }
.tool[hidden] { display: none; }
.paper .seg.on-felt, .paper .tool { color: var(--ink); background: rgb(255 255 255 / 0.6); border-color: rgb(24 33 30 / 0.3); }
.paper .seg.on-felt button + button { border-left-color: rgb(24 33 30 / 0.3); }
.paper .seg.on-felt button[aria-checked="true"], .paper .tool[aria-pressed="true"] { background: var(--ink); color: var(--bench); }

.hint { position: absolute; left: 12px; bottom: 10px; margin: 0; padding: 3px 8px; border-radius: 3px; background: rgb(11 27 24 / 0.6); font-size: 12.5px; font-stretch: 92%; color: var(--on-felt-2); pointer-events: none; }
.paper .hint { color: var(--ink-2); background: rgb(255 255 255 / 0.6); }
.fail { position: absolute; inset: auto 0 18%; margin: auto; font-size: 17px; font-weight: 560; text-shadow: 0 1px 8px rgb(0 0 0 / 0.6); height: fit-content; max-width: 44ch; padding: 0 20px; text-align: center; color: var(--on-felt); }

.spec { background: #fff; border-top: 1px solid var(--line); padding: 16px 22px 14px; }
.answer { display: flex; align-items: flex-end; gap: 36px; flex-wrap: wrap; }
.fig { display: grid; }
.fig-label { font-weight: 600; font-stretch: 104%; color: var(--ink-2); }
.fig-value { font-size: 20px; font-stretch: 100%; color: var(--ink-2); line-height: 1.05; white-space: nowrap; }
.fig-value b { font-size: 52px; font-weight: 620; font-stretch: 118%; letter-spacing: -0.03em; color: var(--rouge); font-variant-numeric: tabular-nums; }
.fig-sub { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ring-dia { width: 92px; height: 92px; margin-left: auto; flex: none; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px 22px; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.facts div { min-width: 0; }
.facts dt { font-size: 12.5px; font-stretch: 90%; color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 16px; }
.facts dd small { font-weight: 400; font-size: 12.5px; color: var(--ink-2); }
.spec-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 10px; }
.spec-foot .note { margin: 0; max-width: 78ch; }
.btn { flex: none; border: 1px solid var(--ink); background: var(--ink); color: var(--bench); border-radius: 3px; padding: 7px 14px; cursor: pointer; font-weight: 560; }
.btn:hover { background: #000; }

@media (max-width: 860px) {
  .app { display: flex; flex-direction: column; height: auto; }
  .stage { order: -1; display: block; }
  .viewer { height: 58vh; min-height: 300px; max-height: 560px; }
  .bench { border-right: 0; overflow: visible; }
  .fig-value b { font-size: 40px; }
  .answer { gap: 18px 28px; }
  .ring-dia { width: 72px; height: 72px; }
  .hint { display: none; }
}

.paper .fail { color: var(--ink); text-shadow: none; }
