/* 練習ページ（practice.html）。処理は js/practice.js */
:root {
  --practice-learned: #198754;
  --practice-learning: #b07d00;
  --practice-warn8: #b07d00;
  --practice-warn12: #d9480f;
}
[data-bs-theme="dark"] {
  --practice-learned: #75b798;
  --practice-learning: #ffc94d;
  --practice-warn8: #ffc94d;
  --practice-warn12: #ff8a4c;
}

/* ---- 設定 ---- */
.practice-settings {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  align-items: center;
  padding: .65rem 1rem;
  border: 1px solid var(--mx-line-200);
  border-radius: .75rem;
  background: var(--mx-bg-50b);
}
/* スマホでたたんだときの 1 行（js/practice.js の settingsSummary）。広い画面では出さない */
.practice-settings-summary {
  display: none;
  align-items: center;
  gap: .45rem;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--mx-text-700);
  font-size: .8rem;
  text-align: left;
}
.practice-settings-icon {
  display: inline-flex;
  flex: none;
  line-height: 0;
  color: var(--mx-text-600);
}
/* 1 行に入らないときは項目の切れ目で折り返す（「…」で切ると、英語では出題などの設定が見えなくなるため） */
.practice-settings-text {
  flex: 1;
  min-width: 0;
  /* 1 行に収め、入らなければ末尾を … で切る（押せば開いて全部見られる） */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.practice-settings-part {
  white-space: nowrap;
}
.practice-settings-caret {
  flex: none;
  color: var(--mx-text-600);
  font-size: .7rem;
}
.practice-settings-summary:focus-visible {
  outline: none;
  border-radius: .35rem;
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .35);
}
.practice-field {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.practice-field-label {
  color: var(--mx-text-600);
  font-size: .78rem;
}
.practice-segment {
  display: inline-flex;
  flex-wrap: wrap; /* 狭い画面では折り返す（横にはみ出さないように） */
  max-width: 100%;
  padding: 3px;
  border-radius: 50rem;
  background-color: var(--mx-bg-175);
}
.practice-segment button {
  border: 0;
  border-radius: 50rem;
  padding: .2rem .75rem;
  background: transparent;
  color: var(--mx-text-700);
  font-size: .82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.practice-segment button.active {
  background-color: var(--mx-bg);
  color: var(--mx-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
}
.practice-segment button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .35);
}
.practice-segment .count {
  margin-left: .3rem;
  font-size: .72rem;
  opacity: .55;
  font-variant-numeric: tabular-nums;
}
/* 習得の目安：−［スライドバー（目盛り）］＋ 8秒 */
.practice-threshold {
  display: flex;
  align-items: center;
  gap: .4rem;
  /* 広い画面では、グループの要約が最大幅（.practice-groups-toggle の 12rem）になっても、
     グループ・対象・習得の目安・出題の 4 つの欄が 1 行に収まる幅（狭い画面では折り返して幅いっぱい）。
     細かい調整は「−」「＋」でできるので、スライドバーは短めでよい */
  width: 16rem;
  max-width: 100%;
}
.practice-threshold-track {
  position: relative;
  flex: 1;
  min-width: 8rem;
  padding-bottom: .9rem; /* 目盛りの文字のぶん */
}
.practice-threshold-range {
  --fill: 0%;
  display: block;
  width: 100%;
  height: 1.25rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.practice-threshold-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mx-text) var(--fill), var(--mx-bg-300) var(--fill));
}
.practice-threshold-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--mx-bg-300);
}
.practice-threshold-range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--mx-text);
}
.practice-threshold-range::-webkit-slider-thumb {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: calc(2px - .55rem);
  border: 2px solid var(--mx-text);
  border-radius: 50%;
  background: var(--mx-bg);
  -webkit-appearance: none;
  appearance: none;
}
.practice-threshold-range::-moz-range-thumb {
  width: 1.1rem;
  height: 1.1rem;
  box-sizing: border-box;
  border: 2px solid var(--mx-text);
  border-radius: 50%;
  background: var(--mx-bg);
}
.practice-threshold-range:focus-visible {
  outline: none;
}
.practice-threshold-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .35);
}
.practice-threshold-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .35);
}
/* 目盛り：つまみの中心が端から半分（.55rem）内側を動くので、そのぶん内側に置く */
.practice-threshold-scale {
  position: absolute;
  right: .55rem;
  bottom: 0;
  left: .55rem;
  height: .9rem;
  pointer-events: none;
}
.practice-threshold-tick {
  position: absolute;
  top: 0;
  color: var(--mx-text-500);
  font-size: .65rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}
.practice-threshold-tick::before {
  content: '';
  position: absolute;
  top: -.3rem;
  left: 50%;
  width: 1px;
  height: .2rem;
  background: var(--mx-text-550); /* 背景に対して約 3:1 */
}
[data-bs-theme="dark"] .practice-threshold-tick::before {
  background: var(--mx-line-500);
}
.practice-threshold-step {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  margin-bottom: .9rem; /* スライドバーの高さにそろえる */
  border: 1px solid var(--mx-line-300);
  border-radius: 50%;
  background: var(--mx-bg);
  color: var(--mx-text);
  line-height: 0;
}
.practice-threshold-step svg {
  display: block;
}
.practice-threshold-step:hover:not(:disabled) {
  background: var(--mx-bg-150);
}
.practice-threshold-step:disabled {
  color: var(--mx-text-400);
  cursor: default;
}
.practice-threshold-step:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .35);
}
.practice-threshold-value {
  display: inline-flex;
  flex: none;
  align-items: baseline;
  min-width: 3.6rem; /* 「20.0秒」が入る幅。秒数が変わってもスライドバーの長さが変わらないように */
  /* 「−」「＋」はスライドバーに合わせて上げるが、秒数はラベル（習得の目安・出題など）と同じ高さにする */
  font-size: .9rem;
  font-weight: 600;
}
/* 数字は左寄せで「＋」のすぐ右。小数 1 桁・等幅の数字なので、2.0〜9.5 のあいだは「秒」の位置が動かない */
.practice-threshold-num {
  font-variant-numeric: tabular-nums;
}
.practice-threshold-unit {
  margin-left: .1rem;
}

/* グループの絞り込み */
.practice-groups-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 12rem; /* 長いときは「…」で切る（マウスを乗せると title で全部出す） */
  padding: .2rem .7rem;
  border: 1px solid var(--mx-line-300);
  border-radius: 50rem;
  background: var(--mx-bg);
  color: var(--mx-text);
  font-size: .82rem;
}
.practice-groups-toggle > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.practice-groups-toggle[aria-expanded="true"] {
  border-color: var(--mx-line-500);
}
.practice-groups-caret {
  color: var(--mx-text-600);
  font-size: .7rem;
}
.practice-groups {
  flex-basis: 100%;
  padding-top: .5rem;
  border-top: 1px dashed var(--mx-line-250);
  /* 広い画面：欄の並び（1〜2 行）の下に回す。スマホは欄が縦に並ぶので、押した「グループ」のすぐ下（DOM の順。下の @media） */
  order: 1;
}
/* PLL の覚える順の 27 個が PC の幅で1行に収まるよう小さめにする（設定の枠の内側は一覧ページより狭いので、一覧ページの .group-nav-btn より少し小さい） */
.practice-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .15rem;
}
.practice-group-chip {
  min-width: 1.6rem; /* 1〜2 文字（A〜Z、1〜53・1C、F1 など）は同じ幅にそろえる */
  font-variant-numeric: tabular-nums;
  padding: .15rem .2rem;
  border: 1px solid var(--mx-line-300);
  border-radius: .45rem;
  background: var(--mx-bg);
  color: var(--mx-text-700);
  font-size: .75rem;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.practice-group-chip:hover {
  border-color: var(--mx-line-500);
}
.practice-group-chip.active {
  border-color: #0d6efd;
  background: #0d6efd;
  color: #fff;
}
.practice-groups-clear {
  padding: 0;
  font-size: .75rem;
  text-decoration: none;
}

/* 見出しの横の種類（PLL / OLL / LL / ソルブ。記録のページの種類と同じ場所）と範囲（OLL の No Dot / Dot / すべて）：
   箱ごと折り返すと、OLL に切り替えたときに種類の切り替えまで次の行に落ちてチラつくので、箱をなくして
   見出しの行に直接並べる。入りきらないときは範囲だけが次の行に落ち、種類は見出しの横から動かない */
.practice-set-box {
  display: contents;
}
/* OLL の範囲：768px 以上は種類の右、768px 未満は設定の中の「範囲」の欄（種類が 4 つになり、576〜767px でも
   種類の右に入りきらず、OLL のときだけ見出しの下に 1 行増えて設定・タイマーが下にずれるため。
   スマホの設定は 1 行の要約にたたまれ、範囲は要約の先頭に出る） */
.practice-scope-field {
  display: none;
}
@media (max-width: 767.98px) {
  .practice-scope-head {
    display: none;
  }
  .practice-scope-field {
    display: flex;
  }
}

/* ---- 出題とタイマー ---- */
.practice-stage {
  /* カード全体がタイマーの押す範囲（js/practice.js）。カードの上ではスクロール・文字選択・長押しのメニューを出さない */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  padding: 1.5rem 1rem 1.25rem;
  border: 1px solid var(--mx-line-200);
  border-radius: 1rem;
  background: var(--mx-bg);
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .05);
  text-align: center;
}
.practice-label {
  color: var(--mx-text-500);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.practice-scramble {
  /* 行数の分の高さをいつも取る（長さの違うスクランブルでタイマーの位置が上下しないように）。
     広い画面は PLL・OLL とも 2 行まで、スマホは PLL が 3 行になることがあるので 3 行分（下の @media） */
  min-height: 3em; /* line-height 1.5 × 2 行 */
  margin: .35rem auto 0;
  max-width: 44rem;
  font-family: var(--bs-font-monospace);
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  line-height: 1.5;
  word-spacing: .15em;
}
.practice-timer {
  display: block;
  width: 100%;
  margin: .5rem 0 .25rem;
  padding: .5rem 0;
  border: 0;
  background: none;
  color: var(--mx-text);
  font-size: clamp(3.5rem, 14vw, 6.5rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: color .1s ease;
}
.practice-timer.warn8 {
  color: var(--practice-warn8);
}
.practice-timer.warn12 {
  color: var(--practice-warn12);
}
.practice-timer.over {
  color: var(--mx-danger-text);
}
/* 止めた直後（2 秒）：まだスタートしないあいだは目立つ赤（「待って」の合図） */
.practice-timer.cooldown {
  color: var(--mx-danger-text);
}
/* 通し：長押し中（赤）→ 準備完了（緑）。離すとスタート。インスペクションの色より優先 */
.practice-timer.holding {
  color: var(--mx-danger-text);
}
.practice-timer.ready {
  color: var(--mx-success-text);
}
.practice-timer:focus-visible {
  /* Tab で来たときだけ枠を出す（マウス・タッチで押したときは出ない） */
  outline: 2px solid var(--mx-primary-text);
  outline-offset: 4px;
  border-radius: .5rem;
}
.practice-hint {
  color: var(--mx-text-600);
  font-size: .78rem;
}
/* 操作の説明（Tips）：頭に小さな札、右に ×（一度スタートするまでだけ出す） */
.practice-tip-label {
  display: inline-block;
  margin-right: .4rem;
  padding: 0 .4rem;
  border-radius: .3rem;
  background: var(--mx-warn-bg-2);
  color: var(--mx-warn-text);
  font-size: .7rem;
  font-weight: 600;
  vertical-align: 1px;
}
.practice-tip-close {
  margin-left: .3rem;
  padding: 0 .3rem;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--mx-text-500);
  font-size: .95rem;
  line-height: 1;
}
.practice-tip-close:hover {
  background: var(--mx-bg-150);
  color: var(--mx-text-600);
}
.practice-stage.running .practice-timer {
  color: var(--mx-primary-text);
}
/* 計測中は操作の説明を隠す（スクランブルは計測中も出したまま） */
.practice-stage.running .practice-hint {
  visibility: hidden;
}
/* PLL・OLL：解き終わったケース（例「PLL A1+」）。空でも高さを取っておき、出し入れでタイマー・ボタンが動かないようにする */
.practice-timer-case {
  height: 1.4em;
  margin-top: 1rem; /* スクランブルから離し、下のタイマーに寄せる */
  color: var(--mx-text-600);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ソルブで 15 秒未満で止めようとしたときの知らせ（止めずに続ける。js/practice.js の warnNotStopped）。
   タイマーのすぐ下に重ねて出し、出し入れでタイマー・ボタンが動かないようにする。並びから外し（position: absolute。top は決めず、
   並んでいたときの場所のまま）、1 行分上にずらす。並びに残すと、タイマーの下と「中止」の上の余白がたたまれなくなり「中止」が下がる。
   ほかの要素に position は付けない（全画面で画面の下に置いている「中止」の基準の要素が変わるため）。全画面の計測中も見える。
   押してもタイマーの操作の邪魔をしない（pointer-events: none） */
.practice-timer-warn {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(-1.2em);
  white-space: nowrap; /* 2 行になると下の「中止」に重なるので 1 行（文も 1 行に収まる長さ） */
  color: var(--mx-danger-text-2);
  font-size: .8rem;
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
}
.practice-timer-warn[hidden] {
  display: none;
}
/* 全画面でないソルブ：メッセージの行の分だけ、タイマーとボタン（「中止」）の間をいつも空けておく（出し入れでボタンが動かないように、
   メッセージとボタンの間も詰まりすぎないように）。メッセージはその間の真ん中に来るよう、少し上げる。
   全画面の計測中はボタンを画面の下に置くので、ここは変えない */
body.practice-full:not(.practice-focus) .practice-buttons {
  margin-top: 1.5rem !important; /* Bootstrap の mt-2（!important）より優先 */
}
body:not(.practice-focus) .practice-timer-warn {
  transform: translateY(calc(-1.2em - .5rem));
}
/* ケース名のすぐ下にタイマーを置く（通しはケース名を出さないので今までの間隔のまま） */
body:not(.practice-full) .practice-stage-top + .practice-timer {
  margin-top: 0;
  padding-top: .15rem;
}
.practice-hint-text {
  min-height: 1.6em;
  margin-top: .5rem;
  font-size: .9rem;
}
.practice-hint-name {
  margin-right: .5rem;
  font-weight: 600;
}
.practice-hint-moves {
  font-family: var(--bs-font-monospace);
}
/* ボタンは状態で出し分ける。行の高さはいつも取っておき、入れ替わってもタイマーなどが動かないようにする
   スタート前（止めたあとも）：スキップ・ヒント / 計測中：解けなかった・ヒント・中止 / インスペクション中（通し）：中止 */
.practice-buttons {
  min-height: calc(1.5em + .5rem + 2px); /* btn-sm の高さ */
}
/* キーボードのショートカットをボタンに添える（例「スキップ (S)」）。マウスが使える画面だけ（スマホでは出さない） */
@media (hover: hover) and (pointer: fine) {
  .practice-buttons button[data-key]::after {
    content: " (" attr(data-key) ")";
    opacity: .6;
    font-size: .85em;
  }
}
#dnfButton,
#cancelButton,
.practice-stage.running #skipButton,
.practice-stage.inspecting #skipButton,
.practice-stage.inspecting #hintButton {
  display: none;
}
body:not(.practice-full) .practice-stage.running #dnfButton,
.practice-stage.running #cancelButton,
.practice-stage.inspecting #cancelButton {
  display: inline-block;
}
.practice-stage button:not(.practice-timer) {
  touch-action: manipulation;
}
.practice-empty {
  margin-top: 1rem;
  color: var(--mx-text-600);
}

/* ---- 全画面（スクランブルとタイマーだけの画面。js/practice.js の setFocus）---- */
.practice-stage {
  position: relative;
}
.practice-focus-button {
  position: absolute;
  top: .5rem;
  right: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--mx-text-500);
}
.practice-focus-button:hover {
  background: var(--mx-bg-150);
  color: var(--mx-text-700);
}
.practice-focus-button .focus-close,
body.practice-focus .practice-focus-button .focus-open {
  display: none;
}
body.practice-focus .practice-focus-button .focus-close {
  display: block;
}
.practice-focus-verdict {
  display: none;
}
body.practice-focus {
  overflow: hidden;
}
body.practice-focus .practice-stage {
  position: fixed;
  inset: 0;
  z-index: 1040; /* 称号の知らせ（1060）はこの上に出る */
  /* タイマーを画面の真ん中に置き、上（スクランブル・ケース名）と下（判定・ボタンなど）の塊をその上下に寄せる */
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  height: 100vh;
  height: 100dvh;
  margin: 0 !important;
  padding: 3rem 1rem;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
body.practice-focus .practice-stage-top {
  align-self: end;
}
body.practice-focus .practice-stage-bottom {
  align-self: start;
}
/* PLL・OLL のスクランブルは少し大きく（ソルブは 7 行で幅いっぱいなので今の大きさのまま） */
body.practice-focus .practice-scramble:not(.full) {
  font-size: clamp(1.25rem, 3.4vw, 1.9rem);
}
body.practice-focus .practice-timer {
  font-size: clamp(4.5rem, 22vw, 10rem);
}
body.practice-focus .practice-focus-verdict {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .25rem .75rem;
  min-height: 1.6em; /* 出し入れでボタンが動かないように */
}
/* 全画面で計測中（インスペクション中も）：タイマーだけ。解けなかった・中止は画面の下の端に小さく薄く残す */
body.practice-focus .practice-stage:is(.running, .inspecting) :is(.practice-label, .practice-scramble, .practice-timer-case, .practice-hint, .practice-hint-text, .practice-focus-verdict, .practice-focus-button) {
  visibility: hidden;
}
body.practice-focus .practice-stage:is(.running, .inspecting) .practice-buttons {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.25rem;
  opacity: .55;
}
body.practice-focus .practice-stage:is(.running, .inspecting) #hintButton {
  display: none;
}

/* ---- 通し ---- */
.practice-scramble.full {
  width: fit-content; /* 行の頭をそろえる（左寄せのまま中央に置く） */
  text-align: left;
  max-width: 34rem;
  /* 1行（約41文字）がスマホの幅にも収まるよう、画面の幅に合わせて小さくする */
  font-size: clamp(.55rem, 2.95vw, 1.05rem);
  line-height: 1.7;
  white-space: pre-line;
  word-spacing: .1em;
}
/* 全画面のソルブ：スクランブルを大きく（最大 1.6rem）し、タイマーより上の余白の真ん中に置く（タイマーに寄せると窮屈なため。
   高さのある画面ほど上に上がる）。大きさは画面の高さにも合わせ（低い画面で 7 行が上にはみ出さないように）、
   通常の大きさ（1.05rem）より小さくはしない。横は今までどおり画面の幅で止める（1 行約 41 文字が収まるように） */
body.practice-focus .practice-scramble.full {
  max-width: none;
  font-size: clamp(.55rem, min(2.95vw, max(1.05rem, 2.1vh)), 1.6rem);
}
body.practice-focus.practice-full .practice-stage-top {
  align-self: center;
}
/* 通しでは「解けなかった」「スキップ」「ヒント」は出さない（DNF は結果の OK / +2 / DNF で付ける）。「中止」は出す */
.practice-full #hintButton,
.practice-full #dnfButton,
.practice-full #skipButton,
.practice-full #practiceHintText,
.practice-full #timerCase {
  display: none;
}
/* ---- LL ---- */
/* LL ではヒントを出さない（OLL と PLL の 2 つを解くので、ヒントの形が合わない） */
.practice-ll #hintButton,
.practice-ll #practiceHintText {
  display: none;
}
/* スクランブルが長い（30 手くらい）ので、広い画面でも 3 行分の高さを取る */
.practice-scramble.ll {
  min-height: 4.5em;
}
/* 結果の OLL → PLL（入らなければ折り返す） */
.practice-ll-cases {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
}
.practice-ll-case {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  text-align: left;
}
.practice-ll-case canvas {
  flex: none;
}
.practice-ll-case-text {
  min-width: 0;
}
.practice-ll-arrow {
  color: var(--mx-text-600);
  font-size: 1.1rem;
}

/* 結果のスクランブル（1 行約 41 文字・折り返さない）。スマホの幅にも収まるよう画面の幅に合わせて小さくする。
   .practice-case-alg（.85rem）より後に書かれていても負けないよう、2 つのクラスで指定する */
.practice-case-alg.practice-full-scramble {
  width: fit-content; /* 1 行おきのストライプを文字の幅で止める（画面の端まで伸ばさない） */
  max-width: 100%;
  text-align: left; /* スマホでは結果が中央寄せになるが、スクランブルは行の頭をそろえる */
  white-space: pre-line;
  color: var(--mx-text-600);
  font-size: min(.75rem, 2.7vw);
}
/* ソルブの ao5・ao12 など：広い画面は「今」と「ベスト」の 2 行（列をそろえる）、スマホは 1 枚の表（js/practice.js の renderFullStats） */
.practice-stat-chips {
  display: grid;
  grid-template-columns: auto repeat(4, auto);
  justify-content: start;
  row-gap: .4rem;
  max-width: 100%;
}
.practice-stat-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: baseline;
  column-gap: 1.5rem;
  padding: .35rem 1rem;
  border: 1px solid var(--mx-line-200);
  border-radius: .6rem;
  background: var(--mx-bg);
}
.practice-stat-row-head {
  min-width: 3em;
  color: var(--mx-text-600);
  font-size: .78rem;
  font-weight: 600;
}
/* 数字の欄は「1:00.00」が入る幅をいつも取る（まだ出ていない「–」のときも、記録が増えても幅が変わらないように） */
.practice-stat-row .practice-stat-value {
  display: inline-block;
  min-width: 6.2ch;
}
.practice-stat-row .practice-stat-value.empty {
  text-align: center;
}
/* 576〜767px：1 行に収まるよう間隔を詰める */
@media (max-width: 767.98px) {
  .practice-stat-row {
    column-gap: .7rem;
    padding: .35rem .75rem;
  }
}
.practice-full-card {
  display: none;
  padding: .5rem .75rem;
  border: 1px solid var(--mx-line-200);
  border-radius: .6rem;
  background: var(--mx-bg);
}
@media (max-width: 575.98px) {
  .practice-stat-chips {
    display: none;
  }
  .practice-full-card {
    display: block;
  }
}
.practice-full-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.practice-full-table th {
  color: var(--mx-text-600);
  font-size: .72rem;
  font-weight: 500;
}
.practice-full-table thead th {
  padding-bottom: .1rem;
  text-align: right;
}
.practice-full-table th[scope="row"] {
  width: 3.75rem; /* 行の見出し（今・ベスト / Current・Best）。残りを 3 列で均等に分ける */
  text-align: left;
}
.practice-full-table td {
  padding: .1rem 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.practice-full-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .5rem;
  margin-top: .4rem;
  padding-top: .4rem;
  border-top: 1px solid var(--mx-line-150);
  font-size: .85rem;
}
.practice-full-pair {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
}
.practice-full-dot {
  color: var(--mx-text-400);
}
.practice-stat {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  white-space: nowrap;
}
.practice-stat-label {
  color: var(--mx-text-600);
  font-size: .72rem;
}
.practice-stat-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- 結果 ---- */
.practice-result {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--mx-line-200);
  border-radius: 1rem;
  background: var(--mx-bg-50b);
  animation: practice-in .2s ease-out;
}
.practice-result[hidden] {
  display: none;
}
@keyframes practice-in {
  from { opacity: 0; transform: translateY(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .practice-result { animation: none; }
}
.practice-result canvas {
  flex: none;
}
.practice-result-body {
  min-width: 0;
}
.practice-result-time {
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.practice-verdict {
  font-size: .9rem;
}
.practice-verdict.learned {
  color: var(--practice-learned);
}
.practice-verdict.learning {
  color: var(--practice-learning);
}
.practice-case-name {
  font-weight: 600;
}
.practice-case-alg {
  font-family: var(--bs-font-monospace);
  font-size: .85rem;
  word-break: break-word;
}
.practice-case-scramble {
  color: var(--mx-text-600);
  word-break: break-word;
}
/* スクランブルは解法の手順（.practice-case-alg の .85rem）より少しだけ小さく */
.practice-case-scramble .practice-case-alg {
  font-size: .8rem;
}
.practice-case-scramble-label {
  color: var(--mx-text-600);
  font-size: .78rem;
}
.practice-case-stats {
  color: var(--mx-text-600);
  font-size: .78rem;
}
/* その回の判定の切り替え（習得済み・練習中・解けなかった。js/practice.js の verdictSwitch）：設定と同じセグメント型を小さく。
   選んでいるものは判定の色の文字（習得済みは緑、練習中・解けなかったは琥珀）。右に小さく理由（「8秒以内」など） */
.practice-verdict-switch {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .5rem;
}
.practice-verdict-choices {
  padding: 2px;
}
.practice-verdict-choices button {
  padding: .1rem .6rem;
  font-size: .8rem;
}
.practice-verdict-choices button.active.learned {
  color: var(--practice-learned);
}
.practice-verdict-choices button.active:is(.learning, .dnf) {
  color: var(--practice-learning);
}
.practice-verdict-reason {
  color: var(--mx-text-600);
  font-size: .75rem;
}
.practice-result-actions {
  display: inline-flex;
  gap: .75rem;
  white-space: nowrap;
}
.practice-undo {
  padding: 0;
  border: 0;
  font-size: .85rem;
  text-decoration: none;
}

/* ---- 最近の記録 ---- */
.practice-history {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: 0;
  list-style: none;
}
.practice-history li {
  padding: .15rem .6rem;
  border-radius: 50rem;
  background: var(--mx-bg-150);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
/* ソルブ：タイムだけなので、丸を同じ幅にして格子にそろえる（「1:33.46+」が入る幅。折り返しても列がそろう）。
   スマホは行いっぱいに均等に広げる（右に半端な隙間を残さない） */
.practice-history.full {
  display: grid;
  grid-template-columns: repeat(auto-fill, 4.7rem);
}
.practice-history.full li {
  padding-left: 0;
  padding-right: 0;
  text-align: center;
}
@media (max-width: 575.98px) {
  .practice-history.full {
    grid-template-columns: repeat(auto-fill, minmax(4.7rem, 1fr));
  }
}
/* チップはボタン（押すとケースを下に出す）。見た目は丸い札のまま */
.practice-history-chip {
  padding: .15rem .6rem;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  font: inherit;
}
.practice-history li:has(> .practice-history-chip) {
  padding: 0;
}
.practice-history-chip[aria-expanded="true"] {
  box-shadow: inset 0 0 0 1.5px currentColor;
}
/* 押したチップのケース：画像・名前・習得状況・手順・その回のタイム・最近のベスト／平均・エディタで開く */
.practice-history-detail {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  margin-top: .6rem;
  padding: .75rem 2.2rem .75rem .75rem;
  border: 1px solid var(--mx-line-200);
  border-radius: .75rem;
  background: var(--mx-bg);
}
.practice-history-detail[hidden] {
  display: none;
}
.practice-history-detail canvas {
  flex: none;
}
.practice-history-close {
  position: absolute;
  top: .6rem;
  right: .6rem;
  width: .6em;
  height: .6em;
}
.practice-history-status {
  padding: .05rem .5rem;
  border-radius: 50rem;
  background: var(--mx-bg-150);
  color: var(--mx-text-700);
  font-size: .72rem;
}
.practice-history-status.learned {
  background: rgba(25, 135, 84, .1);
  color: var(--mx-success-text-2);
}
.practice-history-status.learning {
  background: rgba(240, 173, 0, .14);
  color: var(--mx-warn-text-2);
}
.practice-history-editor {
  display: inline-block;
  margin-top: .35rem;
}
.practice-history li.learned {
  background: rgba(25, 135, 84, .1);
  color: var(--mx-success-text-2);
}
.practice-history li.learning {
  background: rgba(240, 173, 0, .14);
  color: var(--mx-warn-text-2);
}

@media (max-width: 575.98px) {
  .practice-settings {
    padding: .65rem .75rem;
  }
  /* 設定は 1 行の要約にたたむ（押すと開く）。開いているときは要約が見出しになる */
  .practice-settings-summary {
    display: flex;
  }
  .practice-scramble:not(.full) {
    min-height: 4.5em; /* line-height 1.5 × 3 行（PLL は 3 行になることがある。OLL は 2 行まで） */
  }
  .practice-settings:not(.open) > :not(.practice-settings-summary) {
    display: none;
  }
  .practice-settings:not(.open) {
    padding: .5rem .75rem;
  }
  /* グループを選ぶ欄は「グループ」のすぐ下（対象・習得の目安・出題の下に離れて出ないように。js/practice.js の renderSettings） */
  .practice-groups {
    order: 0;
  }
  /* 対象（未習得・練習中・習得済み・すべて ＋件数）が 1 行に収まるよう詰める */
  .practice-segment button {
    padding: .2rem .45rem;
    font-size: .78rem;
  }
  .practice-segment .count {
    margin-left: .2rem;
    font-size: .68rem;
  }
  /* それでも折り返すときに角の丸みで崩れて見えないように */
  .practice-segment {
    border-radius: 1rem;
  }
  .practice-result {
    flex-direction: column;
    text-align: center;
  }
  /* LL のスクランブルは 4 行になることがある */
  .practice-scramble.ll {
    min-height: 6em;
  }
  .practice-ll-cases {
    justify-content: center;
  }
}

/* 称号が上がった・バッジを取った・対象を進めたときの知らせ（js/practice.js の toast）。
   タイマーのカードの、ボタンのすぐ下に重ねて出す（.practice-toast-anchor は高さ 0 で、ほかを押し下げない）。
   長いときは下（結果の上の方）に重なって伸びる */
.practice-toast-anchor {
  position: relative;
  height: 0;
}
.practice-toast {
  position: absolute;
  left: 50%;
  top: .4rem;
  z-index: 1060;
  width: max-content;
  max-width: calc(100% + 1rem); /* カードの枠まで */
  padding: .6rem 1rem;
  border: 1px solid var(--mx-warn-line);
  border-radius: .75rem;
  background: var(--mx-warn-bg);
  color: var(--mx-warn-text);
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .15);
  font-size: .9rem;
  font-weight: 600;
  text-align: center;
  padding-right: 2rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: opacity .25s ease, transform .25s ease;
}
.practice-toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
/* 出るときに少し大きくなって戻る（css/common.css の toast-pop-fixed） */
.practice-toast.show.pop {
  animation: toast-pop-fixed .5s ease;
}
.practice-toast[hidden] {
  display: none;
}
/* メダルのマークと文を横に並べる */
.practice-toast {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.practice-toast .title-medal {
  color: #d9a400;
}
.practice-toast .title-medal svg {
  width: 26px;
  height: 26px;
}
.practice-toast-lines {
  min-width: 0;
}
/* 先に閉じる × （次の計測を始めても消える） */
.practice-toast-close {
  position: absolute;
  top: .15rem;
  right: .3rem;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--mx-warn-text-3);
  font-size: 1.1rem;
  line-height: 1;
}
.practice-toast-close:hover {
  background: var(--mx-hover);
}
/* スマホ（幅 576px 未満）：「称号が上がりました」の次の行に名前（区切りの「：」「、」は出さず、名前を 1 つずつ 1 行に） */
@media (max-width: 575.98px) {
  .practice-toast-sep {
    display: none;
  }
  .practice-toast-names,
  .practice-toast-name {
    display: block;
    font-size: 1rem;
  }
}
/* 名前の途中では折り返さない（「、」のあとで折り返す） */
.practice-toast-name {
  white-space: nowrap;
}
/* 知らせの中の「次のグループ（E）へ」（白地に緑の枠と字。塗りつぶすと目立ちすぎるため） */
.practice-toast-action {
  margin-top: .4rem;
  padding: .2rem .8rem;
  border: 1px solid #198754;
  border-radius: 50rem;
  background: var(--mx-bg);
  color: var(--mx-success-text);
  font-size: .85rem;
}
.practice-toast-action:hover,
.practice-toast-action:focus-visible {
  border-color: #198754;
  background: var(--mx-success-bg);
  color: var(--mx-success-text-2);
}
.practice-toast-line + .practice-toast-line {
  margin-top: .2rem;
}
/* 隠しバッジを取ったとき（js/practice.js の toast で .secret）：虹色に流れる枠・紫の文字・光る影・きらきら・大きめに弾む */
.practice-toast.secret {
  border: 2px solid transparent;
  background:
    linear-gradient(#fcf6ff, #fcf6ff) padding-box,
    linear-gradient(120deg, #ff6b6b, #ffb347, #ffd93d, #6bcb77, #4d96ff, #c77dff, #ff6b6b) border-box;
  background-size: 100% 100%, 300% 300%;
  color: #5b2b86;
  box-shadow: 0 0 0 4px rgba(199, 125, 255, .18), 0 .75rem 2rem rgba(120, 60, 180, .3);
  animation: secret-shine 3s linear infinite;
}
/* ダーク：地を暗い紫に、文字を明るい紫に（虹の枠はそのまま） */
[data-bs-theme="dark"] .practice-toast.secret {
  background:
    linear-gradient(#2a2135, #2a2135) padding-box,
    linear-gradient(120deg, #ff6b6b, #ffb347, #ffd93d, #6bcb77, #4d96ff, #c77dff, #ff6b6b) border-box;
  background-size: 100% 100%, 300% 300%;
  color: #dcc3ff;
}
[data-bs-theme="dark"] .practice-toast.secret .practice-toast-close {
  color: #c9a6ec;
}
[data-bs-theme="dark"] .practice-toast-line.secret .practice-toast-head {
  background: linear-gradient(90deg, #f06595, #9775fa, #4dabf7);
  -webkit-background-clip: text;
  background-clip: text;
}
.practice-toast.secret.show.pop {
  animation: secret-pop-fixed .7s cubic-bezier(.3, 1.5, .5, 1), secret-shine 3s linear infinite;
}
.practice-toast-line.secret .practice-toast-head {
  background: linear-gradient(90deg, #d6336c, #7048e8, #1c7ed6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.practice-toast.secret .title-medal {
  color: #a855f7;
  animation: secret-medal 1.2s ease-in-out .2s 2;
}
.practice-toast.secret .practice-toast-close {
  color: #7d4aa8;
}
.practice-toast-note {
  display: block;
  margin-top: .15rem;
  font-size: .8rem;
  font-weight: 400;
  opacity: .85;
}
.practice-toast-sparkle {
  position: absolute;
  color: #f5b301;
  font-size: .9rem;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  animation: secret-twinkle 1.6s ease-in-out infinite;
}
.practice-toast-sparkle:nth-of-type(1) { top: -.55rem; left: 8%; animation-delay: 0s; }
.practice-toast-sparkle:nth-of-type(2) { top: -.7rem; left: 55%; color: #c77dff; font-size: .75rem; animation-delay: .5s; }
.practice-toast-sparkle:nth-of-type(3) { bottom: -.6rem; left: 25%; color: #4d96ff; animation-delay: .9s; }
.practice-toast-sparkle:nth-of-type(4) { bottom: -.55rem; right: 12%; color: #ff6b6b; font-size: .75rem; animation-delay: .3s; }
.practice-toast-sparkle:nth-of-type(5) { top: 30%; left: -.6rem; color: #6bcb77; font-size: .7rem; animation-delay: 1.1s; }
.practice-toast-sparkle:nth-of-type(6) { top: 40%; right: -.6rem; animation-delay: .7s; }
@keyframes secret-shine {
  from { background-position: 0 0, 0% 50%; }
  to { background-position: 0 0, 300% 50%; }
}
@keyframes secret-pop-fixed {
  0% { opacity: 0; transform: translate(-50%, 1rem) scale(.6) rotate(-4deg); }
  60% { opacity: 1; transform: translate(-50%, 0) scale(1.12) rotate(1.5deg); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(0); }
}
@keyframes secret-medal {
  0%, 100% { transform: rotate(0) scale(1); }
  30% { transform: rotate(-18deg) scale(1.2); }
  60% { transform: rotate(14deg) scale(1.15); }
}
@keyframes secret-twinkle {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0); }
  50% { opacity: 1; transform: scale(1.1) rotate(45deg); }
}
@media (prefers-reduced-motion: reduce) {
  .practice-toast {
    transition: none;
  }
  .practice-toast.secret,
  .practice-toast.secret.show.pop,
  .practice-toast.secret .title-medal {
    animation: none;
  }
  .practice-toast-sparkle {
    animation: none;
    opacity: 1;
  }
  .practice-toast.show.pop {
    animation: none;
  }
}

/* ソルブの設定「スクランブル」の横の ⓘ（新方式の説明 scramble.html へのリンク）。控えめな灰色（欄の見出しと同じ）のアイコンだけ */
.practice-field-info {
  display: inline-flex;
  align-items: center;
  color: var(--mx-text-600);
  margin-left: -.4rem; /* 欄の隙間（.5rem）を詰めて、WCA / 新方式のボタンに寄せる */
  padding: .15rem;
  border-radius: 50%;
}
.practice-field-info:hover,
.practice-field-info:focus-visible {
  color: var(--mx-text);
}
