.sort-room {
  --sort-ink:#3b142d;
  --sort-wine:#762d55;
  --sort-line:#dac5d0;
  width:min(100%,74rem);
  margin-inline:auto;
  color:var(--sort-ink);
  text-align:left;
}
.game-shell .play .sort-room .session-banner {max-width:none;text-align:left;margin:0 0 1.25rem}
.sort-bench {
  display:grid;
  grid-template-columns:minmax(0,1.6fr) minmax(16rem,1fr);
  align-items:center;
  gap:clamp(1rem,4vw,4rem);
}
.sort-rack {
  display:grid;
  grid-template-columns:repeat(var(--sort-tubes),minmax(0,1fr));
  gap:clamp(.35rem,1vw,.8rem);
  padding:clamp(.75rem,2vw,1.4rem);
  border:1px solid #d6b2c4;
  border-radius:1rem;
  background:
    radial-gradient(ellipse at 24% 0%,#ffeaf0,transparent 70%),
    linear-gradient(165deg,#e8c6d7,#b97f9c);
  box-shadow:inset 0 0 1rem #a2517822,0 .7rem 1.3rem #66395013;
}
.sort-room .sort-tube {
  position:relative;
  display:grid;
  justify-items:center;
  grid-template-rows:1fr auto auto;
  gap:.35rem;
  min-width:0;
  padding:.3rem .1rem .45rem;
  border:1px solid transparent;
  border-radius:.65rem;
  background:none;
  color:var(--sort-ink);
  font:inherit;
  opacity:1;
}
.sort-tube:enabled {cursor:pointer}
.sort-tube:focus-visible {outline:3px solid var(--sort-wine);outline-offset:2px}
.sort-tube:enabled:hover {background:#fff5}
.sort-tube[aria-pressed="true"] {background:#fff9;border-color:var(--sort-wine);box-shadow:0 2px .7rem #6e315135}
.sort-tube[data-sort-receiver] {background:#fff7;border-color:#7d4568;border-style:dashed}
.sort-tube[data-sort-hinted="source"] {outline:3px solid #7846a1;outline-offset:1px}
.sort-tube[data-sort-hinted="target"] {outline:3px dashed #7846a1;outline-offset:1px}
.sort-glass {
  position:relative;
  display:flex;
  flex-direction:column-reverse;
  align-items:center;
  justify-content:flex-start;
  gap:.12rem;
  width:min(100%,4.3rem);
  min-width:0;
  aspect-ratio:1/3.08;
  padding:.4rem .25rem .5rem;
  margin-top:.18rem;
  border:1px solid #7d515f70;
  border-top:0;
  border-radius:0 0 40% 40% / 0 0 18% 18%;
  background:linear-gradient(90deg,#7d576e52,#fff9 13%,#fff2 25%,#fce0e944 54%,#fff9 85%,#7d576e59 100%);
  box-shadow:inset 0 -3px 6px #71455542,2px 5px 7px #6f456744;
}
.sort-glass::before {
  position:absolute;
  z-index:1;
  inset:-.22rem -.06rem auto;
  height:.48rem;
  background:linear-gradient(#eed5df,#85475e44,#fff8);
  border:1px solid #7448618c;
  border-radius:50%;
  box-shadow:0 2px 1px #fff5;
  content:"";
}
.sort-marble {
  display:grid;
  place-items:center;
  flex-shrink:0;
  width:89%;
  aspect-ratio:1;
  border-radius:50%;
  border:1px solid #21102044;
  color:var(--bead-ink);
  background:radial-gradient(circle at 30% 24%,var(--bead-glisten),var(--bead-base) 48%,var(--bead-shade));
  font-size:clamp(.85rem,2.4vw,1.6rem);
  font-weight:800;
  line-height:1;
  box-shadow:inset 0 1px 2px #fff7,0 1px 2px #46223844;
}
.sort-marble-1 {--bead-glisten:#c9fff2;--bead-base:#39a79d;--bead-shade:#17605d;--bead-ink:#162d36}
.sort-marble-2 {--bead-glisten:#fff0b1;--bead-base:#f4bc4f;--bead-shade:#b26e2f;--bead-ink:#4b2711}
.sort-marble-3 {--bead-glisten:#ffd7ba;--bead-base:#e88170;--bead-shade:#ac4640;--bead-ink:#4d2527}
.sort-marble-4 {--bead-glisten:#efd7ff;--bead-base:#b991d0;--bead-shade:#7d55a4;--bead-ink:#311746}
.sort-tube[aria-pressed="true"] .sort-marble-top {transform:translateY(-.15rem);outline:2px solid #fff4dc;outline-offset:1px}
.sort-marble-arrived {animation:sort-arrive .22s ease-out}
@keyframes sort-arrive {from {transform:translateY(-.8rem);opacity:.45} to {transform:translateY(0);opacity:1}}
.sort-letter {font-size:clamp(1rem,2vw,1.25rem);line-height:1.1}
.sort-depth {font-size:.76rem;font-variant-numeric:tabular-nums;line-height:1.25}
.sort-bench aside {min-width:0}
.sort-counters {
  display:grid;
  grid-template-columns:minmax(0,.68fr) minmax(0,1.4fr) minmax(0,.8fr);
  gap:.45rem;
  padding:0 0 .7rem;
  border-bottom:1px solid var(--sort-line);
  margin:0 0 .8rem;
}
.sort-counters dt {font-size:.83rem;font-weight:700;line-height:1.25;color:#6c4d62}
.sort-counters dd {margin:.2rem 0 0;font-weight:780;font-size:clamp(1.45rem,3.5vw,2.35rem);line-height:1;font-variant-numeric:tabular-nums}
.game-shell .play .sort-room .sort-advice {min-height:3.15rem;margin:.8rem 0;text-align:left;color:var(--sort-ink)}
.sort-notice,.sort-hint {border-left:3px solid var(--sort-wine);padding:.35rem .55rem;background:#f9ecf3}
.game-shell .play .sort-room .actions {margin:.8rem 0;justify-content:flex-start}
.sort-route summary {cursor:pointer;padding:.5rem 0;font-weight:700}
.sort-route ol {margin:.3rem 0;padding-left:1.4rem}
.sort-route li {padding-bottom:.22rem;font-size:.85rem}
@media(max-width:830px) {
  .sort-bench {grid-template-columns:1fr}
  .sort-rack {width:min(100%,38rem);margin-inline:auto}
}
@media(max-width:485px) {
  .sort-rack {gap:.16rem;padding:.7rem .3rem}
  .sort-tube .sort-glass {padding-inline:.12rem}
}
@media(prefers-reduced-motion:reduce) {.sort-marble-arrived {animation:none}}

.page-game .game-shell.theme-sort:has(.sort-room) {
  --sort-petrol:#235552;
  background:radial-gradient(ellipse at 27% 0,#fffaf0,#f0e1ce 90%);
}
.page-game .game-shell.theme-sort:has(.sort-room) .game-toolbar {
  background:#f7ecdc;
  border-color:#b7a284;
  color:#253f3a;
}
.theme-sort:has(.sort-room) .game-toolbar .button {
  background:#fffaec;color:#254941;border-color:#a7977c;
}
.game-shell .play .sort-room {
  --sort-ink:#25423c;
  --sort-line:#bead91;
}
.game-shell.theme-sort .play .sort-room .session-banner h2 {color:var(--sort-ink)}
.sort-bench {grid-template-columns:minmax(0,1.85fr) minmax(15rem,1fr);gap:clamp(1rem,3vw,3rem)}
.sort-rack {
  position:relative;
  isolation:isolate;
  border:0;
  border-radius:0;
  background:none;
  box-shadow:none;
  padding-block:.65rem .85rem;
}
.sort-rack::before {
  content:"";
  position:absolute;
  z-index:-1;
  inset:auto 0 0;
  height:27%;
  border:1px solid #2b5551;
  border-radius:22px 22px 13px 13px;
  background:repeating-linear-gradient(135deg,#ffffff11 0 1px,transparent 1px 5px),linear-gradient(#427772,#184642);
  box-shadow:inset 0 4px 0 #a3c7b34d,0 5px 0 #153d38,0 12px 15px #543d262b;
  pointer-events:none;
}
.sort-room .sort-tube {
  color:#193831;
  transition:box-shadow .15s,border-color .15s;
}
.sort-letter {
  padding:.08rem .32rem;
  border-radius:.26rem;
  background:#fff3d7;
}
.sort-depth {
  padding-inline:.25rem;
  border-radius:.22rem;
  color:#fff3d7;
  background:#234e48;
}
.sort-tube:enabled:hover {background:#e8cda329}
.sort-tube:focus-visible {outline:3px solid #365d87;outline-offset:2px}
.sort-tube[aria-pressed="true"] {
  background:#e7b35a33;border:2px solid #a25722;box-shadow:inset 0 0 0 1px #f8ca7d;
}
.sort-tube[data-sort-receiver] {
  background:#b6e0bf44;border-color:#397755;border-style:dashed;
  box-shadow:inset 0 0 0 1px #e3f2d3;
}
.sort-tube[data-sort-hinted="source"] {outline:3px solid #365d87;outline-offset:1px}
.sort-tube[data-sort-hinted="target"] {outline:3px dashed #365d87;outline-offset:1px}
.sort-glass {
  width:min(100%,5.6rem);
  border-color:#92816a;
  background:linear-gradient(90deg,#9984685f,#fffef3db 13%,#fffaf126 29%,#fffbf11a 68%,#fffef4e6 88%,#96836b6b);
  box-shadow:inset 0 -5px 7px #53463852,2px 5px 9px #513b3052;
}
.sort-glass::before {
  background:linear-gradient(#f9f2dc,#a18c6d6e,#fff5dc);
  border-color:#8f806b;
  box-shadow:inset 0 0 0 1px #fff8e4,0 2px 1px #fff9;
}
.sort-marble {box-shadow:inset 0 1px 2px #fff9,0 3px 4px #52372754}
.sort-tube[aria-pressed="true"] .sort-marble-top {outline-color:#fff4ce}
.sort-bench aside {
  padding:clamp(.8rem,1.7vw,1.35rem);
  background:#fff8e9;
  border:1px solid #bfab8f;
  border-radius:9px;
  box-shadow:0 4px 0 #c2ad8a44;
}
.sort-counters dt {color:#506052}
.sort-notice,.sort-hint {border-color:#7b673c;background:#f8eed5}
.sort-hint {border-color:#365d87;background:#e8f1f2}
.game-shell.theme-sort .play .sort-room .button {
  min-height:44px;
  background:var(--sort-petrol);color:#fff6df;border-color:var(--sort-petrol);
}
.game-shell.theme-sort .play .sort-room .button.secondary {
  background:#fffaf0;color:#2c524b;border-color:#a69a80;
}
.game-shell.theme-sort .play .sort-room .button.secondary:hover {background:#e8ebdc}
.sort-route summary {min-height:44px;padding:.7rem 0}
@media(max-width:830px) {
  .sort-bench {grid-template-columns:minmax(0,1fr);gap:1rem}
}
@media(max-width:485px) {
  .sort-rack {padding-inline:.18rem}
  .sort-rack::before {height:32%;border-radius:12px 12px 8px 8px}
  .sort-tube[aria-pressed="true"] {border-width:1px}
}
@media(prefers-reduced-motion:reduce) {.sort-room .sort-tube {transition:none}}
