@font-face { font-family: Michroma; font-display: swap; src: url(michroma.woff2) format('woff2'); }
:root {
  --bg: #f4f5f7; --fg: #16181d; --muted: #646a73; --line: #e2e4e9; --card: #fff; --soft: #eef2fb;
  --accent: #2a6fdb; --accent-fg: #fff; --gold: #ffd60a; --ok: #1f9d55; --err: #c62828; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0f1115; --fg: #e9ebef; --muted: #9aa1ab; --line: #262a31; --card: #171a20; --soft: #1b2232; --accent: #6ea0ff; --accent-fg: #0b1220; --ok: #4cd97b; --err: #ff8a80; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.banner { background: var(--gold); color: #1d1d1b; text-align: center; padding: 8px 16px; font-size: .88rem; font-weight: 500; }
header.hero, main, footer { max-width: 1060px; margin: 0 auto; padding: 0 16px; }
header.hero { padding-top: 22px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { flex: none; border-radius: 12px; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 6px; letter-spacing: -.005em; }
h2.inline { display: inline; }
h3 { font-size: 1rem; margin: 2px 0 8px; display: flex; align-items: center; gap: 8px; }
.sub { color: var(--muted); margin: 2px 0 0; }
.note { color: var(--muted); font-size: .9rem; margin: 4px 0; }
.why { margin: 12px 0 0; }
.why p { font-size: .95rem; margin: 8px 0; max-width: 75ch; }
summary { cursor: pointer; color: var(--muted); }
summary::marker { color: var(--accent); }
details { margin: 8px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 16px 0; box-shadow: var(--shadow); }
.card > details > summary { color: var(--fg); }
.step { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.n { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-size: .8em; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 10px 0; }
button, .file { font: inherit; font-size: .95rem; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .file:hover { border-color: var(--accent); }
button.primary, .file.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .45; cursor: default; }
.file input { display: none; }
input[type=number], input[type=text], select { font: inherit; font-size: .95rem; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
input[type=number] { width: 6.5em; }
/* the setup guide */
.guide { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.guide figure { margin: 0; background: var(--soft); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.guide svg { display: block; width: 100%; height: auto; }
.guide figcaption { padding: 10px 12px 12px; font-size: .88rem; }
.guide figcaption b { display: block; font-size: .95rem; margin-bottom: 2px; }
.guide .t { font: 600 10px system-ui, sans-serif; fill: #1d1d1b; }
.guide .t.g { fill: #1f7a3f; } .guide .t.r { fill: #b3261e; } .guide .t.b { fill: #2a6fdb; font-size: 14px; } .guide .t.w { fill: #fff; }
.slide { animation: slide 4s ease-in-out infinite alternate; }
@keyframes slide { from { transform: translateX(8px); } to { transform: translateX(188px); } }
@media (prefers-reduced-motion: reduce) { .slide { animation: none; transform: translateX(98px); } }
/* the four measurements */
.slotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.slot { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.slot.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.slot .head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.slot .skate { width: 34px; height: 22px; flex: none; }
.slot .state { font-size: .85rem; color: var(--muted); min-height: 2.4em; }
.slot .state.done { color: var(--ok); }
.slot .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.slot .acts button, .slot .acts .file { padding: 6px 10px; font-size: .88rem; }
.slot label.ang { font-size: .88rem; display: flex; align-items: center; gap: 6px; }
.slot label.ang input { width: 5em; padding: 4px 6px; }
/* pictures and charts */
.canvasbox canvas { width: 100%; height: auto; display: block; border-radius: 8px; touch-action: manipulation; }
.scrollbox { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.scrollbox canvas { display: block; touch-action: manipulation; }
#preview { max-height: 72vh; width: auto; max-width: 100%; margin: 0 auto; cursor: crosshair; }
#overview { cursor: crosshair; }
#aphoto { max-height: 70vh; width: auto; max-width: 100%; margin: 0 auto; cursor: crosshair; }
.livebox canvas { width: 100%; height: auto; display: block; margin-top: 8px; border-radius: 8px; background: #000; }
.bar { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
#barfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #8fb5ff); transition: width .2s; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; margin-top: 8px; font-size: .93rem; }
th, td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
th:first-child, td:first-child { text-align: left; }
.dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; vertical-align: middle; }
.dot.rear { background: #ff3b30; } .dot.front { background: #ff9500; }
.combo h3 { margin-top: 14px; }
.error { color: var(--err); font-weight: 600; }
footer { color: var(--muted); font-size: .85rem; padding: 10px 16px 30px; display: flex; align-items: center; gap: 8px; }
@media (max-width: 600px) { h1 { font-size: 1.4rem; } .card { padding: 14px; border-radius: 12px; } }
.guide .tag { font: 700 9px system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 3px; letter-spacing: .04em; text-transform: uppercase; }
.guide .t.m { fill: #555; }
@keyframes slide { from { transform: translateX(20px); } to { transform: translateX(220px); } }
.row.blade { background: var(--soft); border-radius: 10px; padding: 8px 12px; }
.row.blade input { width: 5.5em; }
#edgeview { max-width: none; }
.combo canvas { width: 100%; display: block; margin: 6px 0; }
.mark { width: 52px; height: 52px; flex: none; color: var(--fg); }
.mark.small { width: 20px; height: 20px; }
.slot.quick { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 18px; background: var(--soft); }
.slot.quick .state { min-height: 0; }
.mark { width: 84px; height: 55px; }
.mark.small { width: 24px; height: 16px; }
h1.wordmark { font: 600 2rem/1 "Cormorant Garamond", Garamond, Georgia, serif; letter-spacing: .1em; text-transform: uppercase; }
h1.wordmark b { font-weight: 600; }
h1.wordmark span { color: var(--muted); }
/* the angle's quick buttons, the camera's controls, the draggable lines, the recording button, the calibration */
.slot .ang { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .88rem; }
.slot .ang input { width: 4.2em; }
.slot .ang button { padding: 2px 8px; font-size: .82rem; }
.slotgrid.cal { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-top: 8px; }
canvas.drag { touch-action: pan-y; cursor: ew-resize; }
.camctl { gap: 10px 16px; }
.camctl input[type=range] { width: 160px; vertical-align: middle; }
#go.rec { background: #d93025; border-color: #d93025; color: #fff; }
.c-rear { color: #ff3b30; } .c-front { color: #ff9500; } .c-cup { color: #2a6fdb; } .c-mark { color: #af52de; }
.slide.short { animation-name: slideshort; }
@keyframes slideshort { from { transform: translateX(0); } to { transform: translateX(150px); } }
@media (prefers-reduced-motion: reduce) { .slide.short { transform: translateX(70px); } }
/* the four scans as tabs in one row; the open one's panel below */
[hidden] { display: none !important; }
.grow { flex: 1; }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0 0; }
.tab { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 10px 10px 0 0; border: 1px solid var(--line); border-bottom-width: 3px; background: var(--card); color: var(--fg); cursor: pointer; min-width: 0; }
.tab .tk { display: flex; align-items: center; gap: 6px; font-weight: 650; white-space: nowrap; }
.tab .tk .skate { width: 26px; height: 17px; }
.tab .ts, .tab .st { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab.done .st { color: var(--ok); }
.tab.open { border-color: var(--accent); background: var(--soft); }
.tabpanel { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; padding: 10px 12px; margin-bottom: 14px; min-height: 8px; }
.tabpanel:empty { padding: 0; border: 0; }
@media (max-width: 640px) { .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.guide.three { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
ol.steps { margin: 14px 0 4px; padding-left: 22px; font-size: .92rem; }
ol.steps li { margin: 4px 0; }
.row.sel { gap: 10px 14px; background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.row.sel input[type=number] { width: 4.5em; }
/* ---------------------------------------------------------------- mobile first: one column, big targets */
header.hero, main, footer { max-width: 760px; padding: 0 12px; }
.card { padding: 14px; margin: 12px 0; }
header.hero { padding-top: 14px; }
h1.wordmark { font-size: 1.55rem; }
.sub { font-size: .92rem; }
button, .file { min-height: 44px; }
.file.big { width: 100%; justify-content: center; font-size: 1.1rem; padding: 14px; margin: 8px 0 2px; }
.guide.three { grid-template-columns: 1fr; }
@media (min-width: 640px) { .guide.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* a new scan: its picture, the question, four big buttons (2 × 2) */
.newscan { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 10px 0; background: var(--soft); }
.newscan .q { font-weight: 650; margin: 8px 0 6px; }
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pl { justify-content: flex-start; gap: 8px; text-align: left; line-height: 1.25; }
.pl .skate { width: 30px; height: 20px; flex: none; }
.places .pl { min-height: 56px; }
.row.small button { min-height: 36px; font-size: .85rem; padding: 6px 10px; }
.thumb { display: block; width: 100%; height: 64px; object-fit: cover; object-position: center 45%; border-radius: 8px; background: #111; }
.thumb.empty { display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
/* the skates: a card each (side by side when there is room), two sides each */
.skates { display: grid; grid-template-columns: 1fr; gap: 12px; }
.skatecard { border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.skatecard h3 { margin: 0 0 8px; }
.skatecard h3 .skate { width: 32px; height: 21px; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side { flex-direction: column; align-items: stretch; gap: 4px; padding: 8px; text-align: left; min-height: 92px; }
.side .sl { font-weight: 650; }
.side .st { font-size: .8rem; color: var(--muted); }
.side.done .st { color: var(--ok); }
.side.open { border-color: var(--accent); background: var(--soft); }
.side .thumb { height: 44px; }
.skatecard .detail:not(:empty) { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.skatecard h4 { margin: 14px 0 4px; font-size: .95rem; }
.edgebox { max-height: 260px; }
.edgebox canvas { height: 220px; width: auto; }
.row.acts input { width: 4.5em; }
/* settings: label left, control right; stacked on a phone */
.form { display: grid; gap: 8px; margin: 10px 0; }
.form > label { display: grid; grid-template-columns: 9em 1fr; align-items: center; gap: 8px; font-size: .92rem; }
.form > label > span { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); }
@media (max-width: 420px) { .form > label { grid-template-columns: 1fr; gap: 2px; } }
/* the measuring steps, full width */
.work .row { gap: 8px; }
canvas#preview, canvas#live { width: 100%; height: auto; }
/* a wide picture scrolls in its own box: the cards and grids never grow past the screen */
.skates { grid-template-columns: minmax(0, 1fr); }
.skatecard, .sides > *, .newscan, .detail, .card { min-width: 0; }
.sides { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.places { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.scrollbox { max-width: 100%; }
.row.acts select { max-width: 11em; }
main { overflow-x: hidden; }

.icectl { display: grid; gap: 6px; margin: 4px 0 10px; padding: 10px; border-radius: 10px; background: var(--soft); }
.icectl label { display: grid; grid-template-columns: 7.5em 1fr auto; align-items: center; gap: 8px; font-size: .92rem; }
.icectl input[type=range] { width: 100%; }
.icectl b { min-width: 6.5em; text-align: right; font-weight: 600; font-size: .88rem; }
.icectl input[type=number] { width: 5em; }
.msg { padding: 8px 10px; border-radius: 8px; background: var(--soft); }

/* the mark and the wordmark (Michroma) */
:root { --sky: #3aa8e6; }
.mark { width: 74px; height: 62px; color: var(--fg); }
.mark.small { width: 22px; height: 18px; }
h1.wordmark { font: 400 1.32rem/1.1 Michroma, "Segoe UI", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
h1.wordmark b, h1.wordmark span { font-weight: 400; color: inherit; }

/* the stitch checked against the ruler */
#verdict.ok { color: #34c759; }
#verdict.bad { color: #ff453a; font-weight: 600; }
#verdict.warn { color: #ff9f0a; }

/* ================================================================ the app shell: four views, a workboard each */
body.app { min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brandmini { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; }
.brandmini .wordmark { font: 400 .95rem/1 Michroma, "Segoe UI", sans-serif; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.views { display: flex; gap: 4px; margin-left: auto; }
.views button { min-height: 40px; border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 8px 14px; border-radius: 9px; }
.views button .ic { font-size: .9em; }
.views button:hover { background: var(--soft); color: var(--fg); }
.views button.on { background: var(--soft); color: var(--accent); }
body.app main { max-width: none; padding: 0; overflow: visible; }
.view { min-height: calc(100dvh - 56px); }
/* about */
.about { max-width: 980px; margin: 0 auto; padding: 32px 20px 40px; }
.about .hero { text-align: center; padding: 18px 0 8px; }
.about .hero .mark { width: 96px; height: 80px; }
.about .hero h1.wordmark { font-size: 1.7rem; margin: 6px 0 14px; }
.about .lead { font-size: 1.35rem; line-height: 1.35; margin: 0 auto 8px; max-width: 30ch; }
.about .sub { max-width: 52ch; margin: 0 auto; font-size: 1rem; }
.about .cta { justify-content: center; margin-top: 22px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 28px 0 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.tile span { color: var(--muted); font-size: .92rem; }
.construction { text-align: center; margin-top: 18px; }
/* the workboard: tools on the left, the work on the right, each scrolling on its own */
.board { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100dvh - 56px); }
.board > .tools { overflow-y: auto; padding: 16px; border-right: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 14px; }
.board > .work-area { overflow-y: auto; padding: 18px 22px 40px; min-width: 0; }
.tools h2 { margin: 0; }
.toolcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); margin: 0; }
.toolcard h3 { margin: 0 0 8px; }
.toolcard > summary { color: var(--fg); }
.toolcard .form > label { grid-template-columns: 1fr; gap: 2px; }
.toolcard .row { margin: 6px 0; }
.field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .92rem; color: var(--muted); }
.field.small { margin-top: 8px; font-size: .85rem; }
.field.small input { width: 4.5em; }
/* segmented choices */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; }
.seg button { flex: 1; border: 0; background: transparent; min-height: 38px; justify-content: center; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.seg.vertical { flex-direction: column; }
.seg.vertical button { justify-content: flex-start; text-align: left; }
/* panes, guide */
.pane > h2 { margin-top: 0; }
.guide.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.guide.one { grid-template-columns: minmax(0, 520px); }
.placeholder { border: 2px dashed var(--line); border-radius: 14px; padding: 40px 20px; text-align: center; color: var(--muted); margin-top: 14px; }
/* the scan's steps */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.stepper li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.stepper li .n { background: var(--line); color: var(--muted); }
.stepper li.done { color: var(--fg); cursor: pointer; }
.stepper li.done .n { background: var(--ok); color: #fff; }
.stepper li.on { background: var(--soft); color: var(--accent); }
.stepper li.on .n { background: var(--accent); color: var(--accent-fg); }
.work .step { border-top: 0; margin-top: 0; padding-top: 0; }
.workhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.workhead h2 { margin: 0; }
#preview { max-height: calc(100dvh - 300px); }
.empty { border: 2px dashed var(--line); border-radius: 16px; padding: 48px 20px; text-align: center; margin: 20px auto; max-width: 560px; }
.file.big { width: 100%; }
/* analysis */
.skates { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
button.danger { color: var(--err); }
/* errors float above whatever view is open */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; max-width: min(92vw, 640px); background: var(--card); border: 1px solid var(--err); border-radius: 12px; padding: 12px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.18); margin: 0; }
/* a phone: the views as a tab bar at the bottom; tools above the work, the page scrolling as one */
@media (max-width: 820px) {
  .topbar { height: 50px; }
  .views { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 25; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .views button { flex: 1; flex-direction: column; gap: 0; font-size: .75rem; padding: 4px; min-height: 52px; }
  .views button .ic { font-size: 1.15rem; }
  body.app main { padding-bottom: 72px; }
  .view { min-height: calc(100dvh - 50px - 72px); }
  .board { display: block; height: auto; }
  .board > .tools { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .board > .work-area { overflow: visible; padding: 14px 12px 24px; }
  #v-setup .seg.vertical { flex-direction: row; overflow-x: auto; }
  #v-setup .seg.vertical button { flex: none; white-space: nowrap; }
  .stepper { flex-direction: row; }
  .stepper li { flex: 1; flex-direction: column; gap: 2px; font-size: .78rem; text-align: center; padding: 6px 4px; }
  .toast { bottom: 84px; }
  #preview { max-height: 60vh; }
}
@media (max-width: 820px) { #v-scan.working > .tools > :not(.stepper) { display: none; } #v-scan.working > .tools { padding: 8px 12px; } }
@media (max-width: 820px) {
  #v-setup { display: flex; flex-direction: column; }
  #v-setup > .tools { display: contents; }
  #v-setup > .tools > h2 { order: 0; padding: 14px 12px 0; }
  #v-setup > .tools > .seg { order: 1; margin: 10px 12px 0; }
  #v-setup > .work-area { order: 2; }
  #v-setup > .tools > .toolcard { order: 3; margin: 0 12px 16px; }
  #v-scan:not(.working) .stepper { display: none; }
}

/* the guided pipeline */
.pipe { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pipe li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.pipe li:hover { background: var(--soft); }
.pipe li .n { flex: none; background: var(--line); color: var(--muted); }
.pipe li b { display: block; font-weight: 600; font-size: .93rem; }
.pipe li small { color: var(--muted); font-size: .8rem; }
.pipe li.done .n { background: var(--ok); color: #fff; }
.pipe li.on { background: var(--soft); outline: 1px solid var(--accent); }
.pipe li.on .n { background: var(--accent); color: var(--accent-fg); }
.scancard { max-width: 640px; margin: 10px auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; box-shadow: var(--shadow); }
.scancard h2 { font-size: 1.45rem; margin: 2px 0 10px; }
.kicker { color: var(--accent); font-weight: 650; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.scancard ol.how { padding-left: 20px; margin: 0 0 16px; }
.scancard ol.how li { margin: 6px 0; }
#scancard:empty { display: none; }
#inboxsec { margin-bottom: 16px; }
#v-scan:not(.working) .stepper { display: none; }
body.app a { color: var(--accent); }
.brandmini, .brandmini:visited { color: var(--fg) !important; }

/* ================================================================ the welcome page */
body.welcome { background: var(--bg); }
.wwrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.welcome .construction { margin: 0; padding: 7px 16px; text-align: center; font-size: .86rem; background: var(--gold); color: #1d1d1b; }
.wtop { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); }
.wtop .wwrap { display: flex; align-items: center; gap: 24px; height: 62px; }
.wtop nav { display: flex; gap: 22px; margin-left: auto; }
.wtop nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .93rem; }
.wtop nav a:hover { color: var(--fg); }
.wbtn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-weight: 600; background: var(--card); white-space: nowrap; }
.wbtn:hover { border-color: var(--accent); }
.wbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.whero { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; padding: 56px 0 40px; }
.whero h1 { font-size: clamp(2rem, 3.6vw, 2.9rem); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 16px; }
.welcome .lead { font-size: 1.12rem; color: var(--muted); max-width: 62ch; }
.welcome .actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0 10px; }
.welcome .small { font-size: .88rem; }
.welcome .muted { color: var(--muted); }
.shot { width: 100%; display: block; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.18); background: #0b0b0c; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.fact { padding: 18px 20px; border-right: 1px solid var(--line); }
.fact:last-child { border-right: 0; }
.fact b { display: block; margin-bottom: 4px; }
.fact span { color: var(--muted); font-size: .92rem; }
.welcome section { padding: 64px 0; border-bottom: 1px solid var(--line); }
.welcome section:last-of-type { border-bottom: 0; }
.welcome section h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin-bottom: 12px; letter-spacing: -.01em; }
.wsteps { display: grid; gap: 48px; margin-top: 30px; }
.wstep { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; align-items: center; }
.wstep:nth-child(even) .txt { order: 2; }
.wstep .n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-weight: 700; margin-bottom: 10px; }
.wstep h3 { font-size: 1.3rem; margin: 0 0 8px; display: block; }
.welcome .plain { padding-left: 20px; color: var(--muted); }
.welcome .plain li { margin: 6px 0; }
.welcome details { border-bottom: 1px solid var(--line); padding: 10px 0; margin: 0; }
.welcome details summary { color: var(--fg); font-weight: 600; }
.welcome details p { color: var(--muted); margin: 8px 0 4px; max-width: 75ch; }
.welcome .cta { text-align: center; }
.welcome .cta .lead { margin: 0 auto; }
.welcome .cta .actions { justify-content: center; }
.wfoot { max-width: 1180px; margin: 0 auto; padding: 20px 28px 40px; color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 8px; }
@media (max-width: 860px) {
  .wwrap { padding: 0 16px; }
  .wtop nav { display: none; }
  .wtop .wbtn { margin-left: auto; }
  .whero, .wstep { grid-template-columns: 1fr; gap: 24px; }
  .wstep:nth-child(even) .txt { order: 0; }
  .whero { padding: 32px 0 24px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .fact:nth-child(2) { border-right: 0; }
  .fact:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .welcome section { padding: 40px 0; }
}

/* ================================================================ two views: the skates, the setup; measuring over them */
.page { max-width: 1240px; margin: 0 auto; padding: 18px 20px 40px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; position: relative; }
.tb { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.tb input[type=number] { width: 4.6em; }
.tb select { max-width: 13em; }
.more { margin: 0 0 0 auto; }
.more > summary { list-style: none; cursor: pointer; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--fg); font-weight: 600; font-size: .9rem; }
.more > summary::-webkit-details-marker { display: none; }
.more[open] > summary { border-color: var(--accent); }
.morebox { position: absolute; right: 10px; top: calc(100% + 6px); z-index: 15; width: min(560px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.morebox .form > label { grid-template-columns: 8em 1fr; }
.skates { grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr)); gap: 16px; }
.skatecard { background: var(--card); padding: 14px; }
.side.empty { cursor: pointer; border: 2px dashed var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 4px; padding: 8px; min-height: 92px; justify-content: center; align-items: flex-start; }
.side.empty:hover { border-color: var(--accent); }
.side.empty .add { color: var(--accent); font-weight: 650; }
.hint { margin-top: 18px; }
/* measuring: a header with the steps and a close, the step below */
.measurehead { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.measurehead h2 { margin: 0; }
.measurehead .stepper { flex-direction: row; margin-left: auto; }
.measurehead .stepper li { padding: 6px 10px; }
#closework { flex: none; }
/* setup's tabs */
.tabs2 { flex-wrap: wrap; margin-bottom: 18px; }
.tabs2 button { flex: none; padding: 6px 14px; }
@media (max-width: 820px) {
  .page { padding: 12px 12px 24px; }
  .toolbar { gap: 8px 12px; }
  .measurehead .stepper { margin-left: 0; width: 100%; }
  .tabs2 { flex-wrap: nowrap; overflow-x: auto; }
}
.measurehead .stepper { display: flex !important; }
.sides > .side { width: 100%; box-sizing: border-box; }

/* the graph: one for all skates, its choices above it; full screen */
.chartpanel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 16px; }
.charthead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.charthead h2 { margin: 0; font-size: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.chip { min-height: 32px; padding: 4px 11px; border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--soft); color: var(--accent); border-color: var(--accent); }
.chips .sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.chartbox { position: relative; }
.chartbox canvas { width: 100%; display: block; }
.chartnotesbox { margin: 8px 0 0; }
.chartnotesbox > div > div { margin: 6px 0; }
.chartpanel:fullscreen, .chartpanel.full { position: fixed; inset: 0; z-index: 50; margin: 0; border-radius: 0; display: flex; flex-direction: column; overflow: auto; }
.chartpanel:fullscreen .chartbox, .chartpanel.full .chartbox { flex: 1; min-height: 300px; }
.chartpanel:fullscreen .chartnotesbox, .chartpanel.full .chartnotesbox { display: none; }
/* rig B, the phone's view upright */
.rigb { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.rigb .photo { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.rigb h3 { margin: 14px 0 4px; }
.guide.portrait { grid-template-columns: minmax(0, 300px); }
@media (max-width: 820px) { .rigb { grid-template-columns: 1fr; } .chips { margin-left: 0; } }
.guide .tn { font: 600 6px system-ui, sans-serif; fill: #333; }
.guide.stack { grid-template-columns: 1fr; gap: 12px; margin-top: 0; }
.rigb { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.guide .t.s { font-size: 7.5px; } .guide .t.b { fill: #2a6fdb; } .guide .t.s.b { font-size: 7.5px; }

/* ---- how it works: one page, the idea in four pictures, three steps */
.how { max-width: 1040px; }
.how h1 { font-size: 1.7rem; line-height: 1.2; margin: 6px 0 6px; }
.how .lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; margin: 0 0 18px; }
.howgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.howgrid figure { display: flex; flex-direction: column; }
.howgrid figure > svg, .howgrid figure > img { width: 100%; height: 190px; object-fit: contain; background: #fff; display: block; }
.howgrid figcaption { padding: 8px 10px 10px; font-size: .88rem; color: var(--muted); }
.howgrid figcaption b { display: block; color: var(--fg); margin-bottom: 2px; }
.how h2 { margin: 26px 0 8px; font-size: 1.2rem; }
.how ol.steps li { margin-bottom: 6px; }
.how details.build { margin: 18px 0; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--card); }
.how details.build summary { cursor: pointer; font-weight: 600; }
.how details.build h3 { margin: 16px 0 8px; font-size: 1rem; }
@media (max-width: 860px) { .howgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .howgrid { grid-template-columns: 1fr; } .how h1 { font-size: 1.4rem; } }
#v-analysis .chartpanel { margin-top: 0; }
.howgrid figure > img { background: #15171c; }

/* ---- the ruler's calibration: the gauge's readings on it, then the ruler's shape */
.calcard { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--card); }
.calcard > summary { cursor: pointer; font-weight: 600; }
.calcard h2 { display: none; }
#calplot { width: 100%; height: 150px; display: block; }
.note.warn { color: var(--err); }
.calcard h3 { margin: 12px 0 4px; font-size: .95rem; }
.rgtable { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; margin: 6px 0 10px; }
.rgtable label { display: flex; align-items: center; gap: 4px; font-size: .88rem; }
.rgtable input.rgcm { width: 56px; } .rgtable input.rgv { width: 76px; }

/* the open side's scan below both skates; the stitched picture whole (tap: zoomed in); the radius curve */
.skdetail:not(:empty) { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card); }
.skdetail .dethead { margin: 0 0 6px; font-size: 1rem; }
.edgebox { cursor: zoom-out; }
.edgebox.fit { max-height: none; overflow: hidden; cursor: zoom-in; }
.edgebox.fit canvas { width: 100%; height: auto; }
.charthead .tb { margin-left: auto; margin-right: 8px; }
.rbox { margin-top: 6px; }

/* the scan's own buttons: clearly buttons */
.row.acts button, .row.acts .file, .row.acts select { background: var(--accent); color: var(--accent-fg, #fff); border: 0; border-radius: 8px; padding: 7px 12px; font-weight: 600; }
.row.acts .del1 { background: var(--err); }
.row.acts label:first-child { background: var(--soft); border-radius: 8px; padding: 4px 8px; }
.filerow { flex-wrap: wrap; gap: 8px; }
.calms { margin: 6px 0 8px; }
.calms .calm.on { background: var(--accent); color: var(--accent-fg, #fff); }

/* the new scan: which skate, what, the video */
.nsp { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; background: var(--card); }
.nsp h3 { margin: 0; font-size: 1rem; }
.nsp label { display: flex; align-items: center; gap: 6px; }
.nsp .file.primary { background: var(--accent); color: var(--accent-fg, #fff); border-radius: 8px; padding: 7px 14px; font-weight: 600; cursor: pointer; }
.nsp .file input { display: none; }
.skatecard h3 .skname { background: none; border: 0; color: inherit; font: inherit; padding: 0; cursor: text; }
.skatecard h3 .skdel { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; }
.calcard summary .muted { color: var(--muted); font-weight: 400; font-size: .9em; }

/* the graphs' zoom box */
.zoomrect { position: absolute; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); pointer-events: none; }
.chartbox canvas { cursor: crosshair; touch-action: pan-y; }
.zoomhint { margin: 4px 0 0; font-size: .85em; }
#customgauge input { width: 5.5em; }
#nsAngleBox input { width: 4em; }

/* a scan's ends and cups, moved on its picture */
.endsbar { margin: 6px 0; }
.edgebox canvas.edge { touch-action: pan-y; }

/* the radius colours' scale: its two ends typed */
.rlegend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }
.rlegend input { width: 4.2em; }
.rlegend .rbar { width: min(180px, 30vw); height: 10px; border-radius: 3px; background: linear-gradient(to right, rgb(255,59,48), rgb(255,149,0), rgb(52,199,89), rgb(42,140,235)); }
.rlegend .hollowsw { display: inline-block; width: 9px; height: 9px; background: #b45cf0; border-radius: 2px; vertical-align: -1px; }

/* the rigs' photos: cut out, on the page's own background */
.rigphoto { margin: 6px 0 12px; }
.rigphoto img { display: block; width: 100%; max-width: 720px; margin: 0 auto; }
.rigphoto figcaption { text-align: center; color: var(--muted); font-size: .9em; }

/* how to scan: the text beside what the phone sees */
.howto { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
.howto h2 { font-size: 1.05rem; margin: 14px 0 4px; }
.howto figure { margin: 14px 0 0; }
@media (max-width: 700px) { .howto { grid-template-columns: 1fr; } .howto figure { max-width: 240px; margin: 0 auto; } }

/* a button busy: a spinner beside what is going on */
button.busy::before { content: ''; display: inline-block; width: .9em; height: .9em; margin-right: 7px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busyspin .8s linear infinite; }
@keyframes busyspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.busy::before { animation: none; } }

/* phones */
select { max-width: 100%; }
.nsp select { min-width: 0; }
.zoomhint .hint-touch { display: none; }
@media (hover: none) { .zoomhint .hint-touch { display: inline; } .zoomhint .hint-mouse { display: none; } }
#s2 .help { font-size: .88em; }
@media (max-width: 700px) {
  /* the skates first (a new scan, the skates, the graph), the settings after */
  #v-skates .page { display: flex; flex-direction: column; }
  #v-skates #inboxsec { order: 1; } #v-skates #skates { order: 2; } #v-skates #chartpanel { order: 3; }
  #v-skates .toolbar { order: 4; margin-top: 14px; } #v-skates #calbox { order: 5; } #v-skates .filerow { order: 6; } #v-skates .page > p { order: 7; }
  .nsp label { flex-wrap: wrap; width: 100%; } .nsp label select { flex: 1 1 auto; }
  .nsp .file.primary, #go, #calc { flex: 1 1 100%; text-align: center; justify-content: center; min-height: 48px; font-size: 1.05rem; }
}
@media (max-width: 700px) { #s2 .canvasbox { text-align: center; } #s2 #preview { max-height: 52vh; width: auto; max-width: 100%; } }

/* the next step: one big button, always in view (above the phone's tabs); busy, its progress filling it */
.actionbar { position: sticky; bottom: 0; z-index: 6; padding: 10px 0 12px; margin-top: 6px; background: linear-gradient(to top, var(--bg) 75%, transparent); }
.actionbar .primary { width: 100%; min-height: 54px; font-size: 1.12rem; font-weight: 700; border-radius: 12px; }
.actionbar .primary:not(:disabled):not(.busy) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
button.busy, button.busy:disabled { opacity: 1; }
.actionbar button.busy { background: linear-gradient(90deg, var(--accent) var(--p, 100%), color-mix(in srgb, var(--accent) 40%, var(--bg)) var(--p, 100%)); color: var(--accent-fg, #fff); }
@media (max-width: 820px) { .actionbar { bottom: calc(60px + env(safe-area-inset-bottom)); } }
/* stitching: the heading with a spinner and the percentage, a thick bar */
.busyhead::before { content: ''; display: inline-block; width: .8em; height: .8em; margin-right: 8px; vertical-align: -1px; border: 2.5px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: busyspin .8s linear infinite; }
.bar.big { height: 16px; border-radius: 8px; }
/* the measuring screen's head on a phone: the title and Close on one line, the steps below */
@media (max-width: 700px) { .measurehead { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: start; } .measurehead #closework { grid-column: 2; grid-row: 1; } .measurehead .stepper { grid-column: 1 / -1; grid-row: 2; } .measurehead h2 { font-size: 1.15rem; margin: 0; } }

/* the graph's ice angle */
.iceang { display: inline-flex; align-items: center; gap: 6px; font-size: .9em; color: var(--muted); }
.iceang input { width: 120px; accent-color: var(--accent); }
.iceang span { min-width: 6.5em; color: var(--fg); font-variant-numeric: tabular-nums; }

/* the ice angle: its own row, a long slider with its marks */
.icerow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0; }
.icerow > label { font-weight: 600; }
.icescale { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 560px; color: var(--muted); font-size: .85em; }
.icescale input { flex: 1; accent-color: var(--accent); min-width: 140px; }
#iceval { min-width: 7em; font-variant-numeric: tabular-nums; }
.iceexplain { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 4px 0 8px; }
.iceexplain p { margin: 4px 0; }

/* an opened side's line: coloured by the rocker, the bend, or as seen */
.linemode { margin: 4px 0 6px; max-width: 420px; }

/* the language */
.langsel { margin-left: auto; margin-right: 8px; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-weight: 600; }
.topbar .langsel + .views { margin-left: 0; }
@media (max-width: 820px) { .langsel { margin-left: auto; } }
