/* =====================================================================
   style.css — 水ソートパズル ツール固有の微調整 + ゲーム盤。
   共通スタイルは /_shared/shirugear.css に任せる。
   ダーク対応は正規CSS変数のみ使用（色水の色は固定色でOK＝ゲーム要素）。
   ===================================================================== */

/* 手数などの数値はタブ幅数字で桁を揃える */
.wsp-stat__value {
  font-variant-numeric: tabular-nums;
}

/* 盤面ラッパ */
.wsp-board-wrap {
  position: relative;
}

/* 試験管の並び */
.wsp-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 14px 16px;
  padding: 8px 2px 4px;
  min-height: 200px;
}

/* 1本の試験管（タップ対象） */
.wsp-tube {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  width: 46px;
  padding: 4px;
  background: var(--sg-surface-2, #eef1f7);
  border: 2px solid var(--sg-border, #d7d7de);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  border-bottom-left-radius: 22px;
  border-bottom-right-radius: 22px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.wsp-tube:focus-visible {
  outline: 2px solid var(--sg-primary, #3b5bdb);
  outline-offset: 2px;
}

/* 選択中: 持ち上げてハイライト */
.wsp-tube.is-selected {
  transform: translateY(-14px);
  border-color: var(--sg-primary, #3b5bdb);
  box-shadow: 0 6px 16px var(--sg-primary-soft, rgba(59, 91, 219, 0.3));
}

/* 完成した試験管 */
.wsp-tube.is-done {
  border-color: var(--sg-success, #2f9e44);
}

/* 無効手のフラッシュ */
.wsp-tube.is-invalid {
  animation: wsp-shake 0.35s ease;
  border-color: var(--sg-danger, #e03131);
}
@keyframes wsp-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* 液体ユニット（1マス） */
.wsp-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 4px;
  background: transparent;
  font-size: 0.9rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  user-select: none;
}
.wsp-cell.is-filled {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
/* 一番上のユニットを少し強調（注げる位置の目印） */
.wsp-cell.is-top {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    inset 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* ツールバー（手数・難易度・ボタン） */
.wsp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wsp-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.wsp-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.wsp-stat__label {
  font-size: 0.8rem;
  color: var(--sg-muted, #666);
}
.wsp-stat__value {
  font-size: 1.25rem;
  font-weight: 700;
}
.wsp-diff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.wsp-diff__label {
  color: var(--sg-muted, #666);
  white-space: nowrap;
}
.wsp-diff__select {
  width: auto;
  min-width: 7.5em;
}

.wsp-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ステータス行 */
.wsp-status {
  margin: 10px 0 0;
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--sg-muted, #555);
  text-align: center;
}

/* クリア演出オーバーレイ */
.wsp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  text-align: center;
  background: var(--sg-surface, rgba(255, 255, 255, 0.94));
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}
/* hidden 属性を確実に効かせる（クラス指定の display:flex に勝たせる） */
.wsp-overlay[hidden] {
  display: none;
}
.wsp-overlay__text {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sg-success, #2f9e44);
}

/* 小さめの画面でもタップしやすく */
@media (max-width: 420px) {
  .wsp-tube {
    width: 42px;
  }
  .wsp-cell {
    height: 30px;
  }
  .wsp-board {
    gap: 12px 12px;
  }
}
