/* クォッカスロットライフの画面スタイル。
   配色は他のクォッカ作品と揃えたクォッカ路線(やわらかいピンク + クリーム)に、
   スロットの「窓」と入賞ラインを目立たせるための金色を足している。
   参加画面(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;
  --machine-frame: #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;
}

/* 「遊び方を見る」「ぽかぽんの他のゲーム」「シェア」は、押せることが伝わるよう
   同じピルボタンの見た目にしている(文字リンクのままだと伝わりにくいため)。 */
.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;
}

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

.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);
}

/* ゲーム画面のランキングは台と同じ幅で下に置く。 */
.game-ranking-wrap {
  width: min(92vw, 420px);
  margin-top: 14px;
}

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

.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-controls {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.mute-btn {
  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;
}

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

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

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

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

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

/* QuoQuoランプのクォッカは、消灯中は口を閉じて澄ました顔にする
   (2026-08-12ユーザー指定)。点灯すると笑顔(face-glad)になる。 */
.quokka-lamp:not(.lit) .face-normal { display: none; }
.quokka-lamp:not(.lit) .face-calm { display: block; }

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

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

.result-quokka.glad { animation: quokka-glad 0.55s ease; }
.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;
}

/* --- ボーナス中の表示 ------------------------------------------------------ */

/* 残り枚数カウンターは払出と同じ .payout-box を使う(index.html参照)。 */

/* ボーナス中の成立役ナビ。リールの窓全体の枠色で教える(ベル=黄 / スイカ=緑)。 */
.reel-window.navi-bell {
  border-color: #f2b73f;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.85), 0 0 14px rgba(242, 183, 63, 0.9);
}

.reel-window.navi-suika {
  border-color: #4caf6d;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.85), 0 0 14px rgba(76, 175, 109, 0.9);
}

/* --- スロット台 ------------------------------------------------------------ */
/* プロトタイプの筐体の雰囲気(黒枠のリール窓・暗い告知ランプ・縦長のオレンジレバー・
   絵柄ごとの色付きセル)を、シリーズのパステル基調の中に移植している(2026-08-12指定)。 */

.machine {
  width: min(92vw, 440px);
  margin: 0 auto;
  padding: 12px 12px 10px;
  background: #ffffff;
  border: 3px solid var(--pink-soft);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(232, 93, 132, 0.12);
}

.machine-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.machine-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--pink);
}

.bet-note-box {
  text-align: right;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.machine-body {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

/* --- 左側: 告知ランプとレバー ---------------------------------------------- */

.left-controls {
  flex: 0 0 86px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 告知ランプ。プロトタイプと同じ「暗い箱の中でクォッカが光る」形。 */
.lamp-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 4px 8px;
  background: #17130f;
  border: 3px solid #43382c;
  border-radius: 12px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.lamp-title {
  font-size: 9px;
  color: #a89a8a;
}

/* ふだんは暗がりにシルエットだけ。点灯するとオレンジに燃えるように光る。
   縦横比はクォッカSVGのviewBox(90:82)に近づける(潰すと別の動物に見えてしまう)。 */
.quokka-lamp {
  width: 54px;
  height: 50px;
  padding: 4px 6px;
  border: 3px solid #5a4c3c;
  border-radius: 16px;
  background: #2a1706;
  filter: sepia(1) brightness(0.45) saturate(2.2);
  transition: filter 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.quokka-lamp.lit {
  background: radial-gradient(circle, #fffaaa 0%, #ff9c33 65%, #cc5500 100%);
  border-color: #ffcc66;
  filter: none;
  animation: lamp-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes lamp-pulse {
  from { box-shadow: 0 0 10px rgba(255, 150, 40, 0.7); filter: brightness(1); }
  to { box-shadow: 0 0 26px rgba(255, 190, 60, 1); filter: brightness(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .quokka-lamp.lit { animation: none; box-shadow: 0 0 16px rgba(255, 160, 40, 0.9); }
}

/* 払い出し枚数の表示。告知ランプとレバーの間(2026-08-12ユーザー指定)。
   実機のPAYOUT表示風に、暗い箱に金色の数字。 */
.payout-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 8px;
  background: #17130f;
  border: 2px solid #43382c;
  border-radius: 8px;
}

.payout-box-tappable { cursor: pointer; }

.payout-label {
  font-size: 9px;
  color: #a89a8a;
  flex-shrink: 0;
}

.payout-value {
  font-size: 15px;
  font-weight: 800;
  color: #ffcf5e;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px rgba(255, 190, 60, 0.5);
}

/* BIG/REG回数の横に添える確率(1/○)。 */
.payout-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.payout-rate {
  font-size: 9px;
  font-weight: 700;
  color: #c9a35a;
  font-variant-numeric: tabular-nums;
}

/* レバーの下の見えない置物(スベリ表示と同じ高さ)。STOP側はボタンの下に
   スベリ表示があるぶん背が高いので、これでレバーをSTOPと同じ段に揃える。 */
.slide-placeholder {
  visibility: hidden;
}

/* レバーの列。STOP列と同じ構造(.stop-col)を使い、列ごと下端に寄せる。 */
.lever-col {
  margin-top: auto;
}

/* レバー。STOPボタンと同じサイズ・同じ段で、第1リールのSTOPの左に置く
   (2026-08-12ユーザー指定)。色はプロトタイプのオレンジ。 */
.lever-button {
  height: 46px;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(180deg, #f0ad4e 0%, #ec971f 100%);
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(236, 151, 31, 0.45);
  transition: transform 0.08s ease, opacity 0.15s ease, filter 0.1s ease;
}

.lever-button:active {
  transform: translateY(2px);
  filter: brightness(0.9);
}

.lever-button:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

/* ウェイト中(前回レバーONから4.1秒たつまでリールが始動しない、実機の規定)。
   叩いたことは受け付けていて、時間が来たら自動で回り出す。 */
.lever-button.waiting {
  opacity: 0.7;
  animation: lever-wait 0.8s ease-in-out infinite alternate;
}

@keyframes lever-wait {
  from { filter: brightness(0.8); }
  to { filter: brightness(1.05); }
}

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

/* --- 右側: リールの窓とストップボタン -------------------------------------- */

.reel-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* リールの窓。黒い枠と仕切りで、白い帯が縦に流れる(プロトタイプの見た目)。 */
.reel-window {
  cursor: pointer; /* タップ/クリックで次の操作(スペース相当) */
  /* タップ操作対象になったので、タップ時の灰色ハイライトと長押しの選択状態を消す
     (タップするたびに窓が暗くなって見えた。2026-08-12報告)。 */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 7px;
  background: #1b1613;
  border: 4px solid #43382c;
  border-radius: 12px;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

/* 1リールぶんの窓。この中で帯(reel-strip)が縦に動く。
   高さ = セル3つぶん。セルの高さは「列の幅」と同じ(正方形)にしたいが、
   帯は絶対配置で流れるので、窓の側を aspect-ratio 1/3 で正方形×3に固定する。 */
.reel-col {
  position: relative;
  aspect-ratio: 1 / 3;
  overflow: hidden;
  background: #ffffff;
  border-radius: 4px;
}

.reel-strip.spinning { transition: none; }

.reel-strip {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  will-change: transform;
  /* 停止の瞬間のすべりを減速させて止める(時間はすべり距離に応じてui.jsが上書き)。
     わずかに行き過ぎて戻るカーブで、機械がガタンと止まる感じを出す。
     回転中は .spinning でtransitionを切り、毎フレーム直接transformを書く
     (iOS対策。ui.jsのrenderReels参照)。 */
  transition: transform 0.12s cubic-bezier(0.22, 1.28, 0.45, 1);
}

.reel-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  font-size: clamp(26px, 9.5vw, 46px);
  background: #ffffff;
  border-bottom: 1px solid #d8cfc2;
  user-select: none;
}

/* 絵柄ごとのセルの色(プロトタイプ準拠)。BIG=ピンク、REG=クリーム。 */
.reel-cell.sym-W { background: #ffcccc; }
.reel-cell.sym-R { background: #ffdfa6; }

/* 入賞演出のオーバーレイ。帯の上に重ねた動かない3×3グリッド。 */
.flash-overlay {
  position: absolute;
  inset: 7px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  pointer-events: none;
}

.flash-col {
  display: flex;
  flex-direction: column;
}

.flash-cell {
  flex: 1;
}

.flash-cell.win-flash {
  animation: win-flash 1.2s ease;
  border-radius: 6px;
}

@keyframes win-flash {
  0% { box-shadow: none; background: transparent; }
  20% { box-shadow: 0 0 18px rgba(242, 183, 63, 0.95), inset 0 0 0 4px var(--gold); background: rgba(255, 233, 184, 0.45); }
  60% { box-shadow: 0 0 10px rgba(242, 183, 63, 0.7), inset 0 0 0 4px var(--gold); background: rgba(255, 233, 184, 0.3); }
  100% { box-shadow: none; background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .flash-cell.win-flash { animation: none; box-shadow: inset 0 0 0 4px var(--gold); }
}

/* リーチ目出現時のV字フラッシュ。金色で4回点滅する(約1秒)。 */
.flash-cell.reach-vflash {
  animation: reach-vflash 1s steps(1) forwards;
  border-radius: 6px;
}

@keyframes reach-vflash {
  0%, 25%, 50%, 75% { background: rgba(255, 207, 94, 0.75); box-shadow: 0 0 16px rgba(255, 190, 60, 0.9); }
  12.5%, 37.5%, 62.5%, 87.5%, 100% { background: transparent; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .flash-cell.reach-vflash { animation: none; background: rgba(255, 207, 94, 0.6); }
}

/* ストップボタン。各リールの真下に同じ幅で置く(どのボタンがどのリールか
   ひと目で分かるように)。色はプロトタイプの赤。 */
.stop-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 0 7px;
}

.stop-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* 何コマすべって止まったかの表示(プロトタイプ準拠)。 */
.slide-display {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  color: #a9781a;
  background: #fff7e8;
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  padding: 1px 0;
  font-variant-numeric: tabular-nums;
}

.stop-button {
  height: 46px;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(180deg, #d9534f 0%, #a94442 100%);
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(217, 83, 79, 0.35);
  transition: transform 0.05s ease, opacity 0.15s ease, filter 0.1s ease;
}

.stop-button:active {
  transform: translateY(2px);
  filter: brightness(0.85);
}

.stop-button:disabled {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}



.key-guide {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
}

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

/* 【1行しか出ない】長い文は ellipsis で切られる。高さを固定しているのは、
   トーストが出たり消えたりするたびに下のボタンが動くのを防ぐため。
   入る幅は狭い画面(320px)で約262px。日本語なら20文字前後が上限なので、
   flashHud に渡す文はそれより短くすること。 */
.toast {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  margin: 8px 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;
}

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

.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;
  }

  .hud {
    padding-inline: 48px;
  }

  .left-controls {
    flex-basis: 76px;
  }

  .lever-button {
    font-size: 12px;
  }
}
