.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);
}

.group-label {
  margin: 0 0 10px;
  font-weight: 800;
}

.table-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.pill {
  min-width: 64px;
  min-height: 52px;
  padding: 6px 18px;
  border: 3px solid #526575;
  border-radius: 999px;
  background: #f4f7fa;
  color: #243746;
  font-size: clamp(22px, 3.4vh, 30px);
  font-weight: 800;
}

.pill[aria-pressed="true"] {
  background: #243746;
  color: #fff;
}

.pill:focus-visible {
  outline: 4px solid #1574c4;
  outline-offset: 3px;
}

#start .gk-action--primary {
  max-width: 320px;
  margin: 0 auto;
}

.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) {
  .play {
    padding: 66px 12px 10px;
    gap: 8px;
  }

  .guide {
    gap: 6px;
  }

  .guide img {
    width: 46px;
  }

  .guide .bubble {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 16px;
    line-height: 1.25;
  }

  .guide .bubble::after {
    bottom: 10px;
  }

  .board {
    gap: 6px;
    padding: 10px 12px;
    border-radius: 28px;
  }

  .equation {
    gap: 8px;
    font-size: clamp(38px, 11.5vw, 50px);
  }

  .slot,
  .slot.right {
    min-width: 1.4em;
    border-width: 4px;
    border-radius: 18px;
  }

  .ask {
    align-items: center;
    gap: 4px 12px;
  }

  .caption {
    font-size: 16px;
  }

  .hint-toggle {
    min-height: 48px;
    padding: 0 16px;
    font-size: 16px;
    box-shadow: 0 4px 0 #e0a92a;
  }

  .array-wrap {
    --dmax: 34px;
  }

  .array {
    padding: 8px 10px;
    border-radius: 18px;
  }

  .row b {
    margin-left: 6px;
  }

  .choices {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 440px;
  }

  .choice {
    width: 100%;
    height: clamp(60px, 10dvh, 80px);
    border-radius: 22px;
    font-size: 28px;
    box-shadow: 0 5px 0 var(--edge), 0 8px 14px rgba(61, 58, 92, 0.14);
  }

  .choice.right {
    transform: scale(1.05);
  }

  .choice kbd {
    display: none;
  }

  .key-tip {
    display: none;
  }

  .chart {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
  }

  .chart li {
    padding: 4px 2px;
    font-size: 15px;
  }

  .panel .legend {
    gap: 4px 16px;
    margin-bottom: 12px;
    font-size: 14px;
  }

  #finish .panel .mascot {
    width: 84px;
  }

  .round-dots {
    gap: 8px;
  }

  .round-dots i {
    width: 14px;
    height: 14px;
  }
}


@media (max-height: 760px) {
  #finish .panel .mascot {
    display: none;
  }

  #finish .panel {
    padding: 16px 20px 20px;
  }
}
