/* ==========================================================================
   Algorithm library
   --------------------------------------------------------------------------
   The thumbnails are the point of this app, so the list is built as a
   contact sheet: even cells, generous air, the diagram first and the
   metadata quiet underneath it. Everything is composed from the tokens in
   base.css — no second palette, no second type scale.
   ========================================================================== */

/* --------------------------------------------------------------------- */
/* Thumbnails                                                             */
/* --------------------------------------------------------------------- */

.thumb {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  background: var(--ink-050);
  overflow: hidden;
}

.thumb .rt-thumb,
.thumb__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb__blank {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-300);
  background:
    repeating-linear-gradient(45deg, var(--ink-050) 0 6px, var(--paper) 6px 12px);
}

.thumb--sm {
  width: 44px;
  min-width: 44px;
  height: 44px;
  aspect-ratio: auto;
}

.thumb--hero {
  width: 100%;
  max-width: 260px;
  background: transparent;
}

/* --------------------------------------------------------------------- */
/* The list toolbar                                                       */
/* --------------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
}

.toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
}
.toolbar__row--end {
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.toolbar__search { flex: 2 1 260px; min-width: 200px; }
.toolbar__field { flex: 1 1 150px; min-width: 140px; }

.toolbar__starred {
  margin-right: auto;
  font-size: 0.88rem;
  font-weight: 560;
  color: var(--ink-700);
}

.toolbar__views button { white-space: nowrap; }

/* --------------------------------------------------------------------- */
/* Results region                                                         */
/* --------------------------------------------------------------------- */

.results { display: flex; flex-direction: column; gap: var(--space-5); }
.results[aria-busy="true"] { opacity: 0.55; transition: opacity var(--dur) var(--ease); }

.results__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.results__count {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.92rem;
}
.results__count b { color: var(--ink-900); font-variant-numeric: tabular-nums; }
.results__clear { margin-left: var(--space-3); font-size: 0.88rem; }

.results__block { display: flex; flex-direction: column; gap: var(--space-3); }

.results__hint {
  margin: var(--space-6) 0 0;
  color: var(--ink-400);
  font-size: 0.84rem;
}
.results__hint kbd {
  display: inline-block;
  padding: 1px 6px;
  margin-inline: 1px;
  border: 1px solid var(--ink-200);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--paper);
  font-size: 0.78rem;
  color: var(--ink-700);
}

.group-head {
  position: sticky;
  top: calc(var(--header-h) + 8px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border: 1px solid var(--ink-200);
  box-shadow: var(--shadow-xs);
  font-size: 0.95rem;
  width: fit-content;
}
.group-head__name { color: var(--ink-900); }
.group-head__count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--ink-100);
  color: var(--ink-500);
  font-size: 0.76rem;
  font-weight: 660;
}

/* --------------------------------------------------------------------- */
/* The contact sheet                                                      */
/* --------------------------------------------------------------------- */

.case-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

.case-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.case-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--ink-300);
  transform: translateY(-2px);
}
.case-card:focus-within { border-color: var(--accent); }
.case-card.is-starred { border-color: #f3d18a; box-shadow: 0 0 0 1px #f7e3b5 inset, var(--shadow-xs); }
.case-card.is-unstarred { opacity: 0.5; }

.case-card__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  color: inherit;
  text-decoration: none;
}
.case-card__link:hover { text-decoration: none; color: inherit; }
.case-card__link:focus-visible { outline-offset: 4px; }

.case-card__head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.case-card__name {
  font-weight: 620;
  color: var(--ink-900);
  font-size: 0.95rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.case-card__group {
  font-size: 0.78rem;
  color: var(--ink-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.case-card__meta .score-meter { min-width: 74px; flex: 1 1 74px; }

.case-card__foot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--ink-100);
  margin-top: auto;
  flex-wrap: wrap;
}
.case-card__spacer { flex: 1 1 auto; }
.case-card__noalg { font-size: 0.78rem; color: var(--ink-400); font-style: italic; }

.alg--tight {
  font-size: 0.74rem;
  padding: 3px 7px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.case-time {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.case-time b { font-size: 0.86rem; color: var(--ink-900); font-weight: 640; }
.case-time i { font-size: 0.7rem; color: var(--ink-400); font-style: normal; }
.case-time--none { font-size: 0.74rem; color: var(--ink-300); }

.star-form { display: inline-flex; margin: 0; }
.star-btn[aria-busy="true"] { opacity: 0.5; }

/* --------------------------------------------------------------------- */
/* Compact table                                                          */
/* --------------------------------------------------------------------- */

.case-table td, .case-table th { padding: var(--space-2) var(--space-3); }
.case-table .case-row__thumb { width: 56px; }
.case-row__name { font-weight: 560; min-width: 160px; }
.case-row__name a { color: var(--ink-900); }
.case-row__group { display: block; font-size: 0.76rem; color: var(--ink-400); font-weight: 400; }
.case-row__alg { max-width: 260px; }
.case-row__score { min-width: 110px; }
.case-row__star { width: 44px; }
.case-row.is-starred { background: #fffdf5; }
.case-row.is-unstarred { opacity: 0.5; }
.dash { color: var(--ink-300); }

/* --------------------------------------------------------------------- */
/* Hub                                                                    */
/* --------------------------------------------------------------------- */

.library-phases { margin-bottom: var(--space-6); }

.callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid #cfd8ff;
  background: linear-gradient(180deg, var(--accent-soft), var(--paper));
}
.callout__title { margin: 0 0 var(--space-2); font-size: 1.08rem; }
.callout__text { max-width: 60ch; }
.callout__text p { margin: 0; color: var(--ink-500); font-size: 0.92rem; }

.phase-card { display: flex; flex-direction: column; gap: var(--space-4); }
.phase-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.phase-card__title { margin: 0; font-size: 1.25rem; }
.phase-card__title a { color: var(--ink-900); }
.phase-card__count { margin: 0; font-size: 0.9rem; color: var(--ink-500); }
.phase-card__count b { color: var(--ink-900); }
.phase-card__meter { min-height: 24px; }

.phase-card__stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  border-top: 1px solid var(--ink-100);
  padding-top: var(--space-3);
}
.phase-card__stats li { display: flex; flex-direction: column; }
.phase-card__stats b {
  font-size: 1.05rem;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.phase-card__stats span { font-size: 0.72rem; color: var(--ink-400); }

.phase-card__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: auto; }

.phase-card--f2l { border-top: 3px solid var(--phase-f2l); }
.phase-card--oll { border-top: 3px solid var(--phase-oll); }
.phase-card--pll { border-top: 3px solid var(--phase-pll); }

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.todo-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--ink-100);
}
.todo-item:last-child { border-bottom: 0; }
.todo-item__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
}
.todo-item__link:hover { text-decoration: none; }
.todo-item__link:hover .todo-item__name { color: var(--accent); }
.todo-item__text { display: flex; flex-direction: column; min-width: 0; }
.todo-item__name {
  font-weight: 580;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-item__group { font-size: 0.76rem; color: var(--ink-400); }
.todo-item__meta { display: flex; align-items: center; gap: var(--space-3); }

.empty--hero { padding: var(--space-8) var(--space-5); }
.empty--tight { padding: var(--space-5) var(--space-4); }
.empty__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------- */
/* Case page                                                              */
/* --------------------------------------------------------------------- */

.case-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.case-nav__up { font-size: 0.9rem; font-weight: 560; color: var(--ink-500); }
.case-nav__pager { display: flex; gap: var(--space-2); }

.case-head {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  margin-bottom: var(--space-6);
}
.case-head__diagram {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}
.case-head__text { min-width: 0; }
.case-head__badges { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.case-head__badges a.badge:hover { text-decoration: none; filter: brightness(0.97); }
.case-head__status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.case-head__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.score-meter--lg { min-width: 160px; }
.score-meter--lg .meter { height: 8px; }
.score-meter--lg b { font-size: 0.95rem; color: var(--ink-900); }

.case-facts {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin: 0 0 var(--space-4);
}
.case-facts dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-400);
  font-weight: 620;
}
.case-facts dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 620;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.case-facts--stacked { margin-bottom: var(--space-4); gap: var(--space-6); }

.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}
.case-main, .case-side { min-width: 0; }

/* self-assessment */
.assess { display: flex; flex-direction: column; gap: var(--space-4); }
.assess__scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-2);
  border: 0;
  margin: 0;
  padding: 0;
}
.assess__option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
  font-weight: 500;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.assess__option:hover { border-color: var(--ink-300); background: var(--ink-050); }
.assess__option:has(input:checked),
.assess__option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.assess__option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.assess__option input { flex: none; }
.assess__value {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink-100);
  color: var(--ink-700);
  font-size: 0.8rem;
  font-weight: 700;
  flex: none;
}
.assess__option.is-selected .assess__value,
.assess__option:has(input:checked) .assess__value { background: var(--accent); color: #fff; }
.assess__label { font-size: 0.86rem; color: var(--ink-700); line-height: 1.25; }

.assess__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.assess__state { margin: 0; font-size: 0.86rem; color: var(--ink-500); }

/* viewer embed */
.case-viewer-host { margin-top: var(--space-2); }
.case-viewer__legend { margin: var(--space-3) 0 0; font-size: 0.86rem; color: var(--ink-500); }
.case-viewer__legend b { font-family: var(--font-mono); color: var(--ink-900); font-weight: 500; }
.case-viewer__fallback { margin: 0; font-size: 0.9rem; color: var(--ink-500); }

/* algorithms */
.alg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.alg-list__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: var(--ink-050);
}
.alg-list__item.is-primary { background: var(--paper); border-color: #cfd8ff; box-shadow: var(--shadow-xs); }
.alg-list__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.alg-list__label { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.alg-list__name { font-size: 0.88rem; font-weight: 580; color: var(--ink-700); }
.alg-list__count { font-size: 0.78rem; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.alg-list__item .alg { display: block; width: 100%; font-size: 0.95rem; padding: 10px 12px; }
.alg-list__notes { margin: 0; font-size: 0.86rem; color: var(--ink-500); }
.alg-list__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.alg-list__source { margin: 0; font-size: 0.74rem; color: var(--ink-400); }

.case-scramble {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--ink-100);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}
.case-scramble__title { margin: 0; font-size: 0.95rem; }
.case-scramble__hint { margin: 0; font-size: 0.84rem; color: var(--ink-500); }
.case-scramble .alg { width: 100%; }

.case-notes { margin: 0; color: var(--ink-600, var(--ink-500)); }
.case-source { margin: 0; font-size: 0.78rem; color: var(--ink-400); text-align: right; }

/* history */
.trend { display: block; width: 100%; height: 40px; overflow: visible; }
.trend__caption { margin: var(--space-2) 0 var(--space-4); font-size: 0.76rem; color: var(--ink-400); }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--ink-100);
  font-size: 0.88rem;
}
.history__item:last-child { border-bottom: 0; }
.history__time { font-variant-numeric: tabular-nums; font-weight: 620; color: var(--ink-900); min-width: 68px; }
.history__item.is-dnf .history__time { color: var(--danger); }
.history__source { color: var(--ink-400); font-size: 0.78rem; flex: 1 1 auto; }
.history__when { color: var(--ink-400); font-size: 0.78rem; white-space: nowrap; }

.media-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.media-list__item img { border-radius: var(--radius-sm); border: 1px solid var(--ink-200); width: 100%; }

/* --------------------------------------------------------------------- */
/* Responsive                                                             */
/* --------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .case-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .case-head { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .case-head__diagram { max-width: 220px; }
  .toolbar { position: static; padding: var(--space-4); }
  .toolbar__row--end { justify-content: flex-start; }
  .toolbar__starred { margin-right: 0; }
  .group-head { top: 4px; }
}

@media (max-width: 560px) {
  .case-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: var(--space-3); }
  .case-card { padding: var(--space-2); gap: var(--space-2); }
  .case-card__name { font-size: 0.88rem; }
  .case-card__foot { padding-top: var(--space-2); }
  .case-card__meta .score-meter { min-width: 60px; }
  .assess__scale { grid-template-columns: minmax(0, 1fr); }
  .case-facts { gap: var(--space-4); }
  .phase-card__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .case-card:hover { transform: none; }
}

/* --------------------------------------------------------------------- */
/* Inline 0-5 self-assessment                                             */
/*                                                                        */
/* The point of putting this in the list is speed: a student rates a whole */
/* phase without opening 57 pages. Targets are 28px, above the comfortable */
/* tap floor, and the row wraps rather than overflowing on a phone.        */
/* --------------------------------------------------------------------- */

.rate {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  flex-wrap: wrap;
}

.rate__dot {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--ink-200);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-400);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.rate__dot:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.rate__dot:active { transform: scale(0.9); }

/* The current rating, and everything below it, reads as "filled" — the same
   mental model as a star rating, so the level is legible at a glance. */
.rate__dot.is-set {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rate__dot.is-set ~ .rate__dot { color: var(--ink-300); }

.rate.is-busy { opacity: 0.55; pointer-events: none; }

.case-card .rate { margin-top: var(--space-2); }
.case-row .rate { margin-top: 6px; }

/* --------------------------------------------------------------------- */
/* Top-face colour toggle (OLL)                                           */
/* --------------------------------------------------------------------- */

.toolbar__top button[data-top-button="yellow"]::before,
.toolbar__top button[data-top-button="white"]::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 1px solid rgba(20, 22, 26, 0.25);
}
.toolbar__top button[data-top-button="yellow"]::before { background: var(--cube-yellow); }
.toolbar__top button[data-top-button="white"]::before { background: var(--cube-white); }

@media (max-width: 520px) {
  .rate__dot { width: 26px; height: 26px; }
}

/* --------------------------------------------------------------------- */
/* Scramble under the "Watch it solve" heading                            */
/*                                                                        */
/* Placed here rather than only in the "Set it up" block further down so   */
/* you can set the case on a real cube without scrolling away from the     */
/* animation you are about to watch.                                      */
/* --------------------------------------------------------------------- */

.case-setup {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  background: var(--ink-050);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
}

.case-setup__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 660;
  color: var(--ink-400);
  flex: 0 0 auto;
}

.case-setup .alg {
  background: var(--paper);
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 520px) {
  .case-setup { gap: var(--space-2); }
  .case-setup .alg { width: 100%; flex-basis: 100%; }
}

/* --------------------------------------------------------------------- */
/* Algorithm shown inline in the todo list and in the case header         */
/* --------------------------------------------------------------------- */

/* The todo list is a practice list, so the moves have to be readable without
   opening each case. On a phone the algorithm gets its own row rather than
   competing with the name for width. */
.todo-item__alg {
  flex: 0 1 auto;
  max-width: 100%;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.case-head__alg {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
}

.case-head__alg .alg {
  font-size: 1.02rem;
  padding: 8px 12px;
}

.case-head__alg-note {
  font-size: 0.82rem;
  color: var(--ink-400);
}

@media (max-width: 640px) {
  .todo-item { flex-wrap: wrap; }
  .todo-item__alg { flex-basis: 100%; order: 5; }
  .case-head__alg .alg { font-size: 0.94rem; }
}

/* --------------------------------------------------------------------- */
/* "Watch it solve" spans the full width                                  */
/*                                                                        */
/* It is the widest thing on the page — 3D cube, flat net and a reserved   */
/* cell beside them — so it sits outside the main/side split rather than   */
/* being squeezed into the narrower column.                               */
/* --------------------------------------------------------------------- */

.case-viewer-panel {
  grid-column: 1 / -1;
  margin-bottom: var(--space-5);
}

/* --------------------------------------------------------------------- */
/* Turning the cube by hand                                               */
/* --------------------------------------------------------------------- */

.hand-turns {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.hand-turns__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 660;
  color: var(--ink-400);
}

.hand-turns__btn {
  min-width: 44px;
  font-family: var(--font-mono);
  font-weight: 600;
  /* The label gains a prime under Shift; a fixed width stops the row
     shuffling sideways as it changes. */
  justify-content: center;
}

/* A slice turns the middle layer and leaves both faces alone, so it belongs to
   its own group. The gap goes on the first slice button -- the one that
   follows a face button, which is M. */
.hand-turns__btn:not(.hand-turns__btn--slice) + .hand-turns__btn--slice {
  margin-left: var(--space-3);
}

/* Primed state is announced by the label itself, but colour makes the mode
   obvious at a glance while the key is held. */
.hand-turns.is-primed .hand-turns__btn {
  background: var(--accent-soft);
  color: #2a41d8;
}

.hand-turns__hint {
  font-size: 0.78rem;
  color: var(--ink-400);
  margin-left: auto;
}

.hand-turns__hint kbd {
  font-size: 0.72rem;
  padding: 1px 5px;
  border: 1px solid var(--ink-200);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper);
}

@media (max-width: 520px) {
  .hand-turns__hint { margin-left: 0; flex-basis: 100%; }
}
