/* Solvent — a precise engineering instrument. Dark slate base, the six cube
   colors as restrained accents, technical monospace type. */

:root {
  --slate: #12151a;
  --slate-2: #171b22;
  --slate-3: #1e242d;
  --line: #2a323d;
  --line-2: #384250;
  --ink: #f4f6f8;
  --ink-dim: #aab4c0;
  --ink-faint: #6c7885;

  --c-white: #f4f6f8;
  --c-yellow: #f5c518;
  --c-green: #2ec27e;
  --c-blue: #2b7fff;
  --c-red: #e5484d;
  --c-orange: #f2792b;

  --focus: #2b7fff;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--slate);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: var(--c-blue); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--c-blue);
  color: #fff;
  padding: 8px 14px;
  z-index: 20;
}
.skip-link:focus { left: 8px; top: 8px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(14px, 4vw, 32px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.wordmark {
  height: 38px;
  width: auto;
  display: block;
}
.size-select { display: flex; align-items: center; gap: 10px; }
.size-select__label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.size-buttons { display: flex; gap: 6px; }
.size-btn {
  font-family: var(--mono);
  background: var(--slate-2);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
.size-btn[aria-pressed="true"] { color: var(--ink); border-color: var(--c-blue); background: var(--slate-3); }
.size-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---------- layout ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px);
}

.steps ol {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0 0 22px;
  flex-wrap: wrap;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.steps li span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--slate-3);
  font-size: 11px;
}
.steps li[aria-current="step"] { color: var(--ink); border-color: var(--line-2); }
.steps li[aria-current="step"] span { background: var(--c-blue); color: #fff; }
.steps li[data-done="true"] span { background: var(--c-green); color: #05261a; }

.screen { display: none; }
.screen.is-active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.screen__head { margin-bottom: 20px; }
h1 {
  font-size: clamp(22px, 4vw, 30px);
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}
.lede { color: var(--ink-dim); max-width: 62ch; margin: 0; font-size: 14.5px; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--slate-2);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 11px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.btn:hover { border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--c-blue); border-color: var(--c-blue); color: #fff; font-weight: 600; }
.btn--primary:hover { background: #1f6ef0; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-dim); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---------- capture ---------- */
.capture-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  align-items: start;
}
.camera-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #05070a;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; background: #05070a; }
.reticle {
  position: absolute;
  inset: 20%;
  border: 2px solid rgba(244, 246, 248, 0.95);
  border-radius: 10px;
  /* A light scrim only — just enough to lift the reticle off the feed. The
     camera image must read at its true brightness (and brighten as the user
     adds light), so this stays subtle; the crisp border does the framing. */
  box-shadow: 0 0 0 100vmax rgba(5, 7, 10, 0.16), 0 0 0 1px rgba(5, 7, 10, 0.5);
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(var(--gn, 2), 1fr);
  grid-template-rows: repeat(var(--gn, 2), 1fr);
}
.reticle::before { content: none; }
/* Corner brackets, normally invisible, that pulse once when the guide's turn
   completes and the face locks in — the "arrival tick", synced to the guide. */
.reticle::after {
  content: "";
  position: absolute;
  inset: -6px;
  pointer-events: none;
  opacity: 0;
  --bl: 20px;
  --bw: 2.5px;
  background:
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / var(--bl) var(--bw),
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / var(--bw) var(--bl),
    linear-gradient(var(--ink), var(--ink)) right 0 top 0 / var(--bl) var(--bw),
    linear-gradient(var(--ink), var(--ink)) right 0 top 0 / var(--bw) var(--bl),
    linear-gradient(var(--ink), var(--ink)) left 0 bottom 0 / var(--bl) var(--bw),
    linear-gradient(var(--ink), var(--ink)) left 0 bottom 0 / var(--bw) var(--bl),
    linear-gradient(var(--ink), var(--ink)) right 0 bottom 0 / var(--bl) var(--bw),
    linear-gradient(var(--ink), var(--ink)) right 0 bottom 0 / var(--bw) var(--bl);
  background-repeat: no-repeat;
}
.reticle.arrived::after { animation: arrival-tick 600ms ease-out both; }
.reticle i {
  border: 1px dashed rgba(244, 246, 248, 0.4);
  position: relative;
}
/* Live read-out chip: the colour Solvent currently reads in this cell. Hidden
   until the live loop paints it (reticle gets .live), so it never shows a stale
   or empty swatch. A low-confidence read is dimmed and ringed to say "unsure". */
.reticle-chip {
  position: absolute;
  top: 6px;
  left: 6px;
  width: clamp(14px, 4.5vmin, 22px);
  height: clamp(14px, 4.5vmin, 22px);
  border-radius: 4px;
  border: 1.5px solid rgba(5, 7, 10, 0.55);
  box-shadow: 0 0 0 1.5px rgba(244, 246, 248, 0.85);
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease;
}
.reticle.live .reticle-chip { opacity: 1; }
.reticle.live .reticle-chip[data-low="true"] {
  opacity: 0.55;
  box-shadow: 0 0 0 1.5px var(--c-yellow);
}
.live-legend {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.62);
  color: rgba(244, 246, 248, 0.92);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}
.camera-wrap.is-live .live-legend { opacity: 1; }
@keyframes arrival-tick {
  0% { opacity: 0; transform: scale(1.03); }
  22% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
/* Mirror for a front / selfie camera: the raw preview reads reversed, so flip it
   to feel natural; the guide + wording flip in lockstep (see app.js). */
.camera-wrap.is-mirrored #video { transform: scaleX(-1); }
@media (prefers-reduced-motion: reduce) {
  .reticle.arrived::after,
  .guide-stage.arrived::after { animation: none; }
}
/* Auto-capture countdown ring: a thin blue arc that sweeps closed over ~0.8s once
   the frame holds steady and reads cleanly, then fires the capture. Sized to sit
   just outside the reticle so it frames the shot rather than obscuring it. */
.auto-ring {
  position: absolute;
  inset: 16%;
  pointer-events: none;
  overflow: visible;
  transform: rotate(-90deg); /* start the sweep from 12 o'clock */
}
/* An author `display` beats the UA [hidden] rule, so restore it explicitly. */
.auto-ring[hidden] { display: none; }
.auto-ring__track,
.auto-ring__fill {
  fill: none;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}
.auto-ring__track { stroke: rgba(43, 127, 255, 0.18); }
.auto-ring__fill {
  stroke: var(--c-blue);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100; /* JS drives 100 -> 0 as the countdown fills */
  filter: drop-shadow(0 0 3px rgba(43, 127, 255, 0.5));
}

/* Hold-steady indicator: a compact instrument pill in the corner of the preview.
   Amber while the phone is moving, green once it settles — a "moving / steady"
   read, never a "hold it level" demand. Driven by the device motion sensor. */
.steady-pill {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(18, 21, 26, 0.72);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(2px);
}
.steady-pill[hidden] { display: none; }
.steady-pill__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex: 0 0 auto;
  transition: background 0.2s;
}
.steady-pill[data-steady="moving"] { border-color: rgba(245, 197, 24, 0.5); }
.steady-pill[data-steady="moving"] .steady-pill__dot { background: var(--c-yellow); }
.steady-pill[data-steady="steady"] { border-color: rgba(46, 194, 126, 0.55); }
.steady-pill[data-steady="steady"] .steady-pill__dot {
  background: var(--c-green);
  box-shadow: 0 0 6px rgba(46, 194, 126, 0.7);
}

/* Assistive-toggle row (Auto / Sound / Steady): quieter than the primary actions,
   and each lights its own accent when engaged so state is never color-only. */
#btn-auto[aria-pressed="true"] {
  border-color: var(--c-green);
  color: var(--ink);
  background: rgba(46, 194, 126, 0.14);
  font-weight: 600;
}
#btn-sound[aria-pressed="true"] {
  border-color: var(--c-blue);
  color: var(--ink);
  background: rgba(43, 127, 255, 0.14);
  font-weight: 600;
}
#btn-play[aria-pressed="true"] {
  border-color: var(--c-green);
  color: var(--ink);
  background: rgba(46, 194, 126, 0.14);
  font-weight: 600;
}

.camera-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--ink-dim);
  font-size: 14px;
  background: rgba(5, 7, 10, 0.85);
}

.capture-side { display: flex; flex-direction: column; gap: 16px; }
/* The turn-guide card: an animated demonstration of the exact whole-cube turn
   for this scan step, with a technical HUD readout over the canvas. */
.capture-target {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--slate-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.guide-stage {
  position: relative;
  background: radial-gradient(circle at 50% 42%, #1a1f27, #0c0e13);
  border-bottom: 1px solid var(--line);
}
.guide-view {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 240px;
}
/* engineered corner brackets, echoing the camera reticle */
.guide-stage::after {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  opacity: 0.28;
  background:
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / 15px 1.5px,
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / 1.5px 15px,
    linear-gradient(var(--ink), var(--ink)) right 0 top 0 / 15px 1.5px,
    linear-gradient(var(--ink), var(--ink)) right 0 top 0 / 1.5px 15px,
    linear-gradient(var(--ink), var(--ink)) left 0 bottom 0 / 15px 1.5px,
    linear-gradient(var(--ink), var(--ink)) left 0 bottom 0 / 1.5px 15px,
    linear-gradient(var(--ink), var(--ink)) right 0 bottom 0 / 15px 1.5px,
    linear-gradient(var(--ink), var(--ink)) right 0 bottom 0 / 1.5px 15px;
  background-repeat: no-repeat;
}
/* The guide's own frame brackets brighten once as the demonstrated turn lands,
   in sync with the reticle's arrival tick. */
.guide-stage.arrived::after { animation: guide-tick 600ms ease-out; }
@keyframes guide-tick {
  0% { opacity: 0.28; }
  22% { opacity: 0.9; }
  100% { opacity: 0.28; }
}
.guide-hud {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.guide-hud__step,
.guide-hud__turn {
  background: rgba(18, 21, 26, 0.72);
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}
.guide-hud__step {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  border: 1px solid var(--line);
}
.guide-hud__turn {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink);
  border: 1px solid var(--line-2);
}
.capture-target__info { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 16px 14px; }
.capture-target__label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }
.capture-target__face { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.capture-target__face .face-dot {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: var(--slate-3);
  flex: 0 0 auto;
}
.capture-target__hint { font-size: 13px; color: var(--ink-dim); }

/* Immediate read-back of the colors the scan actually captured for this face —
   a small instrument grid so misreads are caught at scan time, not just Verify. */
.scan-readback { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.scan-readback__label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.scan-readback__grid {
  display: grid;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--slate);
}
.scan-readback__grid i {
  display: block;
  width: 15px;
  height: 15px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.35);
}

.face-progress { display: flex; gap: 8px; flex-wrap: wrap; }
.face-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink-dim);
  background: var(--slate-2);
  cursor: pointer;
}
.face-chip .swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.35); }
.face-chip[data-active="true"] { border-color: var(--c-blue); color: var(--ink); }
.face-chip[data-done="true"] { border-color: var(--c-green); }
.face-chip[data-done="true"]::after { content: "✓"; color: var(--c-green); font-size: 12px; }

/* "Recheck this face" marker — a small amber badge, distinct from the green
   done-tick and the blue active border. A gentle nudge, never an error. */
.face-chip__flag {
  display: none;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  color: var(--slate);
  background: var(--c-yellow);
}
.face-chip[data-flag="true"] { border-color: var(--c-yellow); }
.face-chip[data-flag="true"] .face-chip__flag { display: block; }

.capture-actions { display: flex; gap: 10px; }
.capture-actions .btn { flex: 1; }
#btn-flash[aria-pressed="true"] {
  border-color: var(--c-yellow);
  color: #12151a;
  background: var(--c-yellow);
  font-weight: 600;
}
#btn-mirror[aria-pressed="true"] {
  border-color: var(--c-blue);
  color: var(--ink);
  background: rgba(43, 127, 255, 0.14);
  font-weight: 600;
}
/* One-time selfie-camera hint. Restrained: a thin blue-keyed note that points at
   the Mirror control, dismissible, and shown at most once per session. */
.mirror-nudge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-dim);
  background: rgba(43, 127, 255, 0.08);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--c-blue);
  border-radius: 8px;
}
.mirror-nudge b { color: var(--ink); font-weight: 600; }
.mirror-nudge__x {
  flex: 0 0 auto;
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.mirror-nudge__x:hover { color: var(--ink); border-color: var(--line-2); }

.fineprint { font-size: 12.5px; color: var(--ink-faint); margin: 0; }

/* ---------- review / net ---------- */
.palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  align-items: center;
}
.swatch-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  outline-offset: 3px;
}
.swatch-btn[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(43,127,255,0.35); }
.palette__label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-right: 4px; }

/* cross-style net layout for 6 faces */
.net {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
  margin-bottom: 20px;
}
.net-face {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--slate-2);
}
.net-face[data-face="U"] { grid-column: 2; grid-row: 1; }
.net-face[data-face="L"] { grid-column: 1; grid-row: 2; }
.net-face[data-face="F"] { grid-column: 2; grid-row: 2; }
.net-face[data-face="R"] { grid-column: 3; grid-row: 2; }
.net-face[data-face="B"] { grid-column: 4; grid-row: 2; }
.net-face[data-face="D"] { grid-column: 2; grid-row: 3; }
.net-face__label { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.sticker-grid { display: grid; gap: 5px; }
.sticker {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.4);
  cursor: pointer;
  background: var(--slate-3);
  transition: transform 0.05s;
}
.sticker:active { transform: scale(0.94); }
.sticker[data-empty="true"] { background: var(--slate-3); border-style: dashed; border-color: var(--line-2); }

/* Low-confidence scan read: a restrained double ring — a dark inner separator so
   the amber outer ring reads on every sticker color (including yellow/white) and
   on the dark net. Slowly pulses to draw the eye without alarming; a static ring
   under reduced motion. Box-shadow only, so it never shifts layout or hit area. */
.sticker[data-lowconf="true"] {
  box-shadow: 0 0 0 1px var(--slate), 0 0 0 3px var(--c-yellow);
  animation: recheck-pulse 1.9s ease-in-out infinite;
}
@keyframes recheck-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--slate), 0 0 0 3px rgba(245, 197, 24, 0.5); }
  50%      { box-shadow: 0 0 0 1px var(--slate), 0 0 0 3px rgba(245, 197, 24, 1); }
}

/* Verify-screen uncertainty summary. Amber-keyed and clearly not the red error
   box — a "look here," paired with the on-net highlights. */
.uncertain-note {
  margin-bottom: 16px;
  padding: 10px 12px 10px 13px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-dim);
  background: rgba(245, 197, 24, 0.07);
  border: 1px solid rgba(245, 197, 24, 0.32);
  border-left: 2px solid var(--c-yellow);
  border-radius: 8px;
}

.validation { margin-bottom: 18px; min-height: 4px; }
.validation__ok {
  color: var(--c-green);
  border: 1px solid rgba(46,194,126,0.4);
  background: rgba(46,194,126,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}
.validation__errs {
  border: 1px solid rgba(229,72,77,0.45);
  background: rgba(229,72,77,0.08);
  border-radius: 10px;
  padding: 12px 14px;
}
.validation__errs h2 { font-size: 14px; margin: 0 0 8px; color: var(--c-red); }
.validation__errs ul { margin: 0; padding-left: 18px; }
.validation__errs li { font-size: 13.5px; color: var(--ink-dim); margin-bottom: 4px; }
/* Heads-up (not an error): shown when a valid cube reads as a mirror-image
   color scheme, so a mis-entered standard cube can be caught before solving. */
.validation__note {
  margin-top: 10px;
  border: 1px solid rgba(245,197,24,0.45);
  border-left: 3px solid var(--c-yellow);
  background: rgba(245,197,24,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--ink-dim);
}

.review-actions, .stepper { display: flex; gap: 10px; flex-wrap: wrap; }
.review-actions { margin-top: 8px; }

/* ---------- solution ---------- */
.solve-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 22px;
  align-items: start;
}
.viewer {
  aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 40%, #1a1f27, #0c0e13);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.viewer:active { cursor: grabbing; }
/* "Set up your cube" card — the starting-orientation anchor before move 1. */
.setup-card {
  margin: 0 0 18px;
  border: 1px solid rgba(43,127,255,0.4);
  border-left: 3px solid var(--c-blue);
  background: rgba(43,127,255,0.07);
  border-radius: 12px;
  padding: 14px 16px;
}
.setup-card__label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-blue);
  margin-bottom: 6px;
}
.setup-card__text { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.5; }
.setup-card__hold { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; }
.setup-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.setup-chip .face-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  flex: 0 0 auto;
}

.solve-side { display: flex; flex-direction: column; gap: 14px; }
.move-readout {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--slate-2);
}
.move-readout__count { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); display: block; }
.move-readout__hint { font-size: 18px; }
.move-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
  max-height: 180px;
  overflow: auto;
}
.move-list li {
  font-size: 15px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--slate-2);
  color: var(--ink-dim);
  min-width: 42px;
  text-align: center;
}
.move-list li[data-state="done"] { color: var(--ink-faint); border-color: var(--line); }
.move-list li[data-state="current"] { color: #fff; border-color: var(--c-blue); background: var(--slate-3); }
.move-list li[data-state="todo"] { color: var(--ink); }
.solved-banner {
  border: 1px solid rgba(46,194,126,0.5);
  background: rgba(46,194,126,0.1);
  color: var(--c-green);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

/* ---------- footer ---------- */
.app-footer {
  border-top: 1px solid var(--line);
  padding: 16px clamp(14px, 4vw, 32px);
  color: var(--ink-faint);
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.app-footer .dot { color: var(--line-2); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .solve-grid { grid-template-columns: 1fr; }
  .wordmark { height: 30px; }
  .net { max-width: 100%; }

  /* Mobile scan layout: the two things a one-handed scanner needs — the camera
     showing the whole cube, and the Capture button — must both sit on screen at
     once. So the camera is height-capped to a comfortable square, the Capture /
     Skip actions are pulled up directly beneath it, and the guide card, face
     chips and secondary controls flow BELOW. `display: contents` flattens the
     right-hand column so its children can be reordered inline with the camera. */
  .capture-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .capture-side { display: contents; }
  .camera-wrap {
    order: -2;
    width: min(100%, 46vh);
    aspect-ratio: 1 / 1;
    height: auto;
    margin-inline: auto;
  }
  .capture-actions--primary { order: -1; margin-inline: auto; width: min(100%, 46vh); }
  /* Tighten the header block so more of the viewport is the live preview. */
  .screen__head { margin-bottom: 14px; }
}
@media (max-width: 380px) {
  body { font-size: 15px; }
  .swatch-btn { width: 36px; height: 36px; }
  .btn { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-active { animation: none; }
  * { scroll-behavior: auto; }
  /* Keep the low-confidence marker as a steady ring — no pulse. */
  .sticker[data-lowconf="true"] {
    animation: none;
    box-shadow: 0 0 0 1px var(--slate), 0 0 0 3px var(--c-yellow);
  }
}
