/*
 * Cube Assist — clickable mockup.
 * Everything is scoped under .cube-proto so the mockup can live inside any page
 * (standalone or inline preview). Colours follow the host appearance via light-dark().
 */

.cube-proto {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* product palette (accent and radius can be tweaked in the preview) */
  --accent: #3454f5;
  --on-accent: #ffffff;
  --accent-hover: color-mix(in srgb, var(--accent) 84%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --bg: light-dark(#f3f5f9, #0d0f14);
  --surface: light-dark(#ffffff, #161922);
  --surface-2: light-dark(#f5f6fa, #1c2029);
  --surface-3: light-dark(#e9ecf3, #252a36);
  --line: light-dark(rgba(15, 23, 42, 0.10), rgba(255, 255, 255, 0.10));
  --line-strong: light-dark(rgba(15, 23, 42, 0.20), rgba(255, 255, 255, 0.20));
  --text: light-dark(#0f172a, #f1f5f9);
  --text-2: light-dark(#49536a, #b4bdcb);
  --text-3: light-dark(#7b8597, #8b96a8);
  --ok: light-dark(#137a3a, #5ee29a);
  --ok-soft: light-dark(#e6f6ec, #10291c);
  --bad: light-dark(#c0263a, #ff8493);
  --bad-soft: light-dark(#fdebee, #2c1418);

  --r-md: 12px;
  --r-xs: calc(var(--r-md) * 0.45);
  --r-sm: calc(var(--r-md) * 0.7);
  --r-lg: calc(var(--r-md) * 1.5);
  --r-xl: calc(var(--r-md) * 2);

  --shadow-lg: light-dark(0 18px 40px rgba(15, 23, 42, 0.14), 0 18px 40px rgba(0, 0, 0, 0.5));
  --shadow-md: light-dark(0 6px 18px rgba(15, 23, 42, 0.10), 0 6px 18px rgba(0, 0, 0, 0.35));
  --shadow-sm: light-dark(0 1px 2px rgba(15, 23, 42, 0.12), 0 1px 2px rgba(0, 0, 0, 0.4));

  --plastic: light-dark(#121317, #08090c);

  /* icon size; the conversation preview forces svg.lucide to var(--icon-size), so size icons through it */
  --icon-size: 1.15em;
  --c-U: #f6f6f4;
  --c-R: #e2243d;
  --c-F: #12ad5a;
  --c-D: #ffd41f;
  --c-L: #ff7d1f;
  --c-B: #1b74e8;

  font-family: var(--font);
  color: var(--text);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.cube-proto *,
.cube-proto *::before,
.cube-proto *::after {
  box-sizing: border-box;
}
.cube-proto [hidden] {
  display: none !important;
}
:where(.cube-proto) :where(button) {
  font: inherit;
  color: inherit;
  margin: 0;
}
.cube-proto svg.lucide {
  display: inline-block;
  width: var(--icon-size);
  height: var(--icon-size);
  flex: none;
  vertical-align: middle;
  stroke-width: 2;
}
/* the preview host renders bold at 500; keep the product's own weights */
.cube-proto b,
.cube-proto strong {
  font-weight: 700;
}

/* ---------------------------------------------------------------- */
/* Preview chrome (not part of the product)                          */
/* ---------------------------------------------------------------- */

.proto-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 2px 4px 12px;
  font-size: 13px;
  color: var(--muted-foreground, var(--text-2));
}
.proto-tag {
  font-weight: 600;
  color: var(--foreground, var(--text));
}
.proto-bar .spacer {
  flex: 1;
}
.pv-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--muted, light-dark(rgba(15, 23, 42, 0.07), rgba(255, 255, 255, 0.10)));
}
.pv-seg button,
.pv-btn {
  border: 0;
  background: transparent;
  color: var(--muted-foreground, var(--text-2));
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: var(--cursor-interaction, pointer);
}
.pv-seg button[aria-pressed="true"] {
  background: var(--primary, light-dark(#0f172a, #f1f5f9));
  color: var(--primary-foreground, light-dark(#ffffff, #0f172a));
}
.pv-btn:hover,
.pv-seg button:hover:not([aria-pressed="true"]) {
  color: var(--foreground, var(--text));
}

.proto-stage {
  display: grid;
  justify-items: stretch;
}
.device {
  position: relative;
  container: device / inline-size;
  min-width: 0;
}

/* phone frame */
.proto-stage[data-device="phone"] {
  justify-items: center;
  padding: 10px 0 14px;
}
.proto-stage[data-device="phone"] .device {
  position: relative;
  width: min(392px, 100%);
  padding: 9px;
  border-radius: 46px;
  background: light-dark(#15171c, #040508);
  box-shadow:
    inset 0 0 0 1.5px light-dark(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.16)),
    var(--shadow-lg);
}
.proto-stage[data-device="phone"] .device::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 98px;
  height: 27px;
  transform: translateX(-50%);
  border-radius: 14px;
  background: light-dark(#0a0b0e, #000);
  z-index: 5;
  pointer-events: none;
}
.proto-stage[data-device="phone"] .device::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 120px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: light-dark(rgba(15, 23, 42, 0.45), rgba(255, 255, 255, 0.55));
  z-index: 5;
  pointer-events: none;
}
/* The framed phone has a fixed screen: the page area scrolls inside it, the bars stay put. */
.proto-stage[data-device="phone"] .app {
  height: 830px;
  padding-top: 44px; /* camera island */
  border-radius: 38px;
  overflow: hidden;
}
.proto-stage[data-device="phone"] .app-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.proto-stage[data-device="phone"] .app-main::-webkit-scrollbar {
  display: none;
}
.proto-stage[data-device="phone"] .overlay-layer {
  border-radius: 38px;
  overflow: hidden;
}
.proto-stage[data-device="phone"] .toast {
  max-width: min(320px, calc(100vw - 48px));
}
.proto-stage[data-device="phone"] .tabbar {
  padding-bottom: 26px; /* keeps the labels clear of the home indicator */
}

/* ---------------------------------------------------------------- */
/* App shell                                                          */
/* ---------------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 8px 28px 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-title {
  display: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  border: 0;
  background: none;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 7px;
  background: var(--plastic);
  transform: rotate(-8deg);
}
.brand-mark i {
  border-radius: 2px;
}
.brand-mark i:nth-child(1) { background: var(--c-U); }
.brand-mark i:nth-child(2) { background: var(--c-R); }
.brand-mark i:nth-child(3) { background: var(--c-F); }
.brand-mark i:nth-child(4) { background: var(--c-D); }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--surface-2);
}

.steps {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0 auto;
  padding: 0;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 600;
}
.step + .step::before {
  content: "";
  width: 22px;
  height: 1px;
  margin-right: 8px;
  background: var(--line-strong);
}
.step-num {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 12px;
}
.step.is-done {
  color: var(--text-2);
}
.step.is-done .step-num {
  background: var(--ok-soft);
  color: var(--ok);
}
.step.is-on {
  color: var(--text);
}
.step.is-on .step-num {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------------------------------------------------------------- */
/* Shared pieces                                                      */
/* ---------------------------------------------------------------- */

:where(.cube-proto) :where(p, h1, h2, h3, ol, ul) {
  margin: 0;
}
.app h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 4.2cqw, 46px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 750;
}
.app h2 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lead {
  max-width: 48ch;
  margin-bottom: 26px;
  color: var(--text-2);
  font-size: 17px;
}
.muted {
  color: var(--text-3);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, filter 0.15s ease;
}
.btn:active:not([disabled]) {
  transform: scale(0.98);
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-md);
}
.btn-primary:hover:not([disabled]) {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.btn-secondary:hover:not([disabled]) {
  background: var(--surface-2);
}
.btn-ghost {
  color: var(--accent);
}
.btn-ghost:hover:not([disabled]) {
  background: var(--accent-soft);
}
.btn-lg {
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--r-md);
  font-size: 16.5px;
}
.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13.5px;
}
.btn-block {
  width: 100%;
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
}
.seg button {
  flex: 1;
  padding: 8px 12px;
  border: 0;
  border-radius: max(2px, calc(var(--r-sm) - 3px));
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.seg button.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.seg button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.seg-sm button {
  padding: 6px 10px;
  font-size: 13px;
}

.status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 18px 0 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 1.4;
}
.status svg {
  translate: 0 2px;
}
.status.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.status.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- */
/* 3D cube (CSS 3D, sized in container units)                         */
/* ---------------------------------------------------------------- */

.cv {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  container-type: inline-size;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  --u: 20cqw;
  /* Seen from above with a little yaw, the near bottom corner is the cube's lowest
     point and the perspective magnifies it, so the cube sits low in its box. The scene
     is raised by this many units to centre it (0.2 is right for the usual views). */
  --lift: 0.2;
}
.cv.is-dragging {
  cursor: grabbing;
}
.cv-stage {
  position: absolute;
  inset: 0;
  perspective: calc(var(--u) * 15);
}
.cv-scene {
  position: absolute;
  left: 50%;
  top: calc(50% - var(--u) * var(--lift));
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}
.cv.is-easing .cv-scene {
  transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cv-cubie {
  position: absolute;
  left: calc(var(--u) * -0.5);
  top: calc(var(--u) * -0.5);
  width: var(--u);
  height: var(--u);
  transform-style: preserve-3d;
}
.cv-face {
  position: absolute;
  inset: 0;
  border-radius: 7%;
  background: var(--plastic);
}
.cv-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.cv-face.pz { transform: translateZ(calc(var(--u) * 0.5)); }
.cv-face.pz::after { background: rgba(255, 255, 255, 0.03); }
.cv-face.nz { transform: rotateY(180deg) translateZ(calc(var(--u) * 0.5)); }
.cv-face.nz::after { background: rgba(0, 0, 0, 0.08); }
.cv-face.px { transform: rotateY(90deg) translateZ(calc(var(--u) * 0.5)); }
.cv-face.px::after { background: rgba(0, 0, 0, 0.10); }
.cv-face.nx { transform: rotateY(-90deg) translateZ(calc(var(--u) * 0.5)); }
.cv-face.nx::after { background: rgba(0, 0, 0, 0.14); }
.cv-face.py { transform: rotateX(90deg) translateZ(calc(var(--u) * 0.5)); }
.cv-face.py::after { background: rgba(255, 255, 255, 0.10); }
.cv-face.ny { transform: rotateX(-90deg) translateZ(calc(var(--u) * 0.5)); }
.cv-face.ny::after { background: rgba(0, 0, 0, 0.26); }

.cv-sticker {
  position: absolute;
  inset: 5.5%;
  border-radius: 18%;
  background: var(--c);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    inset 0 calc(var(--u) * -0.04) calc(var(--u) * 0.08) rgba(0, 0, 0, 0.14),
    inset 0 calc(var(--u) * 0.03) calc(var(--u) * 0.08) rgba(255, 255, 255, 0.22);
}
.cv-sticker.is-hidden {
  display: none;
}
.cv.is-editable .cv-sticker {
  cursor: pointer;
}
.cv.is-editable .cv-sticker:hover {
  filter: brightness(1.12);
  box-shadow:
    inset 0 0 0 calc(var(--u) * 0.04) var(--accent),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.cv-cubie.is-hint .cv-sticker {
  box-shadow:
    inset 0 0 0 calc(var(--u) * 0.05) rgba(255, 255, 255, 0.96),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.cv-cubie.is-mark .cv-sticker {
  box-shadow:
    inset 0 0 0 calc(var(--u) * 0.06) var(--accent),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.cv-cubie.is-dim .cv-sticker {
  filter: saturate(0.35) brightness(0.7);
}

/* ---------------------------------------------------------------- */
/* Home                                                               */
/* ---------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 48px;
  align-items: center;
  padding: 40px 0 16px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 30px;
}
.how {
  display: grid;
  gap: 11px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.how li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  font-size: 15px;
}
.how span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}
.hero-cube {
  padding: 14px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.hint {
  padding: 2px 0 4px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.tile:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.tile > svg {
  --icon-size: 24px;
  color: var(--accent);
}
.tile > svg:last-child {
  --icon-size: 18px;
  color: var(--text-3);
}
.tile-text strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
}
.tile-text span {
  display: block;
  margin-top: 1px;
  color: var(--text-2);
  font-size: 13.5px;
}
.how-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 22px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.how-card > svg {
  --icon-size: 22px;
  color: var(--accent);
}
.how-card > svg:last-child {
  --icon-size: 18px;
  margin-left: auto;
  color: var(--accent);
}
.how-card-text b {
  display: block;
  font-size: 15px;
  font-weight: 700;
}
.how-card-text span {
  font-size: 13.5px;
  color: var(--text-2);
}
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.stat {
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat b {
  display: block;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat b small {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
}
.stat span {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.3;
}

/* ---------------------------------------------------------------- */

.screen-scan {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 28px;
  align-items: start;
  padding-top: 20px;
}
.camera-feed {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--plastic);
  box-shadow: var(--shadow-lg);
}
.camera-scene {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 25% 15%, #7a6a58 0%, #4a3f36 45%, #241f1b 100%);
}
.camera-scene::before,
.camera-scene::after {
  content: "";
  position: absolute;
  border-radius: 40%;
  filter: blur(34px);
}
.camera-scene::before {
  left: -12%;
  top: 56%;
  width: 72%;
  height: 62%;
  background: #8c6b4f;
  opacity: 0.55;
}
.camera-scene::after {
  right: -8%;
  top: -12%;
  width: 48%;
  height: 52%;
  background: #d9c7a6;
  opacity: 0.5;
}
.face-grid {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(-4deg);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3.5%;
  padding: 4%;
  border-radius: 12%;
  background: #0c0d10;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.55);
}
.face-grid i {
  border-radius: 20%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.scan-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(-4deg);
  pointer-events: none;
}
.scan-frame i {
  position: absolute;
  width: 10%;
  height: 10%;
  border: 0 solid #ffffff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}
.scan-frame i:nth-child(1) { left: 0; top: 0; border-left-width: 3px; border-top-width: 3px; border-top-left-radius: 8px; }
.scan-frame i:nth-child(2) { right: 0; top: 0; border-right-width: 3px; border-top-width: 3px; border-top-right-radius: 8px; }
.scan-frame i:nth-child(3) { left: 0; bottom: 0; border-left-width: 3px; border-bottom-width: 3px; border-bottom-left-radius: 8px; }
.scan-frame i:nth-child(4) { right: 0; bottom: 0; border-right-width: 3px; border-bottom-width: 3px; border-bottom-right-radius: 8px; }
.camera-chip {
  position: absolute;
  left: 14px;
  top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}
.camera-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff5a5f;
}
.scan-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(12, 13, 16, 0.78);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.scan-toast.is-on {
  opacity: 1;
}
.scan-toast svg {
  color: #5ee29a;
}
.scan-flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}
.scan-flash.is-on {
  animation: scan-flash 0.5s ease-out;
}
@keyframes scan-flash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}
.scan-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
}
.shutter {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
.shutter span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--on-accent);
}
.shutter:active span {
  transform: scale(0.9);
}
.shutter[disabled] {
  opacity: 0.5;
  cursor: default;
}

.scan-guide {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
}
.guide-cube {
  aspect-ratio: 1;
}
.guide-text p:last-child {
  color: var(--text-2);
  font-size: 15px;
}
.face-progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.face-thumb {
  display: grid;
  gap: 3px;
  justify-items: center;
}
.face-thumb i {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  opacity: 0.6;
  font-style: normal;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.face-thumb i b {
  border-radius: 24%;
  background: var(--line-strong);
}
.face-thumb.is-done i {
  background: var(--plastic);
  opacity: 1;
}
.face-thumb.is-done i b {
  background: var(--c);
}
.face-thumb.is-now i {
  border-color: var(--accent);
  opacity: 1;
}
.face-thumb span {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- */
/* Setup: check the cube and pick the base colour                    */
/* ---------------------------------------------------------------- */

.screen-setup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
  align-items: center;
  padding-top: 12px;
}
.setup-cube {
  padding: 12px 14px 16px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.swatch {
  width: 38px;
  height: 38px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
}
.swatch:hover {
  transform: scale(1.06);
}
.swatch.is-on {
  box-shadow: 0 0 0 3px var(--accent);
}
.palette-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.setup-panel h1 {
  font-size: clamp(26px, 3.4cqw, 36px);
}
.swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}
.base-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.base-opt:hover:not([disabled]) {
  border-color: var(--line-strong);
}
.base-opt[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.base-opt[disabled] {
  cursor: progress;
}
.base-opt .dot {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}
.base-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14.5px;
}
.base-note svg {
  translate: 0 2px;
  color: var(--accent);
}
.base-note b {
  font-weight: 650;
  color: var(--text);
}
.meta {
  margin-top: 10px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

/* ---------------------------------------------------------------- */
/* Solution playback                                                  */
/* ---------------------------------------------------------------- */

.screen-solution {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding-top: 12px;
}
.play {
  position: relative;
  padding: 10px 20px 18px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  container: play / inline-size;
}
.play .cv {
  --u: 18.5cqw;
}
.now {
  /* In front of the cube: a corner that reaches this far must not cover the text */
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  margin: 0 0 12px;
  background: var(--surface);
}
.now-move {
  min-width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.now-move.is-flip svg {
  --icon-size: 32px;
}
.now-text {
  display: block;
  /* Room for a move that wraps to a second line: the block (and everything under it)
     then keeps its height from move to move instead of jumping. */
  min-height: calc(2 * 1.3em + 2px + 1.3 * 13px);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: pretty;
}
/* A narrow card also wraps the note under the move to two lines (it is up to 363px
   in German and French; with the move badge and the gap that needs 441px). */
@container play (max-width: 440px) {
  .now-text {
    min-height: calc(2 * 1.3em + 2px + 2 * 1.3 * 13px);
  }
}
.now-sub {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
}
.transport {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tp {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.tp:hover:not([disabled]) {
  background: var(--surface-3);
}
.tp[disabled] {
  opacity: 0.4;
  cursor: default;
}
.tp-play {
  width: 56px;
  height: 56px;
  border: 0;
  background: var(--text);
  color: var(--bg);
}
.tp-play:hover:not([disabled]) {
  background: var(--text);
  filter: brightness(1.15);
}
.transport .seg {
  margin-left: auto;
}
.progress {
  height: 6px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-3);
}
.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}
.counter {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--text-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.plan {
  display: grid;
  gap: 16px;
}
.stages {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stage {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 14.5px;
}
.stage-num {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 700;
}
.stage.is-done {
  color: var(--text-2);
}
.stage.is-done .stage-num {
  background: var(--ok-soft);
  color: var(--ok);
}
.stage.is-on {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}
.stage.is-on .stage-num {
  background: var(--accent);
  color: var(--on-accent);
}
.stage-count {
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.moves {
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.moves-group {
  display: grid;
  gap: 6px;
}
.moves-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}
.moves-head b {
  font-weight: 700;
}
.moves-head svg {
  transition: transform 0.2s ease;
}
.moves-group:not(.is-open) .moves-head svg {
  transform: rotate(-90deg);
}
.moves-group.is-open .moves-head {
  color: var(--text-2);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.chip.is-done {
  border-style: dashed;
  background: transparent;
  color: var(--text-3);
}
.chip.is-now {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}
.chip.is-flip {
  font-size: 11.5px;
  font-weight: 650;
}
.chip svg {
  --icon-size: 16px;
}

.done-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: inherit;
  text-align: center;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.done-inner {
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: 340px;
}
.done-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
}
.done-icon svg {
  --icon-size: 32px;
}
.done-inner h2 {
  font-size: 24px;
}
.done-inner p {
  color: var(--text-2);
  font-size: 15px;
}
.done-stats {
  display: flex;
  gap: 24px;
  margin: 12px 0 14px;
}
.done-stats div {
  display: grid;
  gap: 0;
}
.done-stats b {
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.done-stats span {
  color: var(--text-3);
  font-size: 12.5px;
}
.done-actions {
  display: grid;
  gap: 8px;
  width: 100%;
}

/* ---------------------------------------------------------------- */
/* Section navigation and language menu                               */
/* ---------------------------------------------------------------- */

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
}
.nav-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-tabs button:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-tabs button.is-on {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav-tabs button svg {
  --icon-size: 18px;
}
.tabbar {
  display: none;
}
.lang-menu {
  position: relative;
  flex: none;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 0 10px 0 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lang-btn svg {
  --icon-size: 18px;
}
.lang-btn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 216px;
  max-height: 460px;
  overflow: auto;
  padding: 6px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.15s ease;
}
.pop button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
}
.pop button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.pop button.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.pop button svg {
  --icon-size: 16px;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes cube-spin {
  to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------- */
/* More shared pieces                                                 */
/* ---------------------------------------------------------------- */

.card {
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.card-head .eyebrow {
  margin: 0;
}
.card-head h2 {
  margin: 0;
  font-size: 17px;
}
.card-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-tools .btn-sm {
  min-height: 32px;
}
.page-head {
  padding: 30px 0 8px;
}
.page-head .lead {
  margin-bottom: 18px;
}
.progress-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.progress-line .progress {
  flex: 1;
  margin: 0;
}
.progress-line span {
  color: var(--text-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.small {
  font-size: 13px;
}
.center {
  text-align: center;
}
.spacer {
  flex: 1;
}
.tabular-nums {
  font-variant-numeric: tabular-nums;
}
.btn-danger {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}
.btn-danger:hover:not([disabled]) {
  background: color-mix(in srgb, var(--bad) 20%, transparent);
}
.icon-btn.btn-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
}
.icon-btn.btn-sm svg {
  --icon-size: 16px;
}
.icon-btn.btn-sm.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.chip-btn {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.chip-btn.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
/* notation chips that only display a move are not buttons */
.cube-proto span.chip {
  cursor: default;
}
.cube-proto span.chip:hover {
  border-color: var(--line);
  color: var(--text-2);
}
.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}
.switch.is-on {
  background: var(--accent);
  box-shadow: none;
}
.switch.is-on::after {
  transform: translateX(18px);
  background: var(--on-accent);
}
.switch[aria-hidden="true"] {
  pointer-events: none;
}
svg.lucide-loader-circle {
  animation: cube-spin 1s linear infinite;
}
.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--text-3);
  font-size: 14.5px;
  text-align: center;
}
.empty svg {
  --icon-size: 28px;
  opacity: 0.7;
}

/* ---------------------------------------------------------------- */
/* Set-up: solving method                                             */
/* ---------------------------------------------------------------- */

.methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}
.method {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.method:hover:not([disabled]) {
  border-color: var(--line-strong);
}
.method > svg {
  --icon-size: 22px;
  flex: none;
  margin-top: 1px;
  color: var(--text-3);
}
.method > span {
  min-width: 0;
}
.method b {
  display: block;
  font-size: 15px;
  font-weight: 650;
}
.method span span {
  display: block;
  margin-top: 3px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.35;
}
.method.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.method.is-on > svg {
  color: var(--accent);
}
.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.voice-toggle.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.voice-toggle svg {
  --icon-size: 17px;
}

/* ---------------------------------------------------------------- */
/* Timer                                                              */
/* ---------------------------------------------------------------- */

.timer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  align-items: start;
  padding-top: 22px;
}
.timer-main,
.timer-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.scramble-card {
  padding-bottom: 16px;
}
.scramble {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
}
.timer-pad {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  min-height: 320px;
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.timer-pad:active {
  transform: scale(0.995);
}
.timer-pad.is-armed {
  background: var(--ok-soft);
  border-color: var(--ok);
}
.timer-pad.is-inspect {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg);
}
.timer-pad.is-running {
  background: var(--surface-2);
}
.timer-pad.is-result {
  cursor: default;
}
.clock {
  font-size: clamp(56px, 9cqw, 104px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.timer-pad.is-armed .clock,
.timer-pad.is-running .clock {
  color: var(--ok);
}
.timer-pad.is-inspect .clock {
  color: var(--accent);
}
.timer-hint {
  max-width: 34ch;
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
}
.check-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
}
.check-card > span {
  display: grid;
  gap: 2px;
  font-size: 14.5px;
  font-weight: 600;
}
.check-card small {
  color: var(--text-3);
  font-size: 13px;
  font-weight: 400;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.chart-card {
  padding: 14px 16px 12px;
}
.chart-card .field-label {
  margin-bottom: 8px;
}
.spark {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.spark circle {
  fill: var(--accent);
}
.spark circle.is-dnf {
  fill: var(--bad);
}
.bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
  height: 118px;
}
.bar {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 16px;
  gap: 5px;
  min-width: 0;
}
.bar i {
  align-self: end;
  min-height: 3px;
  height: var(--h);
  border-radius: 6px 6px 2px 2px;
  background: color-mix(in srgb, var(--accent) 78%, transparent);
}
.bar.is-wide i {
  background: var(--accent);
}
.bar span {
  color: var(--text-3);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.solves-card {
  grid-column: 1 / -1;
}
.solves {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
}
.solve {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "n time ao5 scr actions";
  align-items: center;
  column-gap: 12px;
  row-gap: 5px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.solve:first-child {
  border-top: 0;
}
.solve-n {
  grid-area: n;
  min-width: 26px;
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.solve-time {
  grid-area: time;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.solve-time em {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.solve-ao5 {
  grid-area: ao5;
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.solve-scramble {
  grid-area: scr;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 28px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 28px);
}
.solve-scramble .chip {
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  font-size: 12px;
}
.solve-actions {
  grid-area: actions;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.solve.is-dnf .solve-time {
  color: var(--bad);
}
.solve-dot {
  grid-area: n;
  width: 14px;
  height: 14px;
  margin: 0 6px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.solves.is-history .solve {
  padding: 10px 0;
}
.solves.is-history .solve-time {
  font-size: 19px;
}
.solves.is-history .solve-ao5 {
  color: var(--text-2);
  font-size: 13.5px;
}
/* here the last text is the date, not a scramble */
.solves.is-history .solve-scramble {
  display: block;
  overflow: visible;
  color: var(--text-3);
  font-size: 12.5px;
  white-space: nowrap;
  text-align: right;
  mask-image: none;
  -webkit-mask-image: none;
}

/* ---------------------------------------------------------------- */
/* Learning                                                           */
/* ---------------------------------------------------------------- */

.lesson-list {
  display: grid;
  gap: 8px;
}
.lesson-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 16px 10px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.lesson-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.lesson-num {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.lesson-num svg {
  --icon-size: 22px;
}
.lesson-row .lesson-text {
  min-width: 0;
}
.lesson-row .lesson-text b {
  display: block;
  font-size: 15.5px;
  font-weight: 650;
}
.lesson-row .lesson-text span {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13.5px;
}
.lesson-row > svg {
  --icon-size: 18px;
  color: var(--text-3);
}
.lesson-row.is-done .lesson-num {
  background: var(--ok-soft);
  color: var(--ok);
}
.lesson-row.is-done .lesson-text b {
  color: var(--text-2);
}

.lesson {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  padding-top: 26px;
}
.lesson > .lesson-text {
  min-width: 0;
  padding-top: 18px;
}
.lesson > .lesson-text h1 {
  font-size: clamp(26px, 3.4cqw, 36px);
}
.lesson > .lesson-text h2 {
  margin-top: 24px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lesson > .lesson-text p {
  color: var(--text-2);
  font-size: 15.5px;
}
.spot {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.spot li {
  position: relative;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 15.5px;
}
.spot li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.66em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.alg-sep {
  align-self: center;
  padding: 0 6px;
  color: var(--text-3);
  font-weight: 700;
}
.alg-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.alg-note {
  flex-basis: 100%;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 13.5px;
}
.tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14.5px;
}
.tip svg {
  --icon-size: 18px;
  flex: none;
  translate: 0 2px;
  color: var(--accent);
}
.lesson-cube {
  position: sticky;
  top: 78px;
  display: grid;
  gap: 12px;
  padding: 14px 18px 16px;
  box-shadow: var(--shadow-lg);
}
.demo-moves {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
}
.demo-moves .chip {
  transition: transform 0.15s ease;
}
.demo-moves .chip.is-now {
  transform: scale(1.1);
}
.lesson-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.lesson-controls .btn {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding: 12px 2px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--text-2);
  font-size: 14px;
  text-align: left;
}
.check-row.as-button {
  width: 100%;
  cursor: pointer;
}
.lesson-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 6px;
}
.lesson-nav {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
}
.notation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}
.notation-face {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.notation-letter {
  font-size: 20px;
  font-weight: 800;
}
.notation-name {
  color: var(--text-3);
  font-size: 12.5px;
}
.notation-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.notation-moves .chip {
  min-width: 0;
  height: 28px;
  padding: 0 7px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- */
/* Settings                                                           */
/* ---------------------------------------------------------------- */

.settings {
  display: grid;
  max-width: 780px;
}
.set-heading:first-child {
  margin-top: 12px;
}
.set-heading {
  margin: 30px 0 10px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.set-group {
  display: grid;
  padding: 2px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 0;
}
.set-row + .set-row,
.lang-list + .set-row,
.set-row + .lang-list {
  border-top: 1px solid var(--line);
}
.set-row.is-stack {
  flex-direction: column;
  align-items: stretch;
}
.set-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
}
.set-text small {
  color: var(--text-3);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}
.set-row > .seg {
  flex: none;
}
.set-value {
  color: var(--text-3);
  font-size: 14px;
}
.lang-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 2px 0 14px;
}
.lang-opt {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.lang-opt:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.lang-opt.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.base-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.base-list .base-opt {
  padding: 8px 12px;
  font-size: 14px;
}

/* ---------------------------------------------------------------- */
/* Installing the app                                                 */
/* ---------------------------------------------------------------- */

/* the brand mark at the size of an app icon */
.app-icon {
  width: 42px;
  height: 42px;
  gap: 3px;
  padding: 4px;
  border-radius: 11px;
}
.app-icon i {
  border-radius: 3px;
}

/* Home is a column whose order can differ by layout: the offer to install is its first child,
   but on the computer it comes after the cube and the introduction. */
.home {
  display: flex;
  flex-direction: column;
}
.home > *,
.home > .hero > *,
.home > .hero > .hero-copy > * {
  flex: none;
}
.home > .install-card {
  order: 1;
}
.home > .tiles {
  order: 2;
}
.home > .stats-strip {
  order: 3;
}
/* On the computer the introduction has its place first: the offer waits until that card is gone. */
@container device (min-width: 768px) {
  .home:has(> .how-card) > .install-card {
    display: none;
  }
}

/* Home: the offer to install, between the cube and the section tiles */
.install-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "app text actions";
  align-items: center;
  gap: 10px 14px;
  margin-top: 22px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.install-app {
  grid-area: app;
}
.install-card-text {
  grid-area: text;
  min-width: 0;
}
.install-card-text b {
  display: block;
  font-size: 15px;
  font-weight: 700;
}
.install-card-text span {
  font-size: 13.5px;
  color: var(--text-2);
}
.install-card-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 4px;
}
.install-later {
  border-color: transparent;
  background: transparent;
}
.install-later:hover {
  background: var(--surface-2);
}

/* The install window: the app icon and the way out to the instructions */
.install-icon .app-icon {
  width: 30px;
  height: 30px;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
}
.install-icon .app-icon i {
  border-radius: 2px;
}
.install-manual {
  margin-top: 12px;
}

/* Instructions: a device switch and three steps for each */
.install-sheet > .eyebrow,
.install-sheet > h2 {
  padding-right: 44px;
}
.install-platforms {
  margin-top: 14px;
}
.install-steps {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  padding: 0;
  list-style: none;
}
.install-steps li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.install-num {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}
.install-step p {
  padding-top: 3px;
  font-size: 15px;
  line-height: 1.4;
}
.install-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
/* Buttons of the visitor's browser, in its own colours: an action ("blue"), a line of its menu
   ("dark") and an icon on the toolbar ("soft"). */
.chip-browser {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
}
.chip-browser.is-blue {
  background: #0a84ff;
  color: #ffffff;
}
.chip-browser.is-dark {
  background: light-dark(#1c1c1e, #3a3a3c);
  color: #ffffff;
}
.chip-browser.is-soft {
  background: light-dark(rgba(10, 132, 255, 0.12), rgba(10, 132, 255, 0.24));
  color: #0a84ff;
}
.install-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13.5px;
}
.install-bar .site {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.install-bar .chip-browser {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
}
.install-note {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.4;
}
.install-note svg {
  flex: none;
  translate: 0 2px;
}
/* inside the browser of another app (Telegram, VK…) this is the part that matters */
.install-note.is-urgent {
  background: var(--accent-soft);
  color: var(--text);
}
.install-sheet .sheet-actions {
  margin-top: 18px;
}

/* ---------------------------------------------------------------- */
/* Overlays: sheets, dialogs, toasts                                  */
/* ---------------------------------------------------------------- */

/* Above everything. The script sizes the layer to the part of the device that is on screen. */
.overlay-layer {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}
.overlay-layer > * {
  pointer-events: auto;
}
.scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: light-dark(rgba(15, 23, 42, 0.48), rgba(0, 0, 0, 0.62));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  cursor: default;
}
.sheet {
  position: relative;
  width: min(100%, 640px);
  max-height: calc(100% - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: sheet-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dialog {
  position: relative;
  width: min(100%, 420px);
  padding: 26px 24px 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.2s ease;
}
.dialog h2 {
  font-size: 20px;
}
.dialog p {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 15px;
}
.dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.dialog-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.dialog-icon svg {
  --icon-size: 26px;
}
.how-sheet {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: center;
  gap: 20px 28px;
}
.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border-color: transparent;
  background: transparent;
}
.how-cube {
  width: 100%;
}
.how-body h2 {
  font-size: 22px;
}
.how-body p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 15.5px;
}
.sheet-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.dots {
  display: inline-flex;
  gap: 6px;
}
.dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: width 0.2s ease, background 0.2s ease;
}
.dots i.is-on {
  width: 18px;
  background: var(--accent);
}
.toast {
  position: fixed;
  left: 50%;
  z-index: 70;
  max-width: min(92vw, 440px);
  padding: 10px 18px;
  border-radius: 18px;
  background: light-dark(#0f172a, #f1f5f9);
  color: light-dark(#f1f5f9, #0f172a);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  translate: -50% calc(-100% + 10px);
  pointer-events: none;
  transition: opacity 0.2s ease, translate 0.2s ease;
}
.toast.is-on {
  opacity: 1;
  translate: -50% -100%;
}

@media (prefers-reduced-motion: reduce) {
  .pop,
  .sheet,
  .dialog,
  svg.lucide-loader-circle {
    animation: none;
  }
}

/* ---------------------------------------------------------------- */
/* Phone layout (container query on the device wrapper)              */
/* ---------------------------------------------------------------- */

@container device (max-width: 767px) {
  .app-main {
    padding: 4px 16px 36px;
  }
  .topbar {
    position: static;
    height: 54px;
    padding: 0 12px;
    gap: 8px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .brand,
  .steps {
    display: none;
  }
  .topbar-title {
    display: block;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app h1 {
    font-size: 26px;
  }
  .app h2 {
    font-size: 18px;
  }
  .lead {
    margin-bottom: 18px;
    font-size: 15.5px;
  }
  /* The hero comes apart into the home column (display: contents): the cube first, then the copy —
     and the offer to install stands right under the buttons. */
  .hero,
  .hero-copy {
    display: contents;
  }
  .hero > .hero-cube {
    order: 0;
    margin: 4px 0 14px;
    padding: 4px;
    box-shadow: var(--shadow-md);
  }
  .hero-copy > .eyebrow {
    order: 1;
  }
  .hero-copy > h1 {
    order: 2;
  }
  .hero-copy > .lead {
    order: 3;
  }
  .hero-copy > .hero-actions {
    order: 4;
  }
  .hero-copy > .how {
    order: 6;
  }
  .hero-cube .hint {
    padding-bottom: 8px;
  }
  .hero-actions {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
  }
  .hero-actions .btn {
    width: 100%;
  }
  /* the offer to install: under the buttons, from the first visit; what follows the steps
     comes after them */
  .home > .install-card {
    order: 5;
    margin: 0 0 20px;
  }
  .home > .how-card {
    order: 7;
  }
  .home > .tiles {
    order: 8;
  }
  .home > .stats-strip {
    order: 9;
  }
  .install-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "app text"
      ". actions";
    row-gap: 12px;
  }
  .install-card-actions .btn {
    flex: 1;
  }
  .home:has(> .install-card) .hero-actions {
    margin-bottom: 12px;
  }
  .how {
    gap: 9px;
  }
  .how li {
    font-size: 14px;
  }
  .tiles {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 16px;
  }
  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .screen-scan,
  .screen-setup,
  .screen-solution {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding-top: 2px;
  }
  .camera-feed {
    aspect-ratio: 1 / 0.92;
  }
  .face-grid,
  .scan-frame {
    width: 50%;
  }
  .scan-actions {
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }
  .scan-guide {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .guide-text p:last-child {
    font-size: 13.5px;
  }
  .face-progress {
    gap: 5px;
  }
  .face-thumb span {
    font-size: 11px;
  }
  .setup-cube {
    padding: 6px 8px 14px;
    box-shadow: var(--shadow-md);
  }
  .screen-setup .cv {
    --u: 16.5cqw;
  }
  .setup-panel h1 {
    font-size: 24px;
  }
  .swatches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .play {
    padding: 6px 12px 14px;
    box-shadow: var(--shadow-md);
  }
  /* A cube this size reaches about 4.5 units from its lowest to its highest corner;
     the box leaves room for it above and below, clear of the move hint. */
  .play .cv {
    --u: 18cqw;
    aspect-ratio: 1 / 0.94;
  }
  .now-move {
    min-width: 56px;
    height: 56px;
    font-size: 26px;
  }
  .now-text {
    font-size: 15.5px;
  }
  .transport {
    flex-wrap: wrap;
  }
  .transport .seg {
    width: 100%;
    margin-left: 0;
  }
  .stage {
    font-size: 14px;
  }
  .done-card {
    padding: 16px;
  }
  .done-inner h2 {
    font-size: 21px;
  }
}

/* Phone: the new screens in one column, and the bottom tab bar */
@container device (max-width: 767px) {
  .nav-tabs,
  .topbar > .icon-btn[data-act="tab"] {
    display: none;
  }
  .tabbar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 6px 8px max(8px, env(safe-area-inset-bottom, 8px));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar button {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 6px 4px 5px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
  }
  .tabbar button.is-on {
    color: var(--accent);
  }
  .tabbar button svg {
    --icon-size: 22px;
  }
  .app-main {
    padding-bottom: 20px;
  }
  .pop {
    right: -4px;
  }
  .card {
    padding: 14px;
    border-radius: var(--r-md);
  }
  .page-head {
    padding: 12px 0 14px;
  }
  .methods {
    grid-template-columns: minmax(0, 1fr);
  }
  .timer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding-top: 10px;
  }
  .timer-main,
  .timer-side {
    gap: 12px;
  }
  /* the scramble's tools turn icon-only so they fit beside its title */
  .scramble-card .card-tools .btn {
    width: 32px;
    padding: 0;
  }
  .scramble-card .card-tools .btn span {
    display: none;
  }
  .timer-pad {
    min-height: 250px;
    padding: 20px 16px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
  }
  .timer-pad.is-inspect {
    box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
  }
  .stat-grid {
    gap: 8px;
  }
  .stat {
    padding: 10px 12px;
  }
  .stat b {
    font-size: 18px;
  }
  .solves-card .solve {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "n time actions"
      "n ao5 actions"
      ". scr scr";
  }
  .solves-card .solve-scramble {
    flex-wrap: wrap;
    justify-content: flex-start;
    mask-image: none;
    -webkit-mask-image: none;
  }
  .solves.is-history .solve-dot {
    align-self: start;
    margin-top: 7px;
  }
  .solves.is-history .solve {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "n time actions"
      "n ao5 ao5"
      "n scr scr";
  }
  .lesson {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-top: 8px;
  }
  /* The cube follows the title; the rest of the text comes after it. */
  .lesson > .lesson-text {
    display: contents;
  }
  .lesson > .lesson-text > * {
    order: 5;
  }
  .lesson > .lesson-text > .eyebrow {
    order: -1;
  }
  .lesson > .lesson-text > h1 {
    order: 0;
  }
  .lesson > .lesson-text > :nth-child(3),
  .lesson > .lesson-text > :nth-child(4),
  .lesson > .lesson-text > .lead {
    order: 1;
  }
  .lesson > .lesson-text > :nth-child(4) {
    margin-bottom: 0;
  }
  .lesson-cube {
    position: static;
    order: 3;
    margin: 16px 0 8px;
    padding: 12px;
    box-shadow: var(--shadow-md);
  }
  .lesson-cube .cv {
    --u: 20cqw;
    aspect-ratio: 1 / 1.04;
  }
  .lesson-footer {
    order: 6;
    flex-direction: column-reverse;
    align-items: stretch;
    margin-top: 14px;
  }
  .lesson-footer > .btn {
    width: 100%;
  }
  .lesson-nav {
    margin: 0;
  }
  .lesson-nav .btn {
    flex: 1;
  }
  .lesson-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 10px 12px 10px 10px;
    border-radius: var(--r-md);
  }
  .lesson-num {
    width: 40px;
    height: 40px;
  }
  .notation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .set-group {
    padding: 2px 14px;
  }
  .set-row > .seg {
    width: 100%;
  }
  .lang-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .install-steps {
    gap: 14px;
  }
  /* sheets slide up from the bottom edge */
  .overlay-layer:not(.is-dialog) {
    align-items: flex-end;
    padding: 0;
  }
  .sheet {
    width: 100%;
    max-height: calc(100% - 60px);
    padding: 18px 16px 30px;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .how-sheet {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    padding-top: 6px;
    text-align: center;
  }
  .how-cube {
    width: min(210px, 66%);
  }
  .how-skip,
  .sheet-actions .spacer {
    display: none;
  }
  .sheet-actions .btn-primary {
    flex: 1;
  }
}
.proto-stage[data-device="phone"] .overlay-layer:not(.is-dialog) {
  align-items: flex-end;
  padding: 0;
}
.proto-stage[data-device="phone"] .sheet {
  width: 100%;
  max-height: calc(100% - 60px);
  padding: 18px 16px 30px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
