:root { --game: #c084fc; }
.rc-stage { margin: 4px auto 16px; padding: 2px 12px 8px; }
.h-shell {
  max-width: 640px;
  margin: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 28px #c084fc20;
}
.h-shell h1 { margin: 0 2px 4px; font-size: 1.25rem; }
.h-status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 12px;
  color: var(--text-dim);
  font-size: .8rem;
}
.h-status strong { color: var(--text); }
#moves { font-size: 1.5rem; }
#message { min-height: 1.4em; margin: 3px 2px; font-size: .85rem; }
#daily-start { min-height: 1em; margin: 0 2px 3px; color: var(--game); font-size: .78rem; }
.h-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  height: clamp(210px, 38vh, 300px);
  max-height: calc(100vh - 290px);
  margin: auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #111115;
}
.h-peg {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.h-peg:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.h-post {
  position: absolute;
  bottom: 27px;
  left: 50%;
  width: 7px;
  height: calc(100% - 68px);
  transform: translateX(-50%);
  border-radius: 5px 5px 0 0;
  background: #55515b;
}
.h-base {
  position: absolute;
  bottom: 22px;
  left: 4px;
  right: 4px;
  height: 9px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid #55515b;
}
.h-stack {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.h-disk {
  --disk-height: clamp(22px, 3.7vh, 28px);
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(31px + (var(--level) * var(--disk-height)));
  display: grid;
  place-items: center;
  width: calc(26% + var(--size) * 9.6%);
  max-width: calc(100% - 7px);
  min-width: 28px;
  height: var(--disk-height);
  transform: translateX(-50%);
  border-radius: 99px;
  color: #1a1022;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1;
  background: var(--disk-color);
  box-shadow: inset 0 1px 1px #fff8, 0 2px 5px #0008;
}
.h-disk[data-disk="1"] { --disk-color: #fda4af; }
.h-disk[data-disk="2"] { --disk-color: #fdba74; }
.h-disk[data-disk="3"] { --disk-color: #fde68a; }
.h-disk[data-disk="4"] { --disk-color: #86efac; }
.h-disk[data-disk="5"] { --disk-color: #67e8f9; }
.h-disk[data-disk="6"] { --disk-color: #93c5fd; }
.h-disk[data-disk="7"] { --disk-color: #d8b4fe; }
/* The top disk is the drag handle: a touch that starts on it must not pan
   the page (Android cancels the pointer otherwise). The rest of the column
   keeps `manipulation`, so a swipe there still scrolls. */
.h-stack .h-disk:last-child { pointer-events: auto; touch-action: none; }
.h-disk.lifted {
  bottom: auto;
  top: 8px;
  box-shadow: 0 0 0 3px #fff, 0 5px 15px #000a;
}
.h-disk.last { outline: 2px solid #ffffff70; }
.h-disk.anim-hidden { opacity: 0; }
.h-goal {
  position: absolute;
  z-index: 3;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  color: #e9d5ff;
  font-size: .72rem;
  font-weight: 700;
}
.h-goal::before {
  content: '⚑';
  padding-right: 3px;
}
.h-flyer {
  position: fixed;
  z-index: 30;
  margin: 0;
  transform: none;
  pointer-events: none;
  transition: left .22s ease, top .22s ease;
}
.h-flyer.travel { animation: h-arc .22s ease; }
.h-ghost {
  position: fixed;
  z-index: 100;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: .9;
}
.h-ghost .h-disk {
  top: 0 !important;
  left: 50% !important;
  bottom: auto !important;
  transform: translateX(-50%);
}
.h-peg.hint-from .h-disk:last-child,
.h-peg.hint-to { animation: h-pulse .7s ease-in-out 2; }
.h-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-top: 7px;
}
.h-controls button, .h-controls select {
  min-height: 40px;
  padding: 5px 9px;
  border: 1px solid #49414c;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}
.h-controls button.off { opacity: .45; }
.h-controls label { font-size: .85rem; }
#best, .h-help { margin: 5px 2px 0; color: var(--text-dim); font-size: .77rem; }
@media (max-width: 500px) {
  .h-controls, #best { padding-right: 78px; }
}
.shake { animation: h-shake .2s linear; }
@keyframes h-shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
@keyframes h-pulse { 50% { box-shadow: 0 0 0 4px #c084fc99; } }
@keyframes h-arc { 50% { transform: translateY(-24px); } }
@media (prefers-reduced-motion: reduce) {
  .h-peg, .h-disk, .h-flyer { animation: none !important; transition: none !important; }
}
