/* AI grading G1 · centering tool (public/v2-grade-centering.js). Tokens from tokens.css. */
.gc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}
/* Measured splits make the side tabs wider than a phone: they scroll instead of widening the page. */
.gc-tabs {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.gc-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.gc-card-art {
  flex: none;
  width: 48px;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-2);
}
.gc-card-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gc-card-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.gc-card-main small {
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.gc-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}
.gc-tabs b {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.gc-empty {
  display: grid;
  gap: var(--s-3);
  justify-items: start;
}
.gc-tips {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.2em;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.gc-pick,
.gc-tools,
.gc-save-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.gc-pick label {
  cursor: pointer;
}
.gc-busy {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 160px;
  justify-content: center;
  color: var(--text-2);
}
.gc-busy .spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gc-spin 0.8s linear infinite;
}
@keyframes gc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Stage: the card image with the SVG lines on top. */
.gc-stage {
  position: relative;
  /* The width follows from the height limit, so the aspect ratio (set inline) never squeezes the
     image under the lines. --gc-ratio = width / height of what is shown. */
  width: min(100%, 460px, calc(72vh * var(--gc-ratio, 0.725)));
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--r-md);
  background: #101014;
  outline: none;
}
.gc-stage:focus-visible {
  box-shadow: var(--focus-ring);
}
.gc-img,
.gc-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.gc-svg {
  touch-action: pan-y;
  cursor: crosshair;
}
.gc-hit,
.gc-handle,
.gc-touch {
  touch-action: none;
  cursor: grab;
}
.gc-touch {
  fill: transparent;
}
.gc-cross {
  stroke: #1a1030;
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.gc-line {
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}
.gc-line.is-outer {
  stroke: #22d3ee;
}
.gc-line.is-inner {
  stroke: #e879f9;
}
.gc-line.is-guess {
  stroke-dasharray: 6 4;
}
.gc-line.is-sel {
  stroke-width: 2.5px;
}
.gc-handle {
  fill: rgba(0, 0, 0, 0.35);
  stroke: #fff;
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}
.gc-handle.is-outer {
  stroke: #22d3ee;
}
.gc-handle.is-inner {
  stroke: #e879f9;
}
.gc-handle.is-sel {
  fill: #fff;
}
.gc-quad {
  fill: rgba(232, 121, 249, 0.12);
  stroke: #e879f9;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}
.gc-label {
  fill: #fff;
  font-size: 2.1px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.7);
  stroke-width: 0.5px;
  pointer-events: none;
}
.gc-loupe {
  position: absolute;
  width: 150px;
  height: 150px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: var(--e-3);
  pointer-events: none;
}
.gc-hint {
  margin: 0;
  text-align: center;
}
.gc-tools {
  justify-content: center;
}
.gc-nudge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
}
.gc-nudge small {
  color: var(--text-3);
}

/* Numbers under the card. */
.gc-numbers,
.gc-splits {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
}
.gc-splits {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.gc-numbers > div,
.gc-splits > div {
  display: grid;
  gap: 2px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.gc-numbers small,
.gc-splits small {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.gc-numbers b {
  font-variant-numeric: tabular-nums;
}
.gc-splits b {
  font-size: var(--fs-xl);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 420px) {
  .gc-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Grades by company. */
.gc-grade .row-end {
  gap: var(--s-2);
}
.gc-grade-value {
  min-width: 7.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gc-grade.is-own .row-title {
  color: var(--accent-text);
}
.gc-thumb {
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 66 / 91;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-2);
}
.gc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gc-reports .panel-head {
  justify-content: space-between;
}

/* ---------- G2: link to the wizard in the measurement detail ---------- */
.gc-wizard-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
.gc-wizard-row small {
  flex: 1 1 220px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* ---------- G2: issues, retakes, angled shots ---------- */
.gc-issues li.is-retake {
  color: var(--danger);
  font-weight: var(--fw-semibold);
}
.gc-retake {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--danger-soft);
}
.gc-retake b {
  flex: 1 1 200px;
  font-size: var(--fs-sm);
}
.gc-issue {
  fill: rgba(239, 68, 68, 0.12);
  stroke: #fbbf24;
  stroke-width: 2px;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.gc-issue.is-retake {
  stroke: #ef4444;
}
.gc-tilt-lead {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.gc-tilts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-3);
}
.gc-tilt {
  display: grid;
  gap: var(--s-2);
  margin: 0;
}
.gc-tilt-img {
  display: grid;
  place-items: center;
  aspect-ratio: 66 / 91;
  overflow: hidden;
  border-radius: var(--r-md);
  background: #101014;
  color: var(--text-3);
}
.gc-tilt-img canvas,
.gc-tilt-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gc-tilt figcaption {
  display: grid;
  gap: 4px;
}
.gc-tilt figcaption small {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.gc-tilt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

/* ---------- G3: AI grading result ---------- */
.gc-ai {
  display: grid;
  gap: var(--s-3);
}
.gc-ai-busy {
  min-height: 90px;
}
.gc-score {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-4);
  align-items: center;
}
.gc-score-big {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border-radius: 24px;
  background: var(--grad);
  color: var(--on-accent);
  text-align: center;
}
.gc-score-big small {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.gc-score-big b {
  font-size: 44px;
  line-height: 1;
}
.gc-subs {
  display: grid;
  gap: 6px;
}
.gc-subs > div {
  display: grid;
  grid-template-columns: 6.5em 1fr 2.5em;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
}
.gc-subs b {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gc-bar {
  height: 8px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--surface-2);
}
.gc-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
}
.gc-odds .row-end {
  gap: var(--s-3);
}
.gc-odds-10 {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.gc-h3 {
  margin: var(--s-2) 0 0;
  font-size: var(--fs-md);
}
.gc-reasons {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 1.2em;
  font-size: var(--fs-sm);
}
.gc-pin circle {
  fill: #ef4444;
  stroke: #fff;
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}
.gc-pin text {
  fill: #fff;
  font-size: 2.2px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
@media (max-width: 420px) {
  .gc-score {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .gc-subs {
    width: 100%;
  }
}

/* ---------- G4: template check ---------- */
.gc-line.is-alt {
  stroke: #fff;
  stroke-width: 1.5px;
  stroke-dasharray: 3 3;
  opacity: 0.9;
}
.gc-template {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.gc-template .i {
  flex: none;
  margin-top: 2px;
}

/* ---------- G5–G7: potential, plan, batches, calibration ---------- */
.gc-potential {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px var(--s-3);
  align-items: center;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.gc-potential small {
  grid-column: 1;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.gc-potential .btn {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.gc-potential.is-top {
  background: var(--success-soft);
}
.gc-potential.is-skip {
  background: var(--danger-soft);
}
.gc-report-list .gc-pick {
  flex: none;
  width: 18px;
  height: 18px;
  margin-right: var(--s-2);
  accent-color: var(--accent);
}
.gc-plan {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.gc-plan-table {
  display: grid;
  gap: 2px;
  overflow-x: auto;
}
.gc-plan-row {
  display: grid;
  grid-template-columns: minmax(150px, 2fr) repeat(4, minmax(80px, 1fr));
  gap: var(--s-2);
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.gc-plan-row.is-head {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.gc-plan-row > span:first-child {
  display: grid;
  gap: 2px;
}
.gc-plan-row small {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.gc-plan-pot.is-top {
  color: var(--success);
}
.gc-plan-pot.is-skip {
  color: var(--danger);
}
.gc-plan-row .input {
  height: 32px;
}
.gc-calibration {
  display: grid;
  gap: 2px;
  margin-top: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.gc-calibration small {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.gb-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}
.gb-filter .field {
  flex: 1 1 180px;
}
.gb-list {
  max-height: 60vh;
  overflow: auto;
}
.gb-cand input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-right: var(--s-2);
  accent-color: var(--accent);
}
.gb-progress {
  display: block;
  margin-bottom: var(--s-3);
}
@media (max-width: 560px) {
  .gc-plan-row {
    grid-template-columns: minmax(120px, 2fr) repeat(4, minmax(64px, 1fr));
  }
}

/* ---------- UX review 22. 11. (cleanup session findings) ---------- */
.gc-more {
  margin-top: var(--s-2);
}
.gc-more > summary {
  cursor: pointer;
  padding: var(--s-2) 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
@media (max-width: 560px) {
  /* Card page, "My copies": icon-only links keep the heading on one line. */
  .v2-copies .panel-head {
    flex-wrap: nowrap;
  }
  .v2-copies .v2-head-actions .btn > span {
    display: none;
  }
  .v2-copies .v2-head-actions {
    flex: none;
    flex-wrap: nowrap;
    gap: 2px;
  }
  .v2-copies .panel-head h2 {
    min-width: 0;
    white-space: nowrap;
  }
  /* Grading calculator: one column on phones. */
  .v2-calc-form .v2-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Grading screen: the wizard is the panel's main action, under the text (one-line header on phones). */
.gc-start {
  margin-top: var(--s-3);
}

/* ---------- Grading wizard (public/v2-grade-wizard.js), 23. 11. 2026 ---------- */
/* Full screen like the scanner: a dark stage, one step at a time, content in a phone-width column. */
html:has(.gw),
html:has(.gw) body {
  overflow: hidden;
}
/* The page-in animation keeps a transform, which would trap the fixed wizard inside the page. */
.page:has(.gw) {
  animation: none;
  transform: none;
}
.workspace:has(.gw) > .topbar,
.app:has(.gw) .tabbar {
  display: none;
}
.gw {
  --gw-good: #34d399;
  --gw-fix: #fbbf24;
  --gw-bad: #fb7185;
  --gw-muted: rgba(255, 255, 255, 0.68);
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--night);
  background-color: #0e0820;
  color: #fff;
  isolation: isolate;
}
.gw-top {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: var(--h-md) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-2);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
}
.gw[data-screen='shoot'] .gw-top {
  background: linear-gradient(rgba(8, 4, 20, 0.7), transparent);
}
.gw-close {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.gw-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.gw-progress-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
}
.gw-dots {
  display: flex;
  gap: 6px;
}
.gw-dots i {
  width: 22px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  transition: background var(--dur-2) var(--ease);
}
.gw-dots i.is-done {
  background: var(--gw-good);
}
.gw-dots i.is-now {
  background: #fff;
}
.gw-top-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.gw-chip {
  height: 34px;
  min-width: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-weight: var(--fw-semibold);
}
.gw-chip.is-on {
  background: #fff;
  color: #1a1030;
}

/* Camera: fills the screen behind the top bar and the instructions.
   IMPORTANT: Never toggle display:none on .gw-cam — iOS WebKit shrinks/breaks live <video>
   compositing layers when returning from Review -> Retake! Use visibility/opacity instead. */
.gw-cam {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  background: #05030b;
}
.gw[data-screen='shoot'] .gw-cam,
.gw[data-screen='video-rec'] .gw-cam {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.gw-cam video,
.gw-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gw-guide path,
.gw-guide polygon {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke var(--dur-2) var(--ease);
}
.gw-guide .gw-guide-shape {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-dasharray: 3 2;
}
.gw-guide.is-fix .gw-guide-shape {
  stroke: var(--gw-fix);
  stroke-dasharray: none;
}
.gw-guide.is-good .gw-guide-shape {
  stroke: var(--gw-good);
  stroke-dasharray: none;
}
.gw-guide .gw-guide-progress {
  stroke: #fff;
}
.gw-guide .gw-guide-quad {
  stroke: rgba(196, 181, 253, 0.9);
}
.gw-guide .gw-guide-dot {
  fill: #c4b5fd;
}
.gw-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.gw.is-flash .gw-flash {
  animation: gw-flash 0.38s ease-out;
}
@keyframes gw-flash {
  0% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
  }
}

/* Content column: scrolls when it does not fit. */
.gw-body {
  position: relative;
  z-index: 2;
  grid-row: 2 / 4;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--s-4) calc(var(--safe-b) + var(--s-6));
}
.gw-body > div {
  max-width: 460px;
  margin: 0 auto;
}
.gw h2 {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  text-align: center;
}
.gw-lead {
  margin: var(--s-2) 0 0;
  color: var(--gw-muted);
  font-size: var(--fs-md);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.gw-fine {
  margin: var(--s-4) 0 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--fs-xs);
  line-height: var(--lh);
  text-align: center;
}
.gw-actions {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-6);
}
.gw-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
}
.gw .btn-white .i,
.gw .btn-glass .i {
  flex: none;
}

/* Intro */
.gw-intro {
  display: grid;
  justify-items: center;
  padding-top: var(--s-4);
}
.gw-intro-art {
  width: 132px;
  margin-bottom: var(--s-5);
  transform: rotate(-4deg);
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.5));
}
.gw-intro-art img,
.gw-intro-art canvas,
.gw-slab-card img,
.gw-slab-card canvas,
.gw-scan-art img,
.gw-scan-art canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5% / 3.6%;
}
.gw-art-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 63 / 88;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #c4b5fd;
}
.gw-tips {
  display: grid;
  gap: var(--s-2);
  width: 100%;
  margin: var(--s-5) 0 0;
  padding: 0;
  list-style: none;
}
.gw-tips li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
}
.gw-tip-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(196, 181, 253, 0.18);
  color: #c4b5fd;
}
.gw-intro .gw-actions {
  width: 100%;
}

/* Shooting: the instruction card and the controls sit at the bottom over the camera. */
.gw[data-screen='shoot'] .gw-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: visible;
  background: linear-gradient(transparent 55%, rgba(8, 4, 20, 0.78));
}
.gw-shoot {
  display: grid;
  gap: var(--s-3);
  width: 100%;
}
.gw-step-lead {
  margin: 0;
  justify-self: center;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: rgba(8, 4, 20, 0.55);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.gw-tip {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 72px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.94);
  color: #1a1030;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
  transition: background var(--dur-2) var(--ease);
}
.gw-tip b {
  display: block;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}
.gw-tip small {
  display: block;
  color: #5b4b7a;
  font-size: var(--fs-sm);
}
.gw-tip-pict {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #efe9ff;
  color: #6d28d9;
}
.gw-tip.is-fix .gw-tip-pict {
  background: #fff3d6;
  color: #b45309;
}
.gw-tip.is-good {
  background: #e7fbf1;
}
.gw-tip.is-good .gw-tip-pict {
  background: #c9f5df;
  color: #047857;
}
.gw-level {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(8, 4, 20, 0.62);
  color: #fff;
  font-size: var(--fs-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.gw-level[hidden] {
  display: none;
}
.gw-level-label {
  flex: none;
  min-width: 8.5em;
}
.gw-level-bar {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
}
.gw-level-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  background: rgba(52, 211, 153, 0.55);
}
.gw-level-mark {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f59e0b;
  transform: translate(-50%, -50%);
  transition: left 0.12s linear;
}
.gw-level.is-good .gw-level-mark {
  background: #10b981;
}
.gw-level b {
  flex: none;
  min-width: 2.6em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gw-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-1);
}
.gw-controls > :first-child {
  justify-self: start;
}
.gw-controls > :last-child {
  justify-self: end;
}
.gw-ctl {
  width: var(--h-lg);
  height: var(--h-lg);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
}
.gw-ctl.is-on {
  background: #fff;
  color: #1a1030;
}
.gw-ctl-text {
  white-space: nowrap;
}
.gw-shutter {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 4px solid #fff;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.gw-shutter span {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-1) var(--ease);
}
.gw-shutter:active span {
  transform: scale(0.88);
}
.gw-manual {
  margin: 0;
  color: #fff;
  font-size: var(--fs-sm);
  text-align: center;
  animation: gw-pulse 1.6s ease-in-out infinite;
}
@keyframes gw-pulse {
  50% {
    opacity: 0.55;
  }
}
.gw-checks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.gw-checks[hidden],
.gw-manual[hidden] {
  display: none;
}
.gw-checks span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(251, 191, 36, 0.22);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
}
.gw-checks span.is-ok {
  background: rgba(52, 211, 153, 0.22);
}
.gw-nocam {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
}
.gw-nocam span {
  color: var(--gw-muted);
  font-size: var(--fs-sm);
}
.gw-shoot.is-fallback .gw-controls {
  grid-template-columns: 1fr;
}
.gw-busy {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s-3);
  background: rgba(8, 4, 20, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.gw-busy .spinner {
  width: 34px;
  height: 34px;
  border-width: 3px;
}

/* Check of a photo */
.gw-review {
  display: grid;
  justify-items: center;
  padding-top: var(--s-2);
}
.gw-review-photo {
  position: relative;
  width: min(46%, 184px);
  margin-bottom: var(--s-4);
}
.gw-review-photo canvas {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 34dvh;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.7);
}
.gw-review-photo.is-raw {
  width: min(82%, 310px);
}
.gw-review-badge {
  position: absolute;
  right: -12px;
  bottom: -12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid #0e0820;
  border-radius: 50%;
  background: var(--gw-good);
  color: #04281b;
  animation: gw-pop 0.5s var(--spring) both 0.1s;
}
.gw-review.is-warn .gw-review-badge {
  background: var(--gw-fix);
  color: #3b2300;
}
.gw-review.is-bad .gw-review-badge {
  background: var(--gw-bad);
  color: #3f0414;
}
@keyframes gw-pop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.gw-checklist {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: var(--s-4) 0 0;
  padding: 0;
  list-style: none;
}
.gw-checklist li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.gw-checklist .is-ok {
  background: rgba(52, 211, 153, 0.18);
  color: #a7f3d0;
}
.gw-checklist .is-warn {
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}
.gw-checklist .is-bad {
  background: rgba(251, 113, 133, 0.2);
  color: #fecdd3;
}
.gw-review .gw-actions {
  width: 100%;
}

/* Grading in progress */
.gw-working {
  display: grid;
  justify-items: center;
  padding-top: var(--s-8);
}
.gw-scan-art {
  position: relative;
  width: 160px;
  margin-bottom: var(--s-6);
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(196, 181, 253, 0.4), 0 20px 50px -10px rgba(124, 58, 237, 0.6);
}
.gw-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #c4b5fd, #f9a8d4, transparent);
  box-shadow: 0 0 18px 3px rgba(196, 181, 253, 0.8);
  animation: gw-scan 1.8s ease-in-out infinite;
}
@keyframes gw-scan {
  0%,
  100% {
    top: 4%;
  }
  50% {
    top: 94%;
  }
}

/* Result */
.gw-result {
  position: relative;
  padding-top: var(--s-2);
}
.gw-slab {
  position: relative;
  width: min(72%, 260px);
  margin: 0 auto var(--s-5);
  padding: 10px 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: gw-slab-in 0.7s var(--spring) both;
}
@keyframes gw-slab-in {
  0% {
    transform: translateY(24px) rotate(-3deg) scale(0.92);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
.gw-slab-label {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f5f3ff, #fde7f3);
  color: #1a1030;
}
.gw-slab-name {
  display: grid;
  align-content: center;
  min-width: 0;
}
.gw-slab-name b {
  overflow: hidden;
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-slab-name small {
  overflow: hidden;
  color: #5b4b7a;
  font-size: var(--fs-2xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-slab-name .gw-slab-brand {
  color: #7c3aed;
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.gw-slab-grade {
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 52px;
  padding-left: 8px;
  border-left: 1px solid rgba(26, 16, 48, 0.15);
}
.gw-slab-grade small {
  color: #5b4b7a;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}
.gw-slab-grade b {
  font-size: 30px;
  font-weight: var(--fw-black);
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gw-slab-card {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}
.gw-shine {
  position: absolute;
  inset: -20%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.55) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: gw-shine 2.4s ease-in-out 0.6s 2;
  pointer-events: none;
}
@keyframes gw-shine {
  60%,
  100% {
    transform: translateX(120%);
  }
}
.gw-verdict {
  margin-top: var(--s-2);
}
.gw-odds {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: var(--s-2);
  height: 112px;
  margin: var(--s-4) 0 0;
}
.gw-odd {
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  height: 100%;
  gap: 2px;
}
.gw-odd i {
  align-self: end;
  width: 100%;
  height: var(--h);
  min-height: 4px;
  border-radius: 8px 8px 3px 3px;
  background: rgba(255, 255, 255, 0.18);
  transform-origin: bottom;
  animation: gw-grow 0.8s var(--ease) both 0.4s;
}
.gw-odd.is-likely i {
  background: var(--grad);
}
.gw-odd b {
  font-size: var(--fs-sm);
}
.gw-odd small {
  color: var(--gw-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
@keyframes gw-grow {
  0% {
    transform: scaleY(0);
  }
}
.gw-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-2) var(--s-3);
  margin: var(--s-4) 0 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(196, 181, 253, 0.14);
  color: #ede9fe;
  font-size: var(--fs-sm);
  text-align: center;
}
.gw-subs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
  margin-top: var(--s-5);
}
.gw-sub {
  display: grid;
  gap: 1px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: gw-pop 0.45s var(--ease) both;
}
.gw-sub:nth-child(2) {
  animation-delay: 0.08s;
}
.gw-sub:nth-child(3) {
  animation-delay: 0.16s;
}
.gw-sub:nth-child(4) {
  animation-delay: 0.24s;
}
.gw-sub small {
  color: var(--gw-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.gw-sub b {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  line-height: 1.1;
}
.gw-sub span {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.gw-sub em {
  color: var(--gw-muted);
  font-size: var(--fs-xs);
  font-style: normal;
}
.gw-sub.is-good span {
  color: #6ee7b7;
}
.gw-sub.is-ok span {
  color: #fde68a;
}
.gw-sub.is-low span {
  color: #fda4af;
}
.gw-sub.is-none b,
.gw-sub.is-none span {
  color: rgba(255, 255, 255, 0.45);
}
.gw-value {
  margin-top: var(--s-6);
}
.gw-value:empty {
  display: none;
}
.gw-value h3 {
  margin: 0 0 var(--s-3);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}
.gw-value .gw-fine {
  text-align: left;
}
.gw-ladder {
  display: grid;
  gap: 6px;
}
.gw-rung {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.07);
}
.gw-rung-name {
  display: grid;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
}
.gw-rung-name small {
  overflow: hidden;
  color: var(--gw-muted);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-rung-bar {
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.gw-rung-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transform-origin: left;
  animation: gw-grow-x 0.9s var(--ease) both 0.3s;
}
.gw-rung.is-raw .gw-rung-bar i {
  background: rgba(255, 255, 255, 0.55);
}
@keyframes gw-grow-x {
  0% {
    transform: scaleX(0);
  }
}
.gw-rung b {
  font-size: var(--fs-md);
  white-space: nowrap;
}
.gw-pays {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-top: var(--s-3);
  padding: 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.07);
  border-left: 4px solid var(--gw-fix);
}
.gw-pays.is-yes {
  border-left-color: var(--gw-good);
}
.gw-pays.is-no {
  border-left-color: var(--gw-bad);
}
.gw-pays b {
  font-size: var(--fs-lg);
}
.gw-pays small {
  color: var(--gw-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh);
}
.gw-more {
  margin-top: var(--s-5);
  color: var(--gw-muted);
  font-size: var(--fs-sm);
}
.gw-more summary {
  cursor: pointer;
  text-align: center;
}
.gw-more-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: var(--s-3);
}
.gw-more-list span {
  display: grid;
  padding: 8px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
}
.gw-more-list b {
  color: #fff;
}
.gw-more-list small {
  font-size: var(--fs-2xs);
}

/* A likely 10: a short burst of confetti. */
.gw-confetti {
  position: absolute;
  inset: 0 0 auto;
  height: 0;
  pointer-events: none;
}
.gw-confetti i {
  position: absolute;
  top: 40px;
  left: 50%;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  background: #f9a8d4;
  opacity: 0;
  animation: gw-confetti 1.6s cubic-bezier(0.2, 0.6, 0.4, 1) 0.5s both;
}
.gw-confetti i:nth-child(3n) {
  background: #c4b5fd;
}
.gw-confetti i:nth-child(3n + 1) {
  background: #fde68a;
}
.gw-confetti i:nth-child(1) { --x: -150px; --r: 200deg; }
.gw-confetti i:nth-child(2) { --x: -120px; --r: -160deg; }
.gw-confetti i:nth-child(3) { --x: -90px; --r: 260deg; }
.gw-confetti i:nth-child(4) { --x: -60px; --r: -220deg; }
.gw-confetti i:nth-child(5) { --x: -30px; --r: 180deg; }
.gw-confetti i:nth-child(6) { --x: 0px; --r: -300deg; }
.gw-confetti i:nth-child(7) { --x: 30px; --r: 240deg; }
.gw-confetti i:nth-child(8) { --x: 60px; --r: -180deg; }
.gw-confetti i:nth-child(9) { --x: 90px; --r: 280deg; }
.gw-confetti i:nth-child(10) { --x: 120px; --r: -240deg; }
.gw-confetti i:nth-child(11) { --x: 150px; --r: 200deg; }
.gw-confetti i:nth-child(12) { --x: -170px; --r: -280deg; }
.gw-confetti i:nth-child(13) { --x: 170px; --r: 320deg; }
.gw-confetti i:nth-child(14) { --x: 10px; --r: 150deg; }
@keyframes gw-confetti {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) rotate(0);
  }
  35% {
    opacity: 1;
    transform: translate(calc(-50% + var(--x)), -40px) rotate(calc(var(--r) / 2));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--x) * 1.3), 320px) rotate(var(--r));
  }
}
@media (prefers-reduced-motion: reduce) {
  .gw-confetti {
    display: none;
  }
}
@media (min-width: 768px) {
  .gw-body {
    padding-top: var(--s-4);
  }
}

/* ---------- Proof video (v2-grade-video.js) ---------- */
/* Recording uses the same full-screen camera as the photos, with a fixed card-shaped frame. */
.gw[data-screen='video-rec'] .gw-cam {
  display: block;
}
.gw[data-screen='video-rec'] .gw-top {
  background: linear-gradient(rgba(8, 4, 20, 0.7), transparent);
}
.gw[data-screen='video-rec'] .gw-guide {
  display: none;
}
.gw[data-screen='video-rec'] .gw-cam::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 38%;
  width: min(56vw, 34vh);
  aspect-ratio: 63 / 88;
  border: 3px dashed rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.gw[data-screen='video-rec']:has(.gv-rec.is-recording) .gw-cam::after {
  border-style: solid;
  border-color: var(--gw-good);
}
.gw[data-screen='video-rec'] .gw-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: visible;
  background: linear-gradient(transparent 55%, rgba(8, 4, 20, 0.78));
}
.gv-rec .gw-tip {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.gv-rec.is-recording .gw-step-lead::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #ef4444;
  vertical-align: 1px;
  animation: gw-pulse 1s ease-in-out infinite;
}
.gv-move .i {
  transition: transform var(--dur-3, 0.4s) var(--ease);
}
.gv-move.is-top .i,
.gv-move.is-back .i {
  transform: rotate(-90deg);
}
.gv-move.is-up .i {
  transform: rotate(90deg);
}
.gv-move.is-right .i {
  transform: rotate(180deg);
}
.gv-track {
  position: relative;
  height: 6px;
  margin: 0 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
}
.gv-track b {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 6px;
  background: var(--gw-good);
  transition: width 0.2s linear;
}
.gv-track i {
  position: absolute;
  top: -3px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  z-index: 1;
}
.gv-track i.is-done {
  background: #fff;
}
.gv-shutter span {
  background: #ef4444;
  transition: border-radius var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.gv-shutter.is-recording span {
  border-radius: 10px;
  transform: scale(0.55);
}
.gv-time {
  color: #fff;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}
/* Intro: the owner's example clip, or a drawing of the phone circling the card. */
.gv-demo {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 3 / 2;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: radial-gradient(120% 90% at 50% 100%, rgba(139, 92, 246, 0.28), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.gv-demo-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gv-demo-art {
  width: 100%;
  height: 100%;
}
.gv-demo-art .gv-table {
  fill: rgba(255, 255, 255, 0.06);
}
.gv-demo-art .gv-card path {
  fill: #c4b5fd;
  stroke: #fff;
  stroke-width: 1.5;
}
.gv-demo-art .gv-path {
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
}
.gv-demo-art .gv-phone rect {
  fill: rgba(255, 255, 255, 0.92);
}
.gv-demo-art .gv-phone circle {
  fill: #1a1030;
}
.gv-demo-art .gv-phone {
  animation: gv-orbit 6s ease-in-out infinite;
}
.gv-demo-art .gv-light circle {
  fill: #fff;
  opacity: 0.55;
  filter: blur(4px);
  animation: gv-shine 6s ease-in-out infinite;
}
@keyframes gv-orbit {
  0%,
  100% {
    transform: translate(120px, 38px) rotate(0deg);
  }
  25% {
    transform: translate(62px, 70px) rotate(-28deg);
  }
  50% {
    transform: translate(120px, 30px) rotate(0deg) scale(0.92);
  }
  75% {
    transform: translate(178px, 70px) rotate(28deg);
  }
}
@keyframes gv-shine {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(18px, 4px);
  }
  50% {
    transform: translate(0, -8px);
  }
  75% {
    transform: translate(-18px, 4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .gv-demo-art .gv-phone,
  .gv-demo-art .gv-light circle {
    animation: none;
  }
}
.gv-demo-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: rgba(8, 4, 20, 0.55);
  color: #fff;
  font-size: var(--fs-xs, 12px);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gv-player {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #000;
}
.gv-player video {
  display: block;
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
}
.gv-review {
  display: grid;
  gap: var(--s-3);
}
.gv-saved {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-4) 0;
}
.gv-saved h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.gv-saved h3 small {
  opacity: 0.7;
  font-weight: var(--fw-regular, 400);
}
.gv-none {
  margin: var(--s-4) 0;
}

/* ---------- Grading on the card detail (v2-grade-card.js) ---------- */
.vg-cta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--grad);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 12px 28px -14px rgba(124, 58, 237, 0.7);
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.vg-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -14px rgba(124, 58, 237, 0.85);
}
.vg-cta-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
}
.vg-cta-main {
  flex: 1;
  min-width: 0;
}
.vg-cta-main b {
  display: block;
  font-size: var(--fs-lg);
}
.vg-cta-main small {
  display: block;
  opacity: 0.85;
}
.vg-list {
  margin-top: var(--s-3);
}
.vg-thumb {
  position: relative;
}
.vg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vg-play {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  box-shadow: 0 0 0 2px var(--surface, #fff);
}
.vg-value {
  display: grid;
  justify-items: end;
  line-height: 1.15;
}
.vg-value small {
  color: var(--muted, #888);
  font-size: var(--fs-xs, 12px);
}
.vg-panel .gv-saved h3 {
  font-size: var(--fs-md);
}

/* ---------- Grading tab of the scanner (pack.js) and card identification (v2-grade-identify.js), 23. 11. ---------- */
.scan-grade {
  min-height: calc(100dvh - 24px);
  align-content: start;
}
.scan-grade-body {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: var(--s-3);
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 84px) var(--s-4) calc(var(--safe-b, 0px) + var(--s-6));
  text-align: center;
}
.scan-grade-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: var(--grad);
  box-shadow: 0 18px 40px -12px rgba(224, 51, 143, 0.6);
  color: #fff;
}
.scan-grade-body h2 {
  margin: var(--s-2) 0 0;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
}
.scan-grade-body > p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--fs-md);
}
.scan-grade-steps {
  display: grid;
  gap: var(--s-2);
  width: 100%;
  margin: var(--s-3) 0;
  padding: 0;
  list-style: none;
  counter-reset: sg;
  text-align: left;
}
.scan-grade-steps li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: var(--s-3);
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
}
.scan-grade-steps li > span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(196, 181, 253, 0.18);
  color: #c4b5fd;
}
.scan-grade-steps b {
  font-size: var(--fs-md);
}
.scan-grade-steps small {
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--fs-sm);
}
.scan-grade-start {
  width: 100%;
}
.scan-grade-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
}

.gi {
  width: 100%;
  margin-top: var(--s-4);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}
.gi-running,
.gi-found {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.gi-running b,
.gi-main b {
  display: block;
  font-size: var(--fs-md);
}
.gi small {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: var(--fs-xs);
}
.gi-main {
  flex: 1;
  min-width: 0;
}
.gi-main b,
.gi-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gi-art,
.gi-thumb {
  flex: none;
  width: 40px;
}
.gi-art img,
.gi-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
}
.gi-printing {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
}
.gi-printing select {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
}
.gi-printing option {
  color: #1a1030;
}
.gi-pick > b {
  display: block;
  margin-bottom: var(--s-2);
}
.gi-list {
  display: grid;
  gap: 6px;
}
.gi-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.gi-row:hover {
  background: rgba(255, 255, 255, 0.14);
}
.gi-search {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
.gi-search .input {
  flex: 1;
  min-width: 0;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.gw-link {
  margin-top: var(--s-2);
  padding: 0;
  border: 0;
  background: none;
  color: #c4b5fd;
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
/* Three scanner modes on a phone: short labels, no icons, no centring spacer. */
@media (max-width: 460px) {
  .scan-modes a {
    padding: 0 11px;
  }
  .scan-modes a .i,
  .scan-modes .scan-mode-long {
    display: none;
  }
  .scan-top::after {
    display: none;
  }
}
/* The identification block must not widen the check screen (long set names). */
.gw-review,
.gw-result {
  grid-template-columns: minmax(0, 1fr);
}
.gi,
.gi-list,
.gi-row {
  min-width: 0;
  box-sizing: border-box;
}
.gw-review .gi,
.gw-result .gi {
  justify-self: stretch;
}
.gw-review [data-gi-box],
.gw-result [data-gi-box] {
  justify-self: stretch;
  width: 100%;
}

/* ---------- Centering overlay, materials, saving (v2-grade-overlay.js, v2-grade-wizard.js), 24. 11. ---------- */
.gw-section {
  margin-top: var(--s-6);
}
.gw-section h3,
.ov-head h3 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}
.ov-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.ov-sides {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
}
.ov-sides button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.ov-sides button.is-on {
  background: #fff;
  color: #1a1030;
}
.ov-stage {
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #05030b;
  touch-action: pan-y;
}
.ov-stage canvas[data-ov-img],
.ov-stage > img,
.ov-stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.ov-stage svg {
  touch-action: pan-y;
}
.ov-line {
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.ov-line.is-outer {
  stroke: rgba(255, 255, 255, 0.95);
}
.ov-line.is-inner {
  stroke: #f472b6;
}
.ov-line.is-sel {
  stroke: #34d399;
  stroke-width: 2.5px;
}
.ov-hit {
  stroke: transparent;
  stroke-width: 4.5;
  touch-action: none;
  cursor: grab;
}
.ov-pill-wrap {
  touch-action: none;
  cursor: grab;
}
.ov-pill-hit {
  fill: transparent;
  touch-action: none;
}
.ov-handle {
  stroke: #1a1030;
  stroke-width: 0.45;
  touch-action: none;
  cursor: grab;
}
.ov-grip {
  stroke: #1a1030;
  stroke-width: 0.4;
  stroke-linecap: round;
  pointer-events: none;
}
.ov-handle.is-outer {
  fill: #fff;
}
.ov-handle.is-inner {
  fill: #f472b6;
}
.ov-handle.is-sel {
  fill: #34d399;
}
.ov.is-edit .ov-tile canvas {
  touch-action: none;
}
.ov-picker {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.ov-pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ov-pick {
  flex: 1;
  min-width: 64px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
.ov-pick.is-on {
  background: #34d399;
  border-color: #34d399;
  color: #0b1610;
}
.ov-step {
  font-variant-numeric: tabular-nums;
  padding-inline: 10px;
}
.ov-loupe {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 132px;
  height: 132px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.ov-loupe[hidden] {
  display: none;
}
.ov-read {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.ov-read > span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
}
.ov-read small {
  color: rgba(255, 255, 255, 0.62);
  font-size: var(--fs-2xs);
}
.ov-read b {
  font-size: var(--fs-lg);
}
.ov-split.is-10 b {
  color: #6ee7b7;
}
.ov-split.is-9 b {
  color: #fde68a;
}
.ov-split.is-low b {
  color: #fda4af;
}
.ov-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 8px;
  margin: var(--s-2) 0 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--fs-xs);
}
.ov-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.ov-legend i.is-10 {
  background: rgba(52, 211, 153, 0.6);
}
.ov-legend i.is-9 {
  background: rgba(251, 191, 36, 0.55);
}
.ov-hint {
  margin: var(--s-3) 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--fs-sm);
  text-align: center;
}
.ov-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.ov-nudge {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.gw-slots {
  display: grid;
  gap: 6px;
  margin-top: var(--s-3);
}
.gw-slot {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.07);
}
.gw-slot-img {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
}
.gw-slot-img canvas,
.gw-slot-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gw-slot-main {
  display: grid;
  min-width: 0;
}
.gw-slot-main b {
  font-size: var(--fs-md);
}
.gw-slot-main small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-slot-main em {
  color: #6ee7b7;
  font-size: var(--fs-xs);
  font-style: normal;
  font-weight: var(--fw-semibold);
}
.gw-slot.is-empty .gw-slot-main em {
  color: rgba(255, 255, 255, 0.55);
}
.gw-slot.is-retake .gw-slot-main em {
  color: #fde68a;
}
.gw-slot-acts {
  display: flex;
  gap: 2px;
}
.gw-slot-acts .icon-btn {
  color: #fff;
  cursor: pointer;
}
.gw-materials .gw-fine {
  text-align: left;
}
.gw-saved {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  color: #a7f3d0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.gw-saved a {
  color: #fff;
  text-decoration: underline;
}
.gw-top-end {
  gap: 6px;
}
.gw-torch.is-on {
  background: #fde68a;
  color: #3b2300;
}
.ov-zoom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: var(--s-3);
}
.ov-tile {
  margin: 0;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: #05030b;
  touch-action: none;
}
.ov-tile canvas {
  display: block;
  width: 100%;
  height: auto;
}
.ov-tile figcaption {
  padding: 5px 8px;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.75);
}
.ov-tile figcaption b {
  color: #fff;
  text-transform: capitalize;
}
.ov.is-edit .ov-tile {
  outline: 1px dashed rgba(255, 255, 255, 0.35);
  cursor: ew-resize;
}

/* Opt-in warming class (fail-open: video is ALWAYS visible unless explicitly warming) */
.gw-cam video {
  transition: opacity 180ms ease;
}
.gw-cam video.is-warming {
  opacity: 0;
}
