/* 汉诺塔 v2 · 主棋盘（套数字华容道模板） */

.hanoi-board {
  width: min(100%, 760px);
  height: clamp(330px, 58vh, 560px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 22px);
  padding: clamp(12px, 2.5vh, 24px) clamp(8px, 2vw, 20px);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 0 6px 0 var(--paper-deep), 0 8px 0 var(--ink), var(--shadow-card);
  user-select: none;
}

.hanoi-tower {
  position: relative;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.hanoi-tower:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.hanoi-tower.is-selected {
  background: rgba(158, 201, 232, 0.22);
  border-color: var(--sky);
}
.hanoi-tower.shake { animation: hanoiShake 0.38s ease; }
@keyframes hanoiShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.hanoi-pole {
  position: absolute;
  bottom: 34px;
  left: 50%;
  width: 7px;
  height: 74%;
  transform: translateX(-50%);
  background: var(--ink);
  border-radius: 5px;
  box-shadow: 0 0 0 2px rgba(90, 74, 58, 0.12);
}
.hanoi-base {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 22px;
  height: 14px;
  background: #B58A5C;
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 3px 0 rgba(90, 74, 58, 0.22);
}
.hanoi-label {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-num);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-faint);
}

.hanoi-disks {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(2px, 0.5vh, 5px);
  padding-bottom: 38px;
}

.hanoi-disk {
  width: var(--disk-w, 70%);
  height: clamp(18px, 3.1vh, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--disk-c, var(--orange-soft));
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: inset 0 -3px 0 rgba(90, 74, 58, 0.16), 0 2px 0 rgba(90, 74, 58, 0.22);
  font-family: var(--font-num);
  font-size: clamp(9px, 1.4vh, 13px);
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  animation: hanoiDiskIn 0.18s var(--ease-bounce);
}
@keyframes hanoiDiskIn {
  from { transform: translateY(-6px) scaleX(0.92); opacity: 0.5; }
  to { transform: translateY(0) scaleX(1); opacity: 1; }
}
.hanoi-disk.is-top { box-shadow: inset 0 -3px 0 rgba(90, 74, 58, 0.16), 0 3px 0 var(--ink); }

@media (max-width: 859px) {
  .hanoi-board {
    height: clamp(300px, 52vh, 500px);
    gap: 5px;
    padding: 10px 4px;
    border-radius: var(--r-md);
  }
  .hanoi-disk { border-width: 2px; height: clamp(17px, 2.8vh, 27px); }
  .hanoi-pole { width: 6px; bottom: 30px; height: 72%; }
  .hanoi-base { bottom: 20px; height: 12px; }
  .hanoi-disks { padding-bottom: 34px; gap: 2px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .hanoi-board { height: calc(100dvh - 120px); min-height: 200px; }
  .hanoi-disk { height: clamp(12px, 3.2vh, 20px); font-size: 9px; }
  .hanoi-disks { padding-bottom: 26px; }
  .hanoi-pole { bottom: 24px; height: 76%; }
  .hanoi-base { bottom: 16px; height: 10px; }
  .hanoi-label { display: none; }
}

@media (min-width: 860px) {
  .screen--play .stage { justify-content: flex-start; }
  .screen--play .stats { margin-top: 0; }
}

/* 与数独 v2 一致的窄屏大插画 */
@media (max-width: 760px) {
  .hero__card { width: min(220px, 56vw); padding: 8px; }
}
@media (max-width: 380px) {
  .hero__card { width: min(170px, 52vw); }
}
@media (max-width: 760px) and (max-height: 700px) {
  .setup { gap: 6px; }
  .setup__block { padding: 9px; gap: 6px; }
  .diff { min-height: 50px; padding: 5px 9px; }
  .btn--lg { min-height: 50px; }
  .fineprint { display: none; }
}
@media (max-width: 340px) and (max-height: 620px) {
  .hero__card { width: min(160px, 50vw); }
  .diff__meta { display: none; }
  .diff { min-height: 44px; }
  .setup__block { padding: 7px; }
}

/* 与数字华容道对齐：左棋盘和右侧控件同一起始高度 */
@media (min-width: 900px) {
  .screen--play .stage { justify-content: flex-start; padding-top: 32px; }
  .screen--play .stats { margin-top: 32px; }
}

/* 极窄屏：压缩纵向间距，给左下角版本号腾出一行 */
@media (max-width: 380px) {
  .screen--start { padding-bottom: 26px; }
  .app-version { left: 8px; bottom: 5px; font-size: 9px; padding: 1px 5px; }
  .setup { gap: 3px; }
  .setup__block { padding: 6px; gap: 4px; }
  .diff-list { gap: 5px; }
  .diff { min-height: 40px; padding: 4px 8px; }
  .diff__name small, .setup__label-note { display: none; }
  .app-title { font-size: clamp(26px, 8vw, 32px); }
  .btn--lg { min-height: 52px; }
  .hero__card { width: min(150px, 44vw); padding: 7px; }
  .hero__caption, .hero__float { display: none; }
  .subtitle { display: none; }
}

/* 极窄屏：难度卡进一步压缩 */
@media (max-width: 340px) {
  .diff { min-height: 40px; padding: 4px 8px; gap: 8px; }
  .diff__mini { width: 26px; height: 26px; border-radius: 7px; }
  .diff__name { font-size: var(--fs-sm); }
  .diff__best { font-size: 10px; }
}
