/* ==============================================================
   汉诺塔 · 游戏专属样式
   选择器统一以 .g-hanoi 前缀限定
   ============================================================== */

.g-hanoi {
  gap: 10px;
}

/* ------------------------------ 盘数选择 ------------------------------ */

.g-hanoi .hn-sizes { flex: none; }
.g-hanoi .hn-sizes .seg-item { min-height: 40px; font-size: 12.5px; }

/* ------------------------------ 数据 ------------------------------ */

.g-hanoi .hn-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: none;
}
.g-hanoi .hn-stat {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.g-hanoi .hn-k { font-size: 10px; color: var(--faint); letter-spacing: 0.04em; }
.g-hanoi .hn-v {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.g-hanoi .hn-best {
  flex: none;
  text-align: center;
  font-size: 11px;
  min-height: 16px;
}

/* ------------------------------ 棋盘 ------------------------------ */

.g-hanoi .hn-board-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.g-hanoi .hn-board {
  flex: none;
  width: 100%;
  max-height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 4px 2px 0;
}

.g-hanoi .hn-peg {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0 22px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s;
}
.g-hanoi .hn-peg.can {
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.g-hanoi .hn-peg.active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.g-hanoi .hn-peg.demo { opacity: 0.9; }

/* 柱子（杆） */
.g-hanoi .hn-rod {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: calc(100% - 46px);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.g-hanoi .hn-peg.active .hn-rod {
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
}

/* 底座 */
.g-hanoi .hn-base {
  position: absolute;
  bottom: 22px;
  left: 6%;
  right: 6%;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08));
  pointer-events: none;
}
.g-hanoi .hn-peg.active .hn-base,
.g-hanoi .hn-peg.can .hn-base {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 55%, #fff), color-mix(in srgb, var(--accent) 22%, transparent));
}

.g-hanoi .hn-label {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.12em;
  pointer-events: none;
}
.g-hanoi .hn-peg.active .hn-label { color: var(--accent); }

/* 圆盘 */
.g-hanoi .hn-discs {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 2px;
  padding-bottom: 30px;
  pointer-events: none;
}
.g-hanoi .hn-disc {
  position: relative;
  height: 26px;
  border-radius: 8px;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 4px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  will-change: transform;
}
.g-hanoi .hn-disc.lift { transform: translateY(-14px); box-shadow: 0 0 14px rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(0, 0, 0, 0.6); }
.g-hanoi .hn-disc.drop { animation: hnDrop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.g-hanoi .hn-disc-n {
  font-size: 10.5px;
  font-weight: 700;
  color: rgba(8, 16, 26, 0.6);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ------------------------------ 操作 ------------------------------ */

.g-hanoi .hn-ctrl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: none;
}
.g-hanoi .hn-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, color 0.15s;
  touch-action: manipulation;
}
.g-hanoi .hn-btn:active { transform: scale(0.96); background: var(--surface-2); border-color: var(--line-2); }
.g-hanoi .hn-btn-i { display: inline-flex; width: 18px; height: 18px; flex: none; }
.g-hanoi .hn-btn-i svg { width: 18px; height: 18px; }

/* ------------------------------ 动画 ------------------------------ */

@keyframes hnDrop {
  0% { transform: translateY(-18px); opacity: 0.5; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ------------------------------ 适配 ------------------------------ */

@media (max-height: 710px) {
  .g-hanoi { gap: 8px; }
  .g-hanoi .hn-btn { min-height: 42px; }
  .g-hanoi .hn-best { display: none; }
  .g-hanoi .hn-disc { height: 22px; }
  .g-hanoi .hn-discs { gap: 1px; }
  .g-hanoi .hn-board { height: 260px; }
}

@media (max-width: 365px) {
  .g-hanoi .hn-btn { font-size: 12px; }
  .g-hanoi .hn-board { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .g-hanoi .hn-disc { transition: none; }
  .g-hanoi .hn-disc.drop { animation: none; }
}

/* 头部小按钮热区 ≥40px */
.g-hanoi .btn.sm { min-height: 40px; }
