/* クォッカのくるくるパネルライフの画面スタイル。
   配色は他のクォッカ作品と揃えたクォッカ路線(やわらかいピンク + クリーム)に、
   「くるくる回る」パネルを目立たせるための金色(点灯色)を足している。
   参加画面(join-screen)とゲーム画面(game-screen)を切り替えて使う。 */

:root {
  --pink: #e85d84;
  --pink-soft: #ffe3ec;
  --pink-bg: #fff6fa;
  --cream: #fffdfb;
  --text: #5b4a4a;
  --text-muted: #9c8d8d;
  --danger: #d9534f;
  --bad: #d9534f;
  --gold: #f2b73f;
  --gold-soft: #ffe9b8;
  --panel-off: #cbb59a;
  --panel-off-dark: #8a745c;
}

* {
  box-sizing: border-box;
}

/* iPhoneは連打(ダブルタップ)をズーム操作と解釈することがある。
   manipulationにすると、ピンチズームは残したままダブルタップズームだけ止められる。 */
html {
  touch-action: manipulation;
}

body {
  margin: 0;
  padding: 0;
  font-family: "M PLUS Rounded 1c", -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #fff6fa 0%, #fffdfb 55%, #fff9f2 100%);
  min-height: 100vh;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

/* --- 画面 ---------------------------------------------------------------- */

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 90px;
  min-height: 100vh;
}

.panel {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  border-radius: 22px;
  padding: 26px 22px 20px;
  box-shadow: 0 10px 30px rgba(232, 93, 132, 0.12);
  text-align: center;
}

h1 {
  font-size: 21px;
  font-weight: 800;
  color: var(--pink);
  margin: 0 0 8px;
}

.sparkle {
  font-size: 16px;
}

.hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 12px;
}

.link-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* 「遊び方を見る」「ぽかぽんの他のゲーム」「シェア」は、押せることが伝わるよう
   3つとも同じピルボタンの見た目にしている(文字リンクのままだと伝わりにくいため)。 */
.rules-link,
.link-row .home-link,
.share-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 2px solid var(--pink-soft);
  border-radius: 999px;
  background: #ffffff;
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
}

.rules-link:hover,
.link-row .home-link:hover,
.share-button:hover {
  border-color: var(--pink);
  background: var(--pink-bg);
}

label {
  display: block;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--cream);
  border: 2px solid var(--pink-soft);
  border-radius: 12px;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--pink);
}

button {
  font-family: inherit;
  cursor: pointer;
}

.primary {
  width: 100%;
  margin-top: 16px;
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  background: var(--pink);
  border: none;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(232, 93, 132, 0.32);
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.primary:hover {
  box-shadow: 0 6px 16px rgba(232, 93, 132, 0.4);
}

.primary:active {
  transform: translateY(1px);
}

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pink);
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  border-radius: 999px;
  transition: background 0.12s ease, transform 0.08s ease;
}

.secondary:hover {
  background: var(--pink-bg);
}

.secondary:disabled {
  color: var(--text-muted);
  border-color: #f0eae6;
  opacity: 0.65;
  cursor: default;
}

.join-error {
  margin-top: 10px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #b4453f;
  background: #ffeceb;
  border: 2px solid #ffd6d3;
  border-radius: 12px;
}

/* --- むずかしさの選択 ------------------------------------------------------ */

/* 2×2に並べる。4つを横1列にすると1つ90px前後になり、狭い画面で
   「むずかしい」がぎりぎりになるため(2026-08-12にげきむずを足したときに変更)。 */
.difficulty-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.difficulty-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 4px;
  font-family: inherit;
  color: var(--text-muted);
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  border-radius: 14px;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.difficulty-choice .difficulty-name {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

/* 何手で解けるかは選ぶときの判断材料なので、名前と一緒に必ず出す。 */
.difficulty-choice .difficulty-moves {
  font-size: 11px;
  font-weight: 700;
}

.difficulty-choice:hover {
  border-color: var(--pink);
}

.difficulty-choice.on {
  color: #ffffff;
  background: var(--pink);
  border-color: var(--pink);
}

/* --- ランキング ---------------------------------------------------------- */

.ranking-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}

.ranking-group {
  background: var(--pink-bg);
  border: 2px solid var(--pink-soft);
  border-radius: 14px;
  padding: 12px 14px;
}

.ranking-group-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--pink);
  margin-bottom: 6px;
}

.ranking-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
  border-radius: 8px;
}

.ranking-row.you .ranking-name {
  font-weight: 800;
  color: var(--pink);
}

.ranking-rank {
  width: 26px;
  flex-shrink: 0;
  text-align: center;
}

.ranking-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-value {
  font-weight: 800;
  color: var(--pink);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.ranking-empty {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- フッター ------------------------------------------------------------ */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  background: rgba(255, 253, 251, 0.92);
  border-top: 1px solid var(--pink-soft);
  backdrop-filter: blur(2px);
}

.site-footer a { color: var(--pink); font-weight: 600; text-decoration: none; }

.footer-links,
.footer-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 6px;
}

.copyright {
  color: var(--text-muted);
  font-size: 11px;
}

.version-link {
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.version-link:hover {
  color: var(--pink);
}

.sound-credit {
  color: var(--text-muted);
}

/* --- 音量設定 ------------------------------------------------------------- */

.sound-controls {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.mute-btn {
  /* 【2026-08-18】絵文字を字として置くとベースラインに沿ってしまい、丸ボタンの
     真ん中からズレる(🔊と⚙️で字形の高さが違うので特に目立つ)。中身を中央に置く。 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  width: 40px;
  height: 40px;
  font-size: 17px;
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(91, 74, 74, 0.12);
}

.settings-btn { width: 32px; height: 32px; font-size: 14px; }

.sound-panel {
  margin-top: 8px;
  padding: 12px 14px;
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(91, 74, 74, 0.14);
}

.sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.sound-mute-btn {
  width: 30px;
  height: 30px;
  font-size: 14px;
  background: var(--pink-bg);
  border: 2px solid var(--pink-soft);
  border-radius: 50%;
}

.sound-row-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  width: 46px;
  text-align: left;
}

/* 軽量サウンドの注意書き(2026-08-13)。 */
.sound-note {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 190px;
}

.sound-volume {
  width: 92px;
  accent-color: var(--pink);
}

/* --- クォッカ(マスコット) -------------------------------------------------- */

/* 開始画面だけはPNGの縦長イラスト(600×800)。他の画面のクォッカ(ui.jsのSVG)とは
   縦横比が違うので、高さは auto にして比率を保たせる。 */
.quokka {
  display: block;
  width: 132px;
  height: auto;
  margin: 2px auto 6px;
}

.result-quokka {
  width: 90px;
  height: 46px;
  margin: 2px auto 4px;
}

.quokka svg,
.result-quokka svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.face-glad,
.face-sad { display: none; }

.glad .face-normal,
.sad .face-normal { display: none; }

.glad .face-glad { display: block; }
.sad .face-sad { display: block; }

.quokka.glad, .result-quokka.glad { animation: quokka-glad 0.55s ease; }
.quokka.sad, .result-quokka.sad { animation: quokka-sad 0.5s ease; }

@keyframes quokka-glad {
  0% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-10px) rotate(-8deg); }
  70% { transform: translateY(0) rotate(6deg); }
  100% { transform: translateY(0) rotate(0); }
}

@keyframes quokka-sad {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* --- ゲーム画面のHUD ------------------------------------------------------ */

.hud {
  padding-inline: 56px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-bottom: 10px;
}

.pill {
  font-size: 12px;
  padding: 5px 12px;
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill span {
  color: var(--pink);
  font-weight: 800;
}

/* 時間の桁が増えてもピルの幅が変わらないように固定する。幅が変わると
   HUDの折り返し位置が「1分5秒⇔1分15秒」で行き来してちらつく(2026-08-13報告)。
   「12分34秒」まで収まる幅。 */
#v-time {
  display: inline-block;
  min-width: 4.6em;
  text-align: center;
}

.pill.warn {
  border-color: #f0ad4e;
  background: #fff7e8;
}

.pill.flash {
  animation: pop 0.5s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* --- 盤面 ------------------------------------------------------------------ */

.board-wrap {
  position: relative;
  width: min(92vw, 420px);
  margin: 6px auto 4px;
}

/* スマイルの数に応じて笑顔になっていくクォッカ。
   大食いライフの .quokka と同じ考えで、盤面の「上」に中央揃えで大きく出す。
   表情の変化を見せるのがこのゲームの主役の演出なので、隅に小さく添えるのではなく
   盤面と同じくらいの幅を取る。 */
.smile-quokka {
  display: block;
  margin: 2px auto 6px;
  width: min(56vw, 190px);
  pointer-events: none;
}

.smile-quokka svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* 口とほおは連続的に変わるので、transitionでつないでなめらかに見せる。 */
.smile-quokka .sq-mouth,
.smile-quokka .sq-cheek {
  transition: opacity 0.25s ease, d 0.25s ease;
}

/* 【重要】目にはtransitionを付けないこと。黒点と弧を薄くしながら入れ替えると、
   その間だけ両方が半透明で重なって「まぶたが重い変な顔」になる(2026-08-11に指摘)。
   パッと切り替わるほうが表情としても気持ちよく決まる。 */

.board {
  /* 【重要】列・行とも 1fr で明示し、盤面全体には aspect-ratio: 1/1 を掛ける。
     こうすると盤面の高さが横幅から機械的に決まり、中身(裏=🙈はアイコンが空)の
     有無に一切左右されなくなる。

     2026-08-11の教訓: grid-template-rows を消して .cell 側の aspect-ratio だけに
     任せると、行の高さが中身依存の auto になり、盤面の高さが横幅と一致しなくなる。
     その結果ヒント表示のたびに盤面の高さが変わり(420px→456px)、下のボタンが
     押し下げられる「ヒントを押すとパネルがずれる」不具合になった。
     行の高さは必ずここで 1fr として決めること。 */
  --board-size: 3;
  display: grid;
  grid-template-columns: repeat(var(--board-size), 1fr);
  grid-template-rows: repeat(var(--board-size), 1fr);
  gap: 4px;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 8px;
  background: #fffdfb;
  border: 3px solid var(--pink-soft);
  border-radius: 16px;
  position: relative;
  z-index: 1;
}

/* 1マス。裏(クォッカの後ろ姿)と表(クォッカの顔)をアイコン(CELL_ICON、ui.js)で
   はっきり切り替える。色だけだと分かりにくいというフィードバックを受けて、
   目・口や耳がちゃんと見えるSVGアイコンに描き直した(2026-08-09)。 */
.cell {
  /* 正方形は .board 側(列・行とも1fr + 盤面のaspect-ratio)で決まるので、
     ここでaspect-ratioは指定しない(二重指定になり噛み合わない)。
     min-width/min-height:0 は、グリッド項目の既定値(auto)が中身のサイズを
     トラックの最小サイズに持ち込むのを防ぐために必要(裏=🙈は中身が空のため)。 */
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 10%;
  cursor: pointer;
  perspective: 300px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cell-icon {
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.cell.off {
  background: linear-gradient(155deg, var(--panel-off) 0%, var(--panel-off-dark) 100%);
  color: #6b5842;
}

.cell.on {
  background: linear-gradient(155deg, #ffe6b0 0%, var(--gold) 100%);
  color: #a9781a;
  box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(242, 183, 63, 0.55) inset;
}

/* ヒント(青)・選択中プレビュー(ピンク)の枠。
   【重要1】クラス名は必ず "cell-" 接頭辞付き(.cell-hint / .cell-preview)にする。
   単に .hint にすると、参加画面の説明文用に定義されているグローバルな
   .hint(margin: 6px 0 12px の段落スタイル)が盤面のマスにも当たってしまい、
   ヒント枠が付いたマスだけ余白のぶん縮む(130x130 → 130x112)。
   2026-08-11に「ヒントのやつだけ縮む」という不具合として発覚した実例。

   【重要2】枠は .cell 自身ではなく専用の擬似要素(::after=ヒント、::before=選択)に
   描く。透明な枠として最初から常に置いてあるので、付いても消えてもマスの大きさ・
   位置は1pxも動かない。枠を .cell の box-shadow で描くと、表のマス(.cell.on)が持つ
   白いフチ(box-shadow: 0 0 0 2px #fff)を同じプロパティで上書きしてしまい、
   やはり枠付きのマスだけ小さく見える。枠と背景装飾で box-shadow を取り合わせないこと。 */
.cell::before,
.cell::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  border: 4px solid transparent;
  pointer-events: none;
}

/* ヒント(青)は外側。 */
.cell::after {
  inset: 0;
}

/* 選択(ピンク)は通常は外側だが、ヒントと重なったときだけ内側にずらして
   2重リングにし、両方見えるようにする。 */
.cell::before {
  inset: 0;
}

.cell-hint::before {
  inset: 4px;
}

.cell-hint::after {
  border-color: #4a9ad4;
  animation: hint-pulse 0.9s ease-in-out infinite;
}

.cell-preview::before {
  border-color: var(--pink);
}

@keyframes hint-pulse {
  0%, 100% { border-color: #4a9ad4; }
  50% { border-color: #8fd0f0; }
}

@media (prefers-reduced-motion: reduce) {
  .cell-hint::after {
    animation: none;
    border-color: #4a9ad4;
  }
}

/* タップで裏返るマスの「くるくる」演出。中心から波紋のように、遅れて回りだす(spinAffected)。 */
.cell.spin {
  animation: cell-spin 0.4s ease;
}

@keyframes cell-spin {
  0% { transform: rotateY(0deg) scale(1); }
  45% { transform: rotateY(160deg) scale(1.08); }
  100% { transform: rotateY(360deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .cell.spin { animation: none; }
}

/* 押した位置の真上からクォッカが降ってくる演出(dropQuokka)。 */
.falling-quokka {
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 24px;
  margin: -60px 0 0 -23px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

.falling-quokka svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.falling-quokka.drop {
  animation: quokka-drop 0.45s cubic-bezier(0.3, 0.9, 0.4, 1);
}

@keyframes quokka-drop {
  0% { opacity: 1; transform: translateY(-120px) scale(0.7); }
  70% { opacity: 1; transform: translateY(0) scale(1.05); }
  85% { transform: translateY(-6px) scale(0.98); }
  100% { opacity: 0; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .falling-quokka.drop { animation: none; opacity: 0; }
}

/* ステージクリアの合図。トーストだけだと気づきにくいというフィードバックを受けて、
   盤面の上に大きく重ねて出す(2026-08-09)。 */
.stage-clear-banner {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}

.stage-clear-banner .banner-text {
  padding: 12px 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid var(--gold);
  box-shadow: 0 10px 30px rgba(91, 74, 74, 0.25);
  font-size: 20px;
  font-weight: 800;
  color: #a9781a;
  text-align: center;
  white-space: nowrap;
}

.stage-clear-banner.show {
  animation: stage-clear-pop 1.1s ease forwards;
}

@keyframes stage-clear-pop {
  0% { opacity: 0; transform: scale(0.7); }
  15% { opacity: 1; transform: scale(1.08); }
  25% { transform: scale(1); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .stage-clear-banner.show { animation: stage-clear-fade 1.1s ease forwards; }
  @keyframes stage-clear-fade {
    0%, 75% { opacity: 1; }
    100% { opacity: 0; }
  }
}

/* --- お知らせ ------------------------------------------------------------ */

/* 【1行しか出ない】長い文は ellipsis で silently 切られる。高さを固定しているのは、
   トーストが出たり消えたりするたびに下のボタンが動くのを防ぐため(盤面のすぐ下にある)。
   **入る幅は狭い画面(320px)で約262px。日本語なら20文字前後が上限**なので、
   flashHud に渡す文はそれより短くすること(2026-08-12に「初期配置に戻す」の
   メッセージが見切れて発覚)。詳しい説明が要るものは遊び方のページに書く。 */
.toast {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  margin: 4px auto 2px;
  max-width: min(92vw, 340px);
  font-size: 13px;
  font-weight: 700;
  padding: 0 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  color: var(--pink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

/* --- ゲーム画面の操作ボタン ------------------------------------------------ */

/* ヒントの枠が出ているあいだ、ずっと出しておく説明。枠と同じ青にして対応づける。 */
.hint-legend {
  width: min(92vw, 340px);
  margin: 6px auto 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: #2f6f96;
  background: #eaf6fd;
  border: 2px solid #4a9ad4;
  border-radius: 999px;
}

.hint-legend strong {
  color: #1d5b80;
}

/* ステージクリア後にだけ出す「つぎへ」。押すまで次のステージへ進まない。
   目立つ場所に置きたいので、盤面のすぐ下・ヒントボタンより上に単独で置く。 */
.next-stage-button {
  display: block;
  width: min(92vw, 260px);
  margin: 10px auto 2px;
  animation: next-stage-pop 0.35s ease;
}

@keyframes next-stage-pop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .next-stage-button { animation: none; }
}

.game-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 「ここでやめる」の2回目待ち。押せば走行が終わるので、
   ふつうのボタンのままにせず、確認中だとひと目で分かる見た目にする。 */
.secondary.confirming {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.secondary.confirming:hover {
  background: #c9403c;
}

/* --- 結果 ---------------------------------------------------------------- */

.result-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(255, 249, 244, 0.95);
}

.result-box {
  width: 100%;
  max-width: 380px;
  background: var(--cream);
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(91, 74, 74, 0.3);
  margin: auto;
}

.result-title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
  color: var(--pink);
}

.result-lines { margin: 8px 0; }

.result-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 14px;
}

.result-line strong { color: var(--pink); }

.result-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 10px;
}

.result-note.bad { color: var(--bad); }

.result-box .ranking-groups {
  margin-top: 14px;
  text-align: left;
}

.result-box .secondary {
  width: 100%;
  margin-top: 8px;
}

/* --- 規約モーダル -------------------------------------------------------- */

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.legal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(91, 74, 74, 0.45);
}

.legal-modal-box {
  position: relative;
  width: min(100%, 640px);
  height: min(84vh, 720px);
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(91, 74, 74, 0.3);
}

.legal-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 34px;
  height: 34px;
  font-size: 15px;
  color: var(--pink);
  background: #ffffff;
  border: 2px solid var(--pink-soft);
  border-radius: 50%;
}

.legal-modal-frame {
  width: 100%;
  height: 100%;
  border: none;
}

/* --- 狭い画面 ------------------------------------------------------------ */

@media (max-width: 420px) {
  .screen {
    padding: 20px 12px 40px;
  }

  .panel {
    padding: 22px 16px 16px;
  }

  h1 {
    font-size: 18px;
  }

  .quokka {
    width: 116px;
  }

  .hud {
    padding-inline: 48px;
  }
}

/* --- 参加画面: シングルクリック設定と練習モード(2026-08-12ユーザー指定) ------- */

.single-tap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 10px 0 2px;
  cursor: pointer;
}

.single-tap-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--pink);
  flex-shrink: 0;
}

.practice-box {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px dashed var(--pink-soft);
}

.practice-box label {
  font-size: 13px;
}

.practice-size-choices {
  margin-top: 6px;
}

.practice-start {
  width: 100%;
  margin-top: 8px;
}
