.play {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 88px 20px 14px;
  gap: 8px;
}

.guide {
  align-items: center;
  width: 100%;
  max-width: 1100px;
}

.guide img {
  width: clamp(64px, 10vh, 84px);
}

.guide .bubble {
  margin-bottom: 0;
  max-width: none;
}

.board {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 48px);
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.66);
  border-radius: 40px;
  box-shadow: var(--shadow);
}

.ask {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.equation {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 22px);
  font-size: clamp(54px, min(11vh, 7.2vw), 92px);
  font-weight: 800;
  line-height: 1.05;
}

.equation.enter-in {
  animation: pop-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.equation .op {
  color: var(--lav-deep);
}

.slot {
  min-width: 1.5em;
  padding: 0 0.18em;
  text-align: center;
  border-radius: 28px;
  background: #fff;
  border: 6px dashed var(--lav-deep);
  color: var(--ink-soft);
}

.slot.right {
  border: 6px solid var(--mint-deep);
  color: var(--mint-deep);
  animation: pop-in 0.35s ease;
}

.caption {
  margin: 0;
  font-size: clamp(18px, 2.8vh, 24px);
  font-weight: 700;
  color: var(--ink-soft);
}

.hint-toggle {
  min-height: 64px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--butter);
  font-size: clamp(18px, 2.8vh, 22px);
  font-weight: 800;
  box-shadow: 0 5px 0 #e0a92a;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.hint-toggle:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #e0a92a;
}

.array-wrap {
  display: grid;
  place-items: center;
  flex: 1;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
}

.array {
  --d: min(44px, calc((100vh - 490px) / var(--rows, 5)), calc((36vw - 48px - 4px * var(--cols, 5)) / (var(--cols, 5) + 1.7)));
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 24px;
  background: var(--sky);
}

.row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.row i {
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: var(--sky-deep);
  box-shadow: inset 0 -3px 0 rgba(61, 58, 92, 0.18);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.row b {
  min-width: 2.2em;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  text-align: center;
  font-size: max(16px, calc(var(--d) * 0.72));
  line-height: var(--d);
  color: #fff;
  background: var(--mint-deep);
  visibility: hidden;
}

.row.lit i {
  background: var(--butter-deep);
}

.row.lit b {
  visibility: visible;
  opacity: 0.55;
}

.row.last {
  background: #fff;
}

.row.last i {
  transform: scale(1.08);
}

.row.last b {
  opacity: 1;
  animation: pop-in 0.25s ease;
}

.board.hint-off .array,
.board.hint-off .caption {
  visibility: hidden;
}

.choices {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3vw, 34px);
}

.choice {
  position: relative;
  --s: clamp(84px, min(12.5vh, 17vw), 120px);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  font-size: calc(var(--s) * 0.48);
  font-weight: 800;
  background: var(--tint);
  box-shadow: 0 7px 0 var(--edge), 0 14px 24px rgba(61, 58, 92, 0.16);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s ease;
}

.choice.c-sky {
  --tint: var(--sky);
  --edge: var(--sky-deep);
}

.choice.c-mint {
  --tint: var(--mint);
  --edge: var(--mint-deep);
}

.choice.c-pink {
  --tint: var(--pink);
  --edge: var(--pink-deep);
}

.choice.c-lav {
  --tint: var(--lav);
  --edge: var(--lav-deep);
}

@media (hover: hover) {
  .choice:hover {
    transform: translateY(-3px);
  }
}

.choice:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--edge);
}

.choice kbd {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 20px;
  box-shadow: 0 3px 0 #d4d2e6;
}

.choice.nope {
  opacity: 0.4;
  cursor: default;
  animation: shake 0.45s ease;
  transform: none;
}

.choice.hint {
  background: var(--butter);
  animation: glow 1.1s ease-in-out infinite;
}

.choice.right {
  background: var(--mint-deep);
  color: #fff;
  transform: scale(1.12);
}

.key-tip {
  margin: 0;
  font-size: clamp(15px, 2vh, 18px);
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 2px 16px;
  text-align: center;
}

.round-dots {
  display: flex;
  gap: 10px;
}

.round-dots i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

.round-dots i.now {
  box-shadow: 0 0 0 4px var(--butter-deep);
}

.round-dots i.ok {
  background: var(--mint-deep);
}

.round-dots i.done {
  background: var(--butter-deep);
}

.panel .mascot {
  width: clamp(96px, 16vh, 150px);
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px 12px;
  padding-bottom: 8px;
}

.big-btn.table-btn {
  min-width: 0;
  min-height: 72px;
  padding: 8px 0;
  font-size: clamp(28px, 4.4vh, 38px);
}

.big-btn.table-btn.mix {
  grid-column: span 2;
  font-size: clamp(24px, 3.6vh, 30px);
}

.chart {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.chart li {
  padding: 6px 2px;
  border-radius: 16px;
  font-size: clamp(15px, 2.3vh, 19px);
  font-weight: 800;
  white-space: nowrap;
}

.chart li.ok {
  background: var(--mint);
  box-shadow: inset 0 0 0 3px var(--mint-deep);
}

.chart li.retry {
  background: var(--butter);
  box-shadow: inset 0 0 0 3px var(--butter-deep);
  border-radius: 6px;
}

.panel .legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-bottom: 18px;
  font-size: clamp(15px, 2.2vh, 18px);
}

.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend .swatch {
  width: 22px;
  height: 22px;
  border-radius: 8px;
}

.legend .swatch.ok {
  background: var(--mint);
  box-shadow: inset 0 0 0 3px var(--mint-deep);
}

.legend .swatch.retry {
  background: var(--butter);
  box-shadow: inset 0 0 0 3px var(--butter-deep);
  border-radius: 3px;
}

@supports (width: 1cqw) {
  .array-wrap {
    container-type: size;
  }

  .array {
    --d: min(var(--dmax, 48px), calc((100cqh - 16px) / var(--rows, 5) - 4px), calc((100cqw - 48px - 4px * var(--cols, 5)) / (var(--cols, 5) + 1.7)));
  }
}

@media (orientation: portrait) {
  .play {
    gap: 14px;
    padding-bottom: 22px;
  }

  .board {
    flex-direction: column;
    gap: 12px;
    padding: 18px 20px;
  }

  .equation {
    font-size: clamp(54px, 12vw, 92px);
  }

  .ask {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
  }

  .ask .equation {
    flex: 0 0 100%;
    justify-content: center;
  }

  .array-wrap {
    --dmax: 60px;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .table-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .big-btn.table-btn.mix {
    grid-column: span 4;
  }
}
