/* Rubik's Cube Helper — feature styles */

.rubiks-page {
  max-width: 960px;
  margin: 0 auto;
}

.rubiks-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  margin-bottom: 1rem;
  transition: color 0.2s;
}

.rubiks-back:hover,
.rubiks-back:focus-visible {
  color: var(--color-coral);
  outline: none;
}

.rubiks-header {
  text-align: center;
  margin-bottom: 2rem;
}

.rubiks-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--color-coral);
  margin-bottom: 0.75rem;
}

.rubiks-instructions {
  background: var(--color-sun);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-size: 1.05rem;
  line-height: 1.55;
  box-shadow: var(--shadow-soft);
}

.rubiks-instructions strong {
  color: var(--color-text);
}

.rubiks-layout {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 900px) {
  .rubiks-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.rubiks-panel {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
}

.rubiks-panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

/* Color palette */
.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.color-swatch {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-sm);
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.color-swatch:hover,
.color-swatch:focus-visible {
  transform: scale(1.08);
  outline: none;
}

.color-swatch.is-selected {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px var(--color-sky);
}

.color-swatch-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  margin-top: 0.35rem;
  color: var(--color-text-muted);
}

.palette-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* View toggle */
.cube-view-toggle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.view-toggle-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  border: 3px solid var(--color-sky);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.view-toggle-btn:hover,
.view-toggle-btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
  color: var(--color-text);
}

.view-toggle-btn.is-active {
  background: var(--color-sky);
  color: white;
  box-shadow: 0 4px 0 var(--color-sky-dark);
}

.view-toggle-btn.is-active:hover,
.view-toggle-btn.is-active:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--color-sky-dark);
}

/* Cube viewport */
.cube-viewport {
  position: relative;
  margin-bottom: 0.75rem;
}

.cube-3d-container {
  width: 100%;
  max-width: 380px;
  height: min(380px, 55vw);
  min-height: 260px;
  margin: 0 auto;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #f8f4ff 0%, #e8f8f6 50%, #fff9e6 100%);
  box-shadow: inset 0 0 0 3px rgba(78, 205, 196, 0.25), var(--shadow-soft);
  overflow: hidden;
  touch-action: none;
}

.cube-3d-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.cube-3d-container[hidden],
.cube-net[hidden] {
  display: none;
}

.cube-view-hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.cube-view-hint strong {
  color: var(--color-text);
}

/* Cube net */
.cube-net {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  gap: 0.35rem;
  max-width: 340px;
  margin: 0 auto 1.25rem;
}

.cube-net-spacer {
  aspect-ratio: 1;
}

.cube-face {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  aspect-ratio: 1;
  padding: 4px;
  background: #dfe6e9;
  border-radius: 8px;
}

.cube-face-label {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.cube-face--u { grid-column: 2; grid-row: 1; }
.cube-face--l { grid-column: 1; grid-row: 2; }
.cube-face--f { grid-column: 2; grid-row: 2; }
.cube-face--r { grid-column: 3; grid-row: 2; }
.cube-face--b { grid-column: 4; grid-row: 2; }
.cube-face--d { grid-column: 2; grid-row: 3; }

.sticker {
  aspect-ratio: 1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.sticker:hover,
.sticker:focus-visible {
  transform: scale(1.06);
  outline: 2px solid var(--color-sky);
  outline-offset: 1px;
}

.sticker.is-center {
  cursor: default;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.sticker.is-center:hover,
.sticker.is-center:focus-visible {
  transform: none;
}

/* Sticker colors */
.sticker--U { background: #ffffff; }
.sticker--D { background: #ffd500; }
.sticker--F { background: #009b48; }
.sticker--B { background: #0046ad; }
.sticker--L { background: #ff5800; }
.sticker--R { background: #b71234; }

.rubiks-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn-secondary {
  background: var(--color-sky);
  color: white;
  box-shadow: 0 4px 0 var(--color-sky-dark);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--color-sky-dark);
  outline: none;
}

.btn-secondary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--color-sky-dark);
}

.btn-secondary:disabled,
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Messages */
.rubiks-message {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}

.rubiks-message--error {
  background: #ffe0e0;
  color: #c0392b;
  border: 2px solid #ff6b6b;
}

.rubiks-message--success {
  background: #dcfce7;
  color: #15803d;
  border: 2px solid var(--color-green);
}

.rubiks-message--info {
  background: #e0f7fa;
  color: #00695c;
  border: 2px solid var(--color-sky);
}

.rubiks-message[hidden] {
  display: none;
}

/* Solver loading */
.solver-status {
  text-align: center;
  padding: 1rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.solver-status .spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--color-sky);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Move legend */
.move-legend {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px dashed #eee;
}

.move-legend h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.move-legend dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.move-legend dt {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-purple);
}

.move-legend dd {
  color: var(--color-text-muted);
  margin: 0;
}

/* Solution steps */
.solution-panel[hidden] {
  display: none;
}

.solution-summary {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.current-step {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-left: 5px solid var(--color-purple);
}

.current-step-number {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.current-step-move {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-coral);
  margin-bottom: 0.5rem;
}

.current-step-desc {
  font-size: 1.05rem;
  line-height: 1.5;
}

.current-step-desc .face-highlight {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  color: white;
}

.face-highlight--U { background: #888; color: #fff; }
.face-highlight--D { background: #c9a800; color: #fff; }
.face-highlight--F { background: #009b48; }
.face-highlight--B { background: #0046ad; }
.face-highlight--L { background: #ff5800; }
.face-highlight--R { background: #b71234; }

.step-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
}

/* Three columns cannot wrap, so Previous and Next always share a line --
   they are a pair and reading them on separate rows made the count between
   them look like a heading for the second one. */
.step-nav .btn { font-size: 0.95rem; padding: 0.5rem 0.9rem; white-space: nowrap; }
.step-nav .btn:first-child { justify-self: start; }
.step-nav .btn:last-child { justify-self: end; }

.step-counter {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 8rem;
  text-align: center;
}

.steps-list-toggle {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-sky-dark);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.25rem;
}

.steps-list-toggle:hover,
.steps-list-toggle:focus-visible {
  color: var(--color-coral);
  outline: none;
}

.steps-list {
  max-height: 200px;
  overflow-y: auto;
  border: 2px solid #eee;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  margin-top: 0.75rem;
}

.steps-list[hidden] {
  display: none;
}

.steps-list ol {
  margin: 0;
  padding-left: 1.25rem;
}

.steps-list li {
  padding: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.steps-list li:hover,
.steps-list li.is-active {
  color: var(--color-text);
  font-weight: 600;
  background: var(--color-bg);
}

@media (max-width: 480px) {
  .cube-3d-container {
    min-height: 220px;
    height: min(320px, 70vw);
  }

  .cube-net {
    max-width: 280px;
  }

  .color-swatch {
    width: 2.35rem;
    height: 2.35rem;
  }

  .view-toggle-btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
  }
}
.learn-link { text-align: center; color: var(--color-text-muted); margin-top: 0.4rem; }

/* Live verdict while painting */
.live-status {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  min-height: 1.3em;
  margin-bottom: 0.5rem;
}

.live-status.is-good { color: #2f9e78; }
.live-status.is-bad { color: var(--color-coral); }

/* How many of each colour are left to place */
.color-swatch { position: relative; }

.swatch-left {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  min-width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--color-text);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.62rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.swatch-left.is-spent { background: #b8b0a0; }

/* Choosing how to solve */
.solve-methods {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.method {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.75rem;
  border: 2px solid #e8e2d8;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.method:has(input:checked) { border-color: var(--color-purple); background: #f7f4fd; }
.method input { margin-top: 0.25rem; }

/* Stage names inside a CFOP solution */
.step-stage {
  list-style: none;
  margin: 0.6rem 0 0.2rem -1.2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-purple);
}

.stage-tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  margin-right: 0.3rem;
  border-radius: 999px;
  background: #ede9fe;
  color: #7c3aed;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
}

/* An unpainted sticker: visibly nothing yet, so nothing gets forgotten. */
.sticker--none, .color-swatch.sticker--none {
  background: #b8b2a6;
  background-image: repeating-linear-gradient(45deg,
    transparent, transparent 4px, rgba(255, 255, 255, 0.25) 4px, rgba(255, 255, 255, 0.25) 8px);
}

/* Why a stage exists, said once as it begins */
.stage-why {
  display: block;
  margin-top: 0.45rem;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--color-purple);
  background: #f7f4fd;
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* The two views are one small segmented toggle, not two big buttons: it is a
   view switch, not an action, so it should not shout as loudly as Solve. */
.cube-view-toggle {
  display: inline-flex;
  gap: 0;
  padding: 3px;
  border: 2px solid #e8e2d8;
  border-radius: 999px;
  background: var(--color-bg);
}

.view-toggle-btn {
  padding: 0.3rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.view-toggle-btn.is-active {
  background: var(--color-sky);
  color: #fff;
}

.view-toggle-btn:focus-visible { outline: 2px solid var(--color-purple); outline-offset: 2px; }

/* Face-the-front sits in the corner of the cube it acts on. */
.cube-3d-container { position: relative; }

.face-front {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 2;
  padding: 0.22rem 0.6rem;
  border: 2px solid #e8e2d8;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.92);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.face-front:hover, .face-front:focus-visible {
  border-color: var(--color-purple);
  color: var(--color-text);
  outline: none;
}

/* --- Setting up the cube: three small, equal buttons on one line --- */
.rubiks-actions--setup {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.btn-small {
  font-size: 0.85rem;
  padding: 0.45rem 0.5rem;
  justify-content: center;
}

/* --- Choosing a method: a compact list, not three paragraphs --- */
.method-heading {
  margin: 1rem 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

.solve-methods { display: grid; gap: 0.35rem; margin-top: 0; }

.method {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
  padding: 0.5rem 0.65rem;
  border: 2px solid #e8e2d8;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  cursor: pointer;
}

.method:has(input:checked) { border-color: var(--color-purple); background: #f7f4fd; }

.method input { grid-row: 1; margin: 0; }

.method-name {
  grid-row: 1;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

.method-name em { font-style: normal; font-weight: 400; color: var(--color-text-muted); }

/* The move count is the honest trade-off, so it sits where the eye lands. */
.method-cost {
  grid-row: 1;
  justify-self: end;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--color-purple);
  white-space: nowrap;
}

.method-why {
  grid-row: 2;
  grid-column: 2 / -1;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.rubiks-actions--go { margin-top: 0.7rem; }
.rubiks-actions--go .btn { width: 100%; justify-content: center; }

/* --- The Move Guide is reference: available, not always open --- */
.move-legend > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.move-legend > summary::-webkit-details-marker { display: none; }

.move-legend > summary::before {
  content: "▸";
  color: var(--color-purple);
  font-size: 0.8rem;
  transition: transform 0.15s;
}

.move-legend[open] > summary::before { transform: rotate(90deg); }
.move-legend > summary h3 { display: inline; margin: 0; }
.move-legend-note { margin-top: 0.75rem; font-size: 0.85rem; color: var(--color-text-muted); }

@media (prefers-reduced-motion: reduce) {
  .move-legend > summary::before { transition: none; }
}

/* ---------------- Scanning with the camera ---------------- */

.scan {
  margin-top: 1rem;
  padding: 1rem 1.1rem 1.1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-purple);
  background: #f7f4fd;
}

.scan-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--color-purple); margin-bottom: 0.3rem; }
.scan-step { font-size: 0.95rem; color: var(--color-text); max-width: 60ch; margin-bottom: 0.7rem; min-height: 2.6em; }

/* The camera with the guide laid over it. Square, because a face is. */
.scan-stage {
  position: relative;
  width: min(22rem, 88vw);
  aspect-ratio: 1;
  margin: 0 auto 0.8rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #1f1d1a;
}

.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-video.is-mirrored { transform: scaleX(-1); }

.scan-guide {
  position: absolute;
  inset: 15%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  pointer-events: none;
}

.scan-guide span { border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,0.4) inset; }
.scan-guide-centre { border-width: 4px !important; }

/* The six faces, filling in as they are read */
.scan-faces { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-bottom: 0.8rem; }

.scan-face { display: grid; justify-items: center; gap: 0.2rem; opacity: 0.55; }
.scan-face.is-done { opacity: 1; }
.scan-face.is-now { opacity: 1; }
.scan-face.is-now .scan-face-grid { outline: 3px solid var(--color-purple); outline-offset: 2px; }

.scan-face-grid {
  display: grid;
  grid-template-columns: repeat(3, 0.9rem);
  gap: 2px;
  padding: 2px;
  background: #4a453e;
  border-radius: 4px;
}

.scan-face-grid span { width: 0.9rem; height: 0.9rem; border-radius: 2px; background: #6d6860; }
.scan-face-label { font-family: var(--font-display); font-weight: 600; font-size: 0.7rem; color: var(--color-text-muted); }

.scan-actions { justify-content: center; }
.scan-file-label { cursor: pointer; }
.scan-file-label:focus-within { outline: 2px solid var(--color-purple); outline-offset: 2px; }

.scan-note { text-align: center; font-size: 0.9rem; color: var(--color-text); margin: 0.6rem auto 0; max-width: 50ch; }
.scan-note.is-bad { color: #9b2c2c; }

.scan-privacy { text-align: center; font-size: 0.8rem; color: var(--color-text-muted); margin: 0.8rem auto 0; max-width: 52ch; }

/* ---------------- Scanner, second pass: photos, a movable guide, a tidier row ---------------- */

.rubiks-actions--scan { margin-bottom: 0.4rem; }
.rubiks-actions--scan .btn { width: 100%; justify-content: center; }

/* As its own panel the scanner no longer needs its own box. */
.scan { margin-top: 0; border-color: var(--color-purple); }
.scan-title { font-size: 1.15rem; }

/* A chosen photo is fitted whole, never cropped -- the kid places the guide. */
.scan-photo { width: 100%; height: 100%; object-fit: contain; display: block; background: #1f1d1a; }

/* The guide becomes something you can hold once a photo is up. */
.scan-guide.is-movable { pointer-events: auto; cursor: move; touch-action: none; }
.scan-guide.is-movable span:not(.scan-handle) { border-color: rgba(255, 255, 255, 0.95); }

.scan-handle {
  position: absolute;
  right: -0.7rem;
  bottom: -0.7rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--color-purple);
  border: 3px solid #fff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  cursor: nwse-resize;
  pointer-events: auto;
}

.scan-faces-hint { text-align: center; font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 0.4rem; }

/* Every face is a button now; keep the look, add the affordance. */
.scan-face { border: none; background: none; padding: 0.2rem; cursor: pointer; font: inherit; border-radius: 6px; }
.scan-face:hover .scan-face-grid, .scan-face:focus-visible .scan-face-grid { outline: 3px solid var(--color-purple); outline-offset: 2px; }
.scan-face:focus-visible { outline: none; }

/* Small buttons that wrap, instead of a wall of big ones. */
.scan-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
.scan-actions .btn { padding: 0.4rem 0.75rem; font-size: 0.82rem; }

.scan-numbers {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.5rem;
  border: 2px solid #e8e2d8;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  resize: vertical;
}

/* Which colour belongs at the top edge -- a pill on the guide, so it goes where the guide goes. */
.scan-top {
  position: absolute;
  left: 50%;
  top: -1.9rem;
  transform: translateX(-50%);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 2px solid #fff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.45);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

/* The one button that matters while scanning: big, full width, hard to miss with a cube in the other hand. */
.scan-actions .scan-big {
  flex-basis: 100%;
  justify-content: center;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
}

.scan-key {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.85;
  letter-spacing: 0.02em;
}

/* The site's .btn sets display, which quietly beats the browser's [hidden].
   In the scanner, hidden must mean hidden -- only the buttons for the moment show. */
.scan [hidden] { display: none !important; }
