.sp-tabs { align-self: flex-start; }
.sp-row { gap: 8px; align-items: center; }
.sp-inline { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.sp-inline > span { white-space: nowrap; }
.sp-inline .input.num { width: 84px; }
label.btn { cursor: pointer; }
.sp-view {
  position: relative;
  width: 100%;
  height: min(70vh, 640px);
  min-height: 300px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--ink);
  touch-action: none;
}
.sp-view:fullscreen { height: 100vh; border-radius: 0; }
.sp-view canvas { display: block; outline: none; }
.sp-view:empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 18px, color-mix(in srgb, var(--paper) 6%, transparent) 18px 19px);
}
.sp-progress { display: flex; align-items: center; gap: 10px; }
.sp-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 0; background: var(--tape); transition: width 0.2s; }
.sp-progress span { color: var(--ink-2); font-size: 0.9em; min-width: 12ch; }
.sp-status { min-height: 1.4em; margin: 0; overflow-wrap: anywhere; }
.sp-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.sp-strip button { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: var(--radius); background: var(--surface); cursor: pointer; scroll-snap-align: start; line-height: 0; }
.sp-strip button[aria-current="true"] { border-color: var(--tape); }
.sp-strip img { width: 84px; height: 63px; object-fit: cover; border-radius: calc(var(--radius) - 2px); }
.sp-spots { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.sp-spot { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.sp-spot img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.sp-spot div { flex: 1; min-width: 0; font-size: 0.92em; }
.sp-spot small { color: var(--ink-3); display: block; }
.sp-nav .seg { margin-right: 4px; }
.sp-mobile { display: none; }
@media (pointer: coarse) { .sp-mobile { display: inline-flex; } }
@media (max-width: 600px) { .sp-view { height: 62vh; } .mw-main { padding: 12px; } }
.sp-tab[hidden], .sp-progress[hidden], [hidden].btn { display: none !important; }
.seg > button { appearance: none; border: 0; border-inline-end: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 15px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.seg > button:last-child { border-inline-end: 0; }
.seg > button.on { background: var(--ink); color: var(--paper); }
.seg > button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; box-shadow: inset 0 0 0 4px var(--tape); }
.sp-model { margin-top: 8px; }
.sp-view[hidden], #omCrop[hidden], [id$="Tools"][hidden] { display: none !important; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
input[type="range"] { accent-color: var(--ink); min-width: 120px; }
/* guided capture */
html.sp-guide-open, html.sp-guide-open body { overflow: hidden; }
.sp-guide { position: fixed; inset: 0; z-index: 1000; background: #000; color: #fff; touch-action: none; }
.sp-guide video, .sp-guide-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sp-guide-overlay { pointer-events: none; }
.sp-guide-top { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.sp-guide-top strong { font-size: 16px; }
.sp-guide-count { flex: 1; font-size: 14px; opacity: .9; }
.sp-guide-top .btn { background: rgba(0,0,0,.4); color: #fff; border-color: rgba(255,255,255,.6); }
.sp-guide-info { position: absolute; left: 14px; right: 14px; top: 58px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.sp-guide-msg { margin: 0; padding: 8px 12px; border-radius: var(--radius); background: rgba(0,0,0,.55); font-size: 15px; text-align: center; }
.sp-guide-msg:empty { display: none; }
.sp-guide-meter { align-self: center; width: 60%; height: 8px; border-radius: 99px; background: rgba(255,255,255,.25); overflow: hidden; }
.sp-guide-meter i { display: block; height: 100%; width: 0; background: var(--tape); transition: width .15s; }
.sp-guide-meter.low i { background: var(--bad); }
.sp-guide-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.sp-guide-bottom .check { color: #fff; }
.sp-guide-shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; }
.sp-guide-shutter:active { background: var(--tape); }
.sp-guide.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: sp-flash .25s ease-out forwards; pointer-events: none; }
@keyframes sp-flash { from { opacity: .55; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sp-guide.flash::after { animation: none; opacity: 0; } }

/* Live scan screen (object and space scanners): camera above, the live model below. */
html.ob-scan-open, html.ob-scan-open body { overflow: hidden; }
.ob-scan { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: #000; color: #fff; touch-action: none; }
.ob-cam { position: relative; flex: 0 0 var(--ob-split, 52%); min-height: 120px; overflow: hidden; background: #111; }
.ob-cam video, .ob-cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ob-cam canvas { pointer-events: none; }
.ob-divider { flex: 0 0 18px; display: flex; align-items: center; justify-content: center; background: #1a1c20; cursor: row-resize; touch-action: none; }
.ob-divider::before { content: ""; width: 48px; height: 5px; border-radius: 99px; background: #555; }
.ob-model { position: relative; flex: 1 1 auto; min-height: 120px; background: #1c1f23; }
.ob-model canvas { display: block; outline: none; }
.ob-top { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: linear-gradient(rgba(0,0,0,.65), transparent); font-size: 14px; }
.ob-top strong { font-size: 15px; }
.ob-top .ob-stat { flex: 1; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-top .btn { background: rgba(0,0,0,.4); color: #fff; border-color: rgba(255,255,255,.6); }
.ob-msg { position: absolute; left: 12px; right: 12px; top: 52px; margin: 0; padding: 7px 12px; border-radius: var(--radius); background: rgba(0,0,0,.55); font-size: 15px; text-align: center; pointer-events: none; }
.ob-msg:empty { display: none; }
.ob-msg.good { background: rgba(40,140,70,.7); }
.ob-msg.bad { background: rgba(170,50,50,.7); }
.ob-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.ob-bottom .check { color: #fff; }
.ob-bottom .btn { background: rgba(0,0,0,.45); color: #fff; border-color: rgba(255,255,255,.6); }
.ob-bottom .btn.primary { background: var(--tape); color: #000; border-color: var(--tape); }
.ob-shutter { width: 62px; height: 62px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; }
.ob-shutter:active { background: var(--tape); }
.ob-cam.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: sp-flash .25s ease-out forwards; pointer-events: none; }
.ob-legend { position: absolute; left: 10px; bottom: 8px; font-size: 12px; opacity: .85; pointer-events: none; display: flex; gap: 10px; }
.ob-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.ob-block { position: absolute; right: 10px; bottom: 8px; display: flex; gap: 6px; }
.ob-block .btn { background: rgba(0,0,0,.45); color: #fff; border-color: rgba(255,255,255,.5); }
.ob-download { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); font-size: 15px; pointer-events: none; }
.ob-download[hidden] { display: none; }
@media (orientation: landscape) and (min-width: 700px) {
  .ob-scan { flex-direction: row; }
  .ob-cam { flex: 0 0 var(--ob-split, 55%); }
  .ob-divider { flex: 0 0 18px; cursor: col-resize; }
  .ob-divider::before { width: 5px; height: 48px; }
}
