/**
 * bonbon-drop.css
 * BONBON DROP ゲーム専用スタイル
 * すべてのセレクターは .bonbon-game スコープに限定する
 */

/* ゲームルートコンテナ */
.bonbon-game {
  --bb-bg: #d8c8f5;
  --bb-accent: #9966dd;
  --bb-accent2: #7755bb;
  --bb-blue: #28b6ff;
  --bb-blue-edge: #1688df;
  --bb-text: #5a3a8a;
  --bb-dim: #c8b8e8;
  --bb-title-side-button-h: 52px;
  --bb-record-score-size: var(--wk-record-score, 28px);
  --bb-record-meta-size: var(--wk-record-body, 16px);
  --bb-record-score-font: var(--wk-record-font);
  --bb-record-meta-font: var(--wk-record-font);

  position: relative;
  width: 100%;
  max-width: 749px;
  margin-left: auto;
  margin-right: auto;
  margin-top: -16px;
  height: min(936px, calc(100vh - 60px));
  min-height: 610px;
  background: var(--bb-bg);
  background-image: radial-gradient(
    circle,
    rgba(160, 120, 220, 0.25) 2px,
    transparent 2px
  );
  background-size: 26px 26px;
  overflow: hidden;
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-weight: 800;
  color: var(--bb-text);
  box-sizing: border-box;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  border-radius: 18px;
}

.bonbon-game::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 25%,
    rgba(255, 255, 255, 0.45) 0%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
}

.bonbon-game .game-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 173px;
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "play side";
  gap: 10px 14px;
  align-items: stretch;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 8px 10px;
  box-sizing: border-box;
}

.bonbon-game .canvas-col {
  position: relative;
  grid-area: play;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
.bonbon-game .top-btns {
  display: contents;
}
.bonbon-game .top-btns .reset-btn {
  --bb-tool-color: var(--bb-blue);
  --bb-tool-label: #fff;
  --bb-tool-edge: var(--bb-blue-edge);
  flex: 0 0 auto;
  min-width: 0;
  min-height: 44px;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .top-btns,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .next-box,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bon-action,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .play-bgm-btn,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .stats-group {
  display: none !important;
  pointer-events: none;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .game-wrapper {
  grid-template-columns: minmax(0, 1fr) 100px;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .side {
  --bb-side-box-flex: 0 0 auto;
  display: flex;
  flex-flow: column nowrap;
  align-self: center;
  justify-content: center;
  gap: 16px;
  padding-top: 0;
  align-items: center;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .canvas-col {
  gap: 0;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
}

.bonbon-game.is-title-screen #start-scr {
  inset: 0;
  min-height: 100%;
}

.bonbon-game .title-side-actions {
  display: none;
}

.bonbon-game .history-open-btn {
  display: none;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .history-open-btn {
  display: flex;
  order: 3;
  --bb-tool-color: #27ce85;
  --bb-tool-label: #fff;
  --bb-tool-edge: #16a363;
  --bb-tool-icon: "▤";
}
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-actions {
  display: contents;
}

.bonbon-game .title-side-btn {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 1;
  flex: var(--bb-side-box-flex);
  padding: 6px 8px 8px;
  cursor: pointer;
  color: var(--bb-text);
  transition:
    transform 0.16s,
    background 0.16s,
    box-shadow 0.16s;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .history-open-btn,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn,
.bonbon-game .bon-action.box,
.bonbon-game .top-btns .reset-btn.box,
.bonbon-game .stats-group .stat-box.box,
.bonbon-game .play-bgm-btn.box,
.bonbon-game:not(.is-title-screen):not(.is-gameover-screen) .bgm-toggle-btn.box {
  text-shadow: 0 1px 1px #44305ecc, 0 0 2px #44305e99;
  min-height: 0;
  height: auto;
  box-sizing: border-box;
  padding: 6px 8px 8px;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn {
  position: relative;
  top: auto;
  right: auto;
  z-index: 12;
  width: 100%;
  order: 1;
  flex: var(--bb-side-box-flex);
  aspect-ratio: 1;
  min-height: 0;
  height: auto;
  box-sizing: border-box;
  padding: 6px 4px;
  display: flex;
  pointer-events: auto;
  --bb-tool-color: #ff54b4;
  --bb-tool-label: #fff;
  --bb-tool-edge: #e52e93;
  --bb-tool-icon: "♫";
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .lbl {
  font-size: var(--wk-font-control, 16px);
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .val {
  font-size: 18px;
  line-height: 1;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) #ranking-btn {
  order: 2;
  --bb-tool-color: var(--bb-blue);
  --bb-tool-label: #fff;
  --bb-tool-edge: var(--bb-blue-edge);
  --bb-tool-icon: "★";
}
.bonbon-game:is(.is-title-screen, .is-gameover-screen) #rules-btn {
  order: 4;
  --bb-tool-color: #ffb641;
  --bb-tool-label: #fff;
  --bb-tool-edge: #ef8b23;
  --bb-tool-icon: "?";
}
.bonbon-game:is(.is-title-screen, .is-gameover-screen) #controls-btn {
  order: 5;
  --bb-tool-color: #b17aff;
  --bb-tool-label: #fff;
  --bb-tool-edge: #8a53de;
  --bb-tool-icon: "✥";
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .history-open-btn,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn {
  border-color: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--bb-tool-gap, 5px);
  border-radius: 20px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 -2px 0 rgba(59, 199, 192, 0.18) inset,
    2px 0 0 rgba(255, 255, 255, 0.3) inset,
    -1px 0 0 rgba(126, 72, 200, 0.07) inset,
    0 4px 0 var(--bb-tool-edge, rgba(116, 74, 190, 0.07)),
    0 10px 24px rgba(124, 82, 205, 0.1),
    0 0 24px rgba(255, 255, 255, 0.28) inset;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn::before,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn::before {
  content: var(--bb-tool-icon);
  font: 800 28px/1 sans-serif;
  color: #fff;
  text-shadow: 0 2px 0 var(--bb-tool-edge);
  z-index: 1;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn::after,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .history-open-btn::after,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn::after,
.bonbon-game .bon-action.box::after,
.bonbon-game .top-btns .reset-btn.box::after,
.bonbon-game .stats-group .stat-box.box::after,
.bonbon-game .play-bgm-btn.box::after,
.bonbon-game:not(.is-title-screen):not(.is-gameover-screen) .bgm-toggle-btn.box::after {
  top: 5px;
  left: 8px;
  right: 8px;
  height: 38%;
  border-radius: 14px 14px 54% 54%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.48),
    rgba(255, 255, 255, 0.09) 70%,
    transparent
  );
}

.bonbon-game .title-side-btn .lbl {
  margin: 0;
  font-size: var(--wk-font-control, 16px);
  letter-spacing: 0.02em;
  color: var(--bb-tool-label, var(--bb-accent2));
  white-space: nowrap;
}

.bonbon-game .title-side-btn:hover {
  transform: translateY(-1px);
}
.bonbon-game .title-side-btn:active,
.bonbon-game:is(.is-title-screen, .is-gameover-screen)
  .history-open-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 var(--bb-tool-edge, #a088d8),
    inset 0 1px 0 #ffffff70;
}

/* キャンバス領域 */
.bonbon-game .canvas-wrap {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  width: var(--bb-board-width, 100%);
  height: var(--bb-board-height, 100%);
  box-sizing: border-box;
  min-height: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.18),
    0 4px 20px rgba(100, 70, 180, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  overflow: hidden;
  background: #a088d8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bonbon-game #gc {
  display: block;
  touch-action: none;
  image-rendering: pixelated;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  flex: 0 0 auto;
}

.bonbon-game .side {
  --bb-preview-size: clamp(48px, calc(100vh - 626px), 144px);
  grid-area: side;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--bb-side-rows, auto auto repeat(3, minmax(52px, 1fr)) repeat(4, minmax(44px, 1fr)));
  gap: 4px;
  height: auto;
}
.bonbon-game
  .side
  .box:not(.bgm-toggle-btn):not(.history-open-btn):not(.bon-action):not([hidden]) {
  flex: var(--bb-side-box-flex, 1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.bonbon-game .box {
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 8px 8px;
  position: relative;
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 -2px 0 rgba(120, 80, 200, 0.18) inset,
    2px 0 0 rgba(255, 255, 255, 0.25) inset,
    -1px 0 0 rgba(120, 80, 200, 0.1) inset,
    0 4px 0 rgba(100, 60, 180, 0.22),
    0 6px 18px rgba(120, 80, 200, 0.12);
  text-align: center;
  box-sizing: border-box;
  overflow: hidden;
}
.bonbon-game .box > * {
  position: relative;
  z-index: 1;
}
.bonbon-game .box:not(.next-box)::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 6px;
  right: 6px;
  height: 40%;
  border-radius: 12px 12px 50% 50%;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
  z-index: 0;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn.box,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .history-open-btn.box,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn.box,
.bonbon-game .bon-action.box,
.bonbon-game .top-btns .reset-btn.box,
.bonbon-game .stats-group .stat-box.box,
.bonbon-game .play-bgm-btn.box,
.bonbon-game:not(.is-title-screen):not(.is-gameover-screen) .bgm-toggle-btn.box {
  background:
    radial-gradient(
      circle at 18% 16%,
      rgba(255, 255, 255, 0.95) 0 1.6px,
      transparent 3px
    ),
    radial-gradient(
      circle at 78% 24%,
      rgba(255, 255, 255, 0.72) 0 1.1px,
      transparent 2.4px
    ),
    radial-gradient(
      circle at 62% 80%,
      rgba(255, 255, 255, 0.68) 0 1.1px,
      transparent 2.5px
    ),
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.18),
      rgba(255, 255, 255, 0.05) 46%,
      rgba(66, 224, 205, 0.14) 100%
    ),
    var(--bb-tool-color, transparent);
}

.bonbon-game .preview-slot canvas {
  width: min(100%, var(--bb-preview-size));
  height: auto;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: block;
  image-rendering: pixelated;
  margin: 0 auto;
  background: transparent;
  border-radius: 10px;
}
.bonbon-game .next-box {
  --bb-side-box-flex: 0 0 auto;
  gap: 6px;
  padding-top: 6px;
  margin: 0;
  background: linear-gradient(180deg, #b8a0e8, #a088d8 50%, #9078c8);
}
.bonbon-game .next-box .lbl {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin: 0 0 2px;
  color: #fff;
  text-shadow: 0 2px 0 #7755bb;
}
.bonbon-game .next-previews {
  display: grid;
  gap: 6px;
  width: 100%;
}
.bonbon-game .preview-slot {
  position: relative;
  width: min(100%, var(--bb-preview-size));
  justify-self: center;
}

.bonbon-game .bon-action {
  --bb-tool-color: #27ce85;
  --bb-tool-label: #fff;
  --bb-tool-edge: #16a363;
  appearance: none;
  width: 100%;
  margin-block: 4px;
  justify-self: center;
  min-height: 0;
  height: auto;
  aspect-ratio: 1;
  align-self: start;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  font:
    800 24px/1 "Baloo 2",
    "Yu Gothic",
    sans-serif;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  color: #fff;
  transition:
    transform 0.15s,
    background 0.15s;
}
.bonbon-game .bon-action .lbl {
  margin: 0;
  color: inherit;
  font-size: 24px;
}
.bonbon-game .bon-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  fill: #ffffff99;
  stroke: #ffffffbb;
  stroke-width: 1.3px;
  color: #ffffffcc;
  filter: drop-shadow(0 2px 1px #13815d55);
}
.bonbon-game .bon-action:not(:disabled):hover {
  filter: brightness(1.08);
}
.bonbon-game .bon-action:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: none;
}
.bonbon-game .bon-action:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}
.bonbon-game .bon-action:disabled {
  cursor: default;
  opacity: 0.65;
}
.bonbon-game .stats-group {
  display: contents;
}
.bonbon-game .stats-group .stat-box {
  --bb-tool-color: var(--wk-button-play);
  --bb-tool-label: #fff;
  --bb-tool-edge: var(--wk-button-play-edge);
  --bb-tool-gap: 0px;
  min-width: 0;
  padding: 1px 2px;
}
.bonbon-game .stats-group .lbl {
  font-size: 16px;
  line-height: 1;
  margin-bottom: 0;
  letter-spacing: 0.02em;
}
.bonbon-game .stats-group .val {
  color: var(--bb-tool-label);
  font-size: max(var(--wk-font-min, 14px), var(--bb-number-fit, 28px));
  word-break: normal;
  white-space: nowrap;
}

.bonbon-game #flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.72),
    rgba(255, 210, 255, 0.3) 38%,
    rgba(165, 230, 255, 0.18) 62%,
    transparent 72%
  );
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.05s;
  border-radius: 14px;
}
.bonbon-game #flash.show {
  opacity: 1;
}
.bonbon-game #flash[data-power="2"].show {
  opacity: 0.82;
}
.bonbon-game #flash[data-power="3"].show {
  opacity: 0.92;
}
.bonbon-game #flash[data-power="4"].show {
  opacity: 1;
}

.bonbon-game .bb-line-burst {
  position: absolute;
  pointer-events: none;
  z-index: 7;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.92),
    rgba(255, 204, 255, 0.7),
    rgba(150, 235, 255, 0.64),
    transparent
  );
  box-shadow:
    0 0 14px rgba(255, 255, 255, 0.75),
    0 0 28px rgba(205, 145, 255, 0.65),
    0 0 48px rgba(120, 220, 255, 0.35);
  animation: bb-line-burst 0.82s ease-out both;
}
.bonbon-game .bb-line-burst::before,
.bonbon-game .bb-line-burst::after {
  content: "";
  position: absolute;
  inset: -25% -20%;
  background: repeating-linear-gradient(
    115deg,
    transparent 0 13px,
    rgba(255, 255, 255, 0.75) 14px 16px,
    transparent 17px 31px
  );
  transform: translateX(-100%);
  animation: bb-line-sweep 0.7s ease-out both;
}
.bonbon-game .bb-line-burst::after {
  animation-delay: 0.11s;
  opacity: 0.55;
}
.bonbon-game .bb-line-burst--2 {
  box-shadow:
    0 0 16px rgba(255, 255, 255, 0.82),
    0 0 36px rgba(205, 145, 255, 0.68);
}
.bonbon-game .bb-line-burst--3 {
  box-shadow:
    0 0 20px rgba(255, 255, 255, 0.9),
    0 0 44px rgba(255, 130, 220, 0.74);
}
.bonbon-game .bb-line-burst--4 {
  box-shadow:
    0 0 24px rgba(255, 255, 255, 0.96),
    0 0 54px rgba(120, 230, 255, 0.68);
}

.bonbon-game .bb-sparkle-particle {
  background: var(--sparkle-color, #fff);
  clip-path: polygon(
    50% 0%,
    61% 36%,
    100% 50%,
    61% 64%,
    50% 100%,
    39% 64%,
    0% 50%,
    39% 36%
  );
  box-shadow: 0 0 7px var(--sparkle-color, #fff);
}
.bonbon-game .bb-sparkle-particle--3,
.bonbon-game .bb-sparkle-particle--4,
.bonbon-game .bb-sparkle-particle--bon {
  box-shadow: 0 0 10px var(--sparkle-color, #fff);
}

.bonbon-game .bb-bon-ring {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  box-shadow:
    0 0 0 3px rgba(255, 130, 225, 0.55),
    0 0 18px rgba(255, 255, 255, 0.98),
    0 0 36px rgba(255, 110, 220, 0.85),
    0 0 54px rgba(120, 230, 255, 0.65);
  animation: bb-bon-ring 0.95s ease-out both;
}
.bonbon-game .bb-bon-word {
  position: absolute;
  pointer-events: none;
  z-index: 12;
  transform: translate(-50%, -50%) scale(0.62);
  opacity: 0;
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(22px, 7vw, 56px);
  color: #fff;
  letter-spacing: 0.1em;
  text-shadow:
    0 4px 0 rgba(115, 60, 190, 0.65),
    0 0 12px rgba(255, 255, 255, 1),
    0 0 28px rgba(255, 120, 220, 0.9),
    0 0 52px rgba(120, 230, 255, 0.75);
  animation: bb-bon-word 0.5s ease-out both;
}

.bonbon-game .bb-bon-target-highlight {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  border-radius: 12px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.82) 0 18%,
    var(--bb-target-light, #fff) 19% 42%,
    transparent 70%
  );
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.86),
    0 0 14px var(--bb-target-light, #fff),
    0 0 30px var(--bb-target-base, #ff8ed6);
  opacity: 0;
  animation: bb-bon-target-highlight 0.58s ease-out both;
}

.bonbon-game .bb-bon-cell-burst {
  position: absolute;
  pointer-events: none;
  z-index: 11;
  transform: translate(-50%, -50%) scale(0.45);
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.98) 0 18%,
    rgba(255, 240, 120, 0.92) 19% 34%,
    rgba(255, 100, 210, 0.55) 35% 54%,
    rgba(120, 230, 255, 0.32) 55% 70%,
    transparent 72%
  );
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.95),
    0 0 24px rgba(255, 110, 220, 0.78),
    0 0 42px rgba(120, 230, 255, 0.62);
  animation: bb-bon-cell-burst 0.92s ease-out both;
}

.bonbon-game .bb-bon-cell-burst::before,
.bonbon-game .bb-bon-cell-burst::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16%;
  height: 118%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.88);
  transform: translate(-50%, -50%) rotate(45deg);
}

.bonbon-game .bb-bon-cell-burst::after {
  transform: translate(-50%, -50%) rotate(-45deg);
  opacity: 0.78;
}

.bonbon-game .bb-bon-cell-burst--3,
.bonbon-game .bb-bon-cell-burst--4 {
  box-shadow:
    0 0 14px rgba(255, 255, 255, 1),
    0 0 34px rgba(255, 96, 220, 0.92),
    0 0 60px rgba(118, 235, 255, 0.78);
}

@keyframes bb-line-burst {
  0% {
    opacity: 0;
    transform: scaleX(0.08);
  }
  16% {
    opacity: 1;
    transform: scaleX(1.04);
  }
  55% {
    opacity: 0.9;
    transform: scaleX(1);
  }
  100% {
    opacity: 0;
    transform: scaleX(1.02) scaleY(2.4);
  }
}
@keyframes bb-line-sweep {
  0% {
    transform: translateX(-105%);
  }
  100% {
    transform: translateX(105%);
  }
}
@keyframes bb-bon-ring {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }
  18% {
    opacity: 1;
    transform: scale(1.12);
  }
  62% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}
@keyframes bb-bon-word {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -80%) scale(1);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, -80%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -100%) scale(0.98);
  }
}
@keyframes bb-bon-target-highlight {
  0% {
    opacity: 0;
    transform: scale(0.62);
  }
  28% {
    opacity: 1;
    transform: scale(1.16);
  }
  58% {
    opacity: 0.94;
    transform: scale(0.94);
  }
  100% {
    opacity: 0;
    transform: scale(1.34);
  }
}
@keyframes bb-bon-cell-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.28) rotate(0deg);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05) rotate(14deg);
  }
  55% {
    opacity: 0.88;
    transform: translate(-50%, -50%) scale(1.22) rotate(34deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.72) rotate(70deg);
  }
}

.bonbon-game .chain-pop {
  position: absolute;
  left: 50%;
  top: calc(var(--bb-board-height, 100%) * 0.42);
  z-index: 14;
  width: max-content;
  max-width: calc(100% - 16px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-size: max(var(--wk-font-min, 14px), var(--status-pop-size, clamp(32px, 9vw, 64px)));
  line-height: 1.12;
  color: #fff;
  letter-spacing: 0.08em;
  white-space: pre;
  text-align: center;
  text-shadow:
    0 3px 0 #68469d,
    0 0 6px rgba(80, 44, 132, 0.8),
    0 10px 24px rgba(255, 90, 180, 0.35);
}
.bonbon-game .chain-pop.show {
  opacity: 1;
  animation: bb-chain-pop 0.08s ease-out;
}
.bonbon-game .status-pop-detail {
  display: block;
  margin-top: 0.25em;
  font-size: max(var(--wk-font-min, 14px), max(14px, 0.5em));
  line-height: 1.1;
  letter-spacing: 0.08em;
  color: #fff3b0;
}

@keyframes bb-chain-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* オーバーレイ（スタート・ゲームオーバー） */
.bonbon-game .overlay {
  --bb-title-art-x: max(48px, 22%);
  --bb-title-art-y: max(76px, 11.5%);
  --bb-title-art-shift: 14px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  background: rgba(253, 232, 248, 0.93);
  z-index: 10;
  backdrop-filter: blur(4px);
  border-radius: 14px;
  scrollbar-gutter: stable;
  overflow: hidden;
  box-sizing: border-box;
  gap: 16px;
}

.bonbon-game #start-scr {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  justify-content: stretch;
  align-content: center;
  align-items: center;
  justify-items: center;
  row-gap: 24px;
  padding: 20px 26px;
  overflow-y: auto;
  touch-action: pan-y;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.2) 0 10px,
      transparent 10px 22px
    ),
    rgba(253, 232, 248, 0.94);
  background-size:
    44px 44px,
    auto;
}

.bonbon-game .title-brand {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  position: static;
  width: min(480px, 100%);
  padding-top: 164px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.bonbon-game #start-scr #title-canvas {
  margin: 0 auto;
  transform: rotate(-2deg);
}
.bonbon-game .title-mascot,
.bonbon-game .title-apple {
  position: absolute;
  width: var(--bb-title-art-size);
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  z-index: 2;
}
.bonbon-game .title-mascot {
  --bb-title-art-size: 132px;
  left: calc(var(--bb-title-art-x) - var(--bb-title-art-size) / 2);
  top: calc(var(--bb-title-art-y) + var(--bb-title-art-shift) - var(--bb-title-art-size) / 2);
}
.bonbon-game .title-start {
  grid-column: 1;
  grid-row: 3;
  justify-self: center;
  position: static;
  width: min(360px, 86%);
  margin: 2px 0 4px;
  padding-bottom: 116px;
}
.bonbon-game .title-apple {
  --bb-title-art-size: 112px;
  right: calc(var(--bb-title-art-x) - var(--bb-title-art-size) / 2);
  bottom: calc(var(--bb-title-art-y) - var(--bb-title-art-shift) - var(--bb-title-art-size) / 2);
}

.bonbon-game #title-canvas {
  display: block;
  margin: 0 auto;
  max-width: 96%;
  max-height: 210px;
  width: var(--bb-title-logo-width, min(100%, 480px)) !important;
  height: auto !important;
  object-fit: contain;
}

.bonbon-game #go-scr {
  overflow-y: auto;
  touch-action: pan-y;
}
.bonbon-game .go-title {
  display: block;
  width: min(92%, 420px);
  max-width: 92%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  transform: rotate(-2deg);
  flex-shrink: 0;
}
.bonbon-game .go-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 4px 0;
}
.bonbon-game .go-label {
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 0.1em;
  color: #ffffff;
  -webkit-text-stroke: 1.7px #7440bd;
  text-shadow:
    0 3px 0 #5d2ea2,
    0 6px 0 rgba(74, 34, 136, 0.3),
    0 0 12px rgba(255, 255, 255, 0.82);
  transform: rotate(-3deg);
}
.bonbon-game .go-score {
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-size: 60px;
  font-weight: 400;
  color: var(--bb-accent);
  text-shadow: 0 4px 0 rgba(255, 120, 180, 0.4);
  line-height: 1;
}
.bonbon-game .go-save-status {
  width: min(420px, 90%);
  margin: 0;
  color: #583487;
  font-family: "Zen Maru Gothic", "Yu Gothic", sans-serif;
  font-size: max(var(--wk-font-min, 14px), clamp(12px, 2.4vw, 16px));
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
  flex-shrink: 0;
}
.bonbon-game .go-save-status[data-state="failed"] {
  color: #a32953;
}
/* CODEの表示スタイル（ゲームオーバー画面） */
.bonbon-game .go-code {
  font-family: "Courier New", "Consolas", monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--bb-accent2);
  background: rgba(153, 102, 221, 0.12);
  border: 2px dashed rgba(153, 102, 221, 0.4);
  border-radius: 10px;
  padding: 10px 22px;
  text-shadow: none;
  text-align: center;
  line-height: 1.9;
  white-space: pre;
  margin: 0 auto;
}
/* TSの表示スタイル（確認ツール用、小さく目立たなく） */
.bonbon-game .go-ts {
  font-family: "Courier New", "Consolas", monospace;
  font-size: var(--wk-font-meta, 14px);
  color: rgba(153, 102, 221, 0.5);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.05em;
}
/* CODEの表示スタイル（サイドバー） */
.bonbon-game .side-code {
  font-family: "Courier New", "Consolas", monospace;
  font-size: var(--wk-font-meta, 14px);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--bb-accent2);
  word-break: break-all;
  text-align: center;
  line-height: 1.4;
}

/* Function colors are shared; highlights and silhouettes remain BONBON's. */
.bonbon-game #retry-btn { --bb-btn-color: var(--wk-button-play); --bb-btn-edge: var(--wk-button-play-edge); }
.bonbon-game #go-title-btn { --bb-btn-color: var(--bb-blue); --bb-btn-edge: var(--bb-blue-edge); }
.bonbon-game #ranking-bottom-close {
  --bb-btn-color: var(--bb-blue);
  --bb-btn-edge: var(--bb-blue-edge);
  min-height: 44px;
  padding: 8px 32px;
  margin-top: 0;
}
.bonbon-game #history-bottom-close {
  --bb-btn-color: #27ce85;
  --bb-btn-edge: #16a363;
}
.bonbon-game #controls-bottom-close {
  --bb-btn-color: #ac75ec;
  --bb-btn-edge: #8051c8;
}
/* ボタン共通スタイル */
.bonbon-game .btn {
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-size: 20px;
  padding: 13px 43px;
  background:
    radial-gradient(circle at 18% 16%, #fffffff2 0 1.6px, transparent 3px),
    radial-gradient(circle at 78% 24%, #ffffffb8 0 1.1px, transparent 2.4px),
    radial-gradient(circle at 62% 80%, #ffffffad 0 1.1px, transparent 2.5px),
    linear-gradient(135deg, #ffffff2e, #ffffff0d 46%, #42e0cd24 100%),
    var(--bb-btn-color, #ac75ec);
  border: 3px solid rgba(255, 255, 255, 0.72);
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.1em;
  border-radius: 20px;
  box-shadow:
    inset 0 1px 0 #ffffffe0,
    inset 0 -2px 0 #3bc7c02e,
    inset 2px 0 0 #ffffff4d,
    inset -1px 0 0 #7e48c812,
    0 4px 0 var(--bb-btn-edge, #7e4bbd),
    0 10px 24px #7c52cd1a,
    inset 0 0 24px #ffffff47;
  transition:
    transform 0.16s,
    box-shadow 0.16s;
  animation: bb-pulsebtn 1.6s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(80, 30, 150, 0.62);
  outline: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.bonbon-game .btn::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 8px;
  right: 8px;
  height: 38%;
  border-radius: 14px 14px 54% 54%;
  background: linear-gradient(180deg, #ffffff7a, #ffffff17 70%, transparent);
  pointer-events: none;
}
.bonbon-game .btn span {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  text-align: center;
  white-space: nowrap;
}
.bonbon-game .btn:hover,
.bonbon-game .btn:active {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.bonbon-game .btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 #ffffff90,
    0 2px 0 var(--bb-btn-edge, #7e4bbd);
}
.bonbon-game .btn:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
  box-shadow:
    0 0 0 7px var(--bb-btn-color, #b478ff),
    0 5px 0 var(--bb-btn-edge, #7e4bbd);
}
.bonbon-game .btn:disabled {
  --bb-btn-color: var(--wk-button-disabled);
  --bb-btn-edge: var(--wk-button-neutral-edge);
  color: var(--wk-button-disabled-ink);
  text-shadow: none;
  cursor: default;
  animation: none;
}
/* ボタンパルスアニメーション */
@keyframes bb-pulsebtn {
  0%,
  100% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.64),
      inset 0 -2px 0 rgba(95, 49, 164, 0.18),
      0 5px 0 rgba(100, 50, 180, 0.28),
      0 9px 18px rgba(140, 80, 220, 0.2);
  }
  50% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.72),
      inset 0 -2px 0 rgba(95, 49, 164, 0.18),
      0 5px 0 rgba(100, 50, 180, 0.3),
      0 12px 30px rgba(140, 80, 220, 0.36);
    transform: translateY(-1px);
  }
}

.bonbon-game .setting-cycle-btn {
  --bb-btn-color: #28b6ff;
  --bb-btn-edge: #1688df;
  position: relative;
  display: flex;
  width: min(100%, 160px);
  justify-content: center;
  font-size: var(--wk-font-control, 18px);
  min-height: 48px;
  padding: 12px 15px;
  animation: none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.78),
    inset 0 -3px 0 #1688df44,
    0 4px 0 #1688df,
    0 0 0 2px #1688df;
  transform: translateY(0);
  border-color: #fff;
  color: #fff;
}

.bonbon-game .select-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 18px;
  border: 2px solid #8ad8ff;
  border-radius: 22px;
  background: #fff9fdcf;
  box-shadow:
    0 5px 0 #7cccf060,
    inset 0 2px 0 #fff;
}

.bonbon-game .title-options {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: min(416px, 100%);
  min-width: 0;
}
.bonbon-game .title-options.is-event {
  grid-template-columns: minmax(0, 1fr);
  width: min(208px, 100%);
}
.bonbon-game.is-relax {
  --bb-side-rows: auto auto repeat(4, minmax(44px, 1fr));
}
.bonbon-game.is-relax [data-record-only],
.bonbon-game:not(.is-relax) [data-relax-only] {
  display: none;
}

.bonbon-game .select-title {
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-size: 21px;
  font-weight: 400;
  color: #1688df;
  letter-spacing: 0.03em;
  line-height: 1.3;
  text-shadow: 0 2px 0 #fff;
}
.bonbon-game [data-bonbon-start-status] {
  grid-column: 1;
  grid-row: 4;
  width: 100%;
  max-width: 420px;
  margin: 8px 0 0;
  color: var(--bb-text);
  font-size: var(--wk-font-body, 16px);
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}
.bonbon-game #start-btn {
  --bb-btn-color: var(--wk-button-play);
  --bb-btn-edge: var(--wk-button-play-edge);
  width: 100%;
  justify-content: center;
  min-height: 64px;
  font-size: 28px;
  padding: 15px 0;
  margin: 0;
  animation: none;
}

.bonbon-game .setting-cycle-btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 #ffffff90,
    0 1px 0 #1688df,
    0 0 0 2px #1688df;
}

.bonbon-game .ranking-open-btn {
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: var(--wk-font-control, 18px);
  padding: 12px 0;
  line-height: 1;
  animation: none;
  justify-self: center;
}

.bonbon-game .rules-open-btn {
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: var(--wk-font-control, 18px);
  padding: 12px 0;
  line-height: 1;
  animation: none;
}

.bonbon-game .controls-open-btn {
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: var(--wk-font-control, 18px);
  padding: 12px 0;
  line-height: 1;
  animation: none;
}

.bonbon-game .go-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  width: min(420px, 84%);
}
.bonbon-game .go-actions .btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 18px;
  animation: none;
}

.bonbon-game .ranking-overlay,
.bonbon-game .rules-overlay,
.bonbon-game .controls-overlay,
.bonbon-game .history-overlay,
.bonbon-game .title-confirm-overlay {
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(58, 29, 96, 0.28);
  backdrop-filter: blur(5px);
}

.bonbon-game .ranking-overlay,
.bonbon-game .history-overlay {
  position: fixed;
  height: 100dvh;
  border-radius: 0;
  overscroll-behavior: contain;
}

.bonbon-game .rules-overlay,
.bonbon-game .controls-overlay,
.bonbon-game .title-confirm-overlay {
  position: absolute;
  border-radius: 14px;
}

.bonbon-game .title-confirm-overlay {
  background: rgba(32, 18, 54, 0.42);
}

.bonbon-game .title-confirm-panel {
  width: min(360px, 92%);
  padding: 24px 22px 22px;
  box-sizing: border-box;
  border: 3px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 248, 255, 0.98),
    rgba(232, 213, 255, 0.98)
  );
  box-shadow:
    0 7px 0 rgba(108, 65, 170, 0.42),
    0 18px 38px rgba(40, 16, 82, 0.32),
    inset 0 2px 0 rgba(255, 255, 255, 0.78);
  color: #503278;
  text-align: center;
}

.bonbon-game .title-confirm-title {
  max-width: 100%;
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0.04em;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.82);
}

.bonbon-game .title-confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.bonbon-game .title-confirm-actions .btn {
  --bb-btn-color: var(--bb-blue);
  --bb-btn-edge: var(--bb-blue-edge);
  min-width: 0;
  justify-content: center;
  padding: 12px 10px;
  font-size: var(--wk-font-control, 18px);
  letter-spacing: 0.06em;
  animation: none;
  white-space: nowrap;
}

.bonbon-game .title-confirm-cancel {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    0 4px 0 var(--bb-blue-edge),
    0 8px 18px rgba(55, 40, 90, 0.16);
  color: #fff;
  text-shadow: none;
}

.bonbon-game .title-confirm-ok {
  color: #fff;
  text-shadow: none;
}

.bonbon-game .ranking-panel,
.bonbon-game .rules-panel,
.bonbon-game .history-panel {
  width: min(var(--bb-record-panel-width, 470px), 94%);
  max-height: var(--bb-panel-max-height, 92%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--bb-panel-gap, 10px);
  padding: var(--bb-panel-padding, 18px);
  box-sizing: border-box;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    var(--bb-record-surface-top, rgba(255, 242, 255, 0.98)),
    var(--bb-record-surface-bottom, rgba(230, 209, 255, 0.98))
  );
  box-shadow:
    0 8px 0 var(--bb-record-shadow-edge, rgba(116, 77, 178, 0.42)),
    0 18px 36px var(--bb-record-shadow, rgba(68, 28, 128, 0.28));
  color: var(--bb-record-ink, #5f438d);
  font-family: var(--wk-record-font);
  font-weight: 700;
  line-height: 1.5;
}

.bonbon-game .ranking-panel,
.bonbon-game .history-panel {
  --bb-record-panel-width: 520px;
}

.bonbon-game .history-panel {
  --bb-panel-gap: 14px;
  --bb-panel-padding: 20px;
  --bb-record-surface-top: #effff8;
  --bb-record-surface-bottom: #c7f3df;
  --bb-record-shadow-edge: #43ab8270;
  --bb-record-shadow: #236d4e38;
  --bb-record-ink: #307b60;
  --bb-accent: #159567;
  --bb-accent2: #25815e;
  --bb-text: #39785f;
}

.bonbon-game .ranking-panel {
  --bb-record-header-padding: 0 4px;
  --bb-panel-max-height: 96%;
  --bb-panel-gap: 6px;
  --bb-panel-padding: 12px;
}

.bonbon-game .rules-panel {
  overflow-y: auto;
  touch-action: pan-y;
}
.bonbon-game .rules-panel > * {
  flex-shrink: 0;
}

.bonbon-game .history-content {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-gutter: stable;
}

.bonbon-game .history-section {
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    0 4px 10px rgba(45, 131, 91, 0.14);
  padding: 12px 14px;
}

.bonbon-game .history-section-title {
  font-family: var(--wk-record-font);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--bb-accent2);
  text-align: center;
  line-height: 1;
  margin-bottom: 8px;
}

.bonbon-game .history-best-score {
  font-family: var(--wk-record-font);
  font-size: var(--wk-record-best, 36px);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  color: var(--bb-accent);
  text-shadow: 0 3px 0 rgba(104, 207, 158, 0.3);
}

.bonbon-game .history-best-date {
  display: block;
  margin-top: 6px;
  font: 700 var(--wk-record-date, 16px)/1.5 var(--wk-record-font);
  color: var(--bb-text);
  text-align: center;
  white-space: nowrap;
}

.bonbon-game .history-best-code {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--bb-record-ink);
  font-family: var(--wk-record-font);
  font-size: var(--bb-record-meta-size);
  line-height: 1.4;
  text-align: center;
}

.bonbon-game .history-best-meta,
.bonbon-game .history-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 5px;
  margin-top: 0;
  color: var(--bb-record-ink);
  font-family: var(--wk-record-font);
  font-size: var(--wk-record-body, 16px);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0;
}

.bonbon-game .history-best-meta {
  justify-content: center;
  margin-top: 4px;
  font-size: var(--wk-record-body, 16px);
}

.bonbon-game .history-x-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: var(--wk-button-share);
  color: #fff;
  font-family: var(--wk-record-font);
  font-size: var(--wk-font-control, 18px);
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    0 4px 0 rgba(95, 67, 141, 0.4),
    0 8px 14px rgba(0, 0, 0, 0.12);
}

.bonbon-game .history-x-btn:disabled,
.bonbon-game .history-x-btn.is-disabled {
  opacity: 0.55;
  cursor: default;
  background: linear-gradient(
    180deg,
    rgba(160, 140, 190, 0.75),
    rgba(118, 92, 156, 0.72)
  );
  box-shadow: none;
}

.bonbon-game .history-list {
  display: grid;
  gap: 12px;
}

.bonbon-game .history-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 3px 12px;
  min-height: 78px;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
}

.bonbon-game .history-row-count,
.bonbon-game .history-row strong,
.bonbon-game .history-empty {
  font-family: var(--wk-record-font);
  font-size: var(--wk-record-score, 28px);
}

.bonbon-game .history-row-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.bonbon-game .history-row-main strong {
  display: block;
}

.bonbon-game .history-row-count {
  color: #fff;
  background: linear-gradient(135deg, #65dbab, #1fa575);
  border-radius: 999px;
  text-align: center;
  line-height: 26px;
  box-sizing: border-box;
  min-width: 0;
  width: 56px;
  height: 26px;
  padding: 0 6px;
  font-family: var(--wk-record-font);
  font-size: var(--bb-record-meta-size);
  grid-row: 1 / 3;
  justify-self: center;
  white-space: nowrap;
}

.bonbon-game .history-row strong {
  color: var(--bb-accent);
  font-family: var(--wk-record-font);
  font-size: var(--wk-record-score, 28px);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.75);
}

.bonbon-game .history-row time {
  grid-column: 2;
  font-family: var(--wk-record-font);
  font-size: var(--wk-record-date, 16px);
  color: var(--bb-record-ink);
  line-height: 1.5;
  white-space: nowrap;
}

.bonbon-game .history-empty {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #548b75;
  font-size: 18px;
}

.bonbon-game .controls-panel {
  width: min(430px, 94%);
  min-height: 380px;
}

.bonbon-game .ranking-head,
.bonbon-game .rules-head {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 0;
  padding: var(--bb-record-header-padding, 5px 4px 7px);
}

.bonbon-game .rules-head::before {
  content: "";
  display: block;
}

.bonbon-game .ranking-title,
.bonbon-game .rules-title {
  font-family: var(--wk-record-font);
  font-size: 27px;
  color: var(--bb-record-ink, #8d55dc);
  letter-spacing: 0.12em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
  grid-column: 2;
  text-align: center;
  padding-left: 0.12em;
}

.bonbon-game .rules-head .ranking-close {
  grid-column: 3;
  justify-self: end;
}

.bonbon-game #rules-scr .rules-panel {
  --bb-rule-body: 18px;
  --bb-rule-heading: 24px;
  --bb-rule-meta: 15px;
  --bb-rule-figure: 18px;
  --bb-rule-gap: 8px;
  --bb-rule-tile: 44px;
  font-family:
    "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-weight: 700;
  width: min(540px, 100%);
  height: min(650px, 100%);
  max-height: 100%;
  gap: 8px;
  overflow: hidden;
}
.bonbon-game .rule-topics {
  width: 100%;
  flex: 0 0 auto;
}
.bonbon-game .rule-topics,
.bonbon-game .rule-nav {
  appearance: none;
  min-height: 44px;
  min-width: 0;
  padding: 8px 12px;
  border: 2px solid #fff;
  border-radius: 12px;
  background: #eee4ff;
  color: #64408c;
  font:
    700 var(--bb-rule-meta)/1.4 "Zen Maru Gothic",
    "Hiragino Maru Gothic ProN",
    sans-serif;
  cursor: pointer;
  box-shadow: 0 3px 0 #c7b0e9;
  touch-action: manipulation;
}
.bonbon-game .rule-nav:not(:disabled) {
  background: #9b65f0;
  color: #fff;
  box-shadow: 0 3px 0 #7743bf;
}
.bonbon-game .rule-nav:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: none;
}
.bonbon-game .rule-topics:focus-visible,
.bonbon-game .rule-nav:focus-visible {
  outline: 3px solid #f857ae;
  outline-offset: 2px;
}
.bonbon-game .rule-nav:disabled {
  cursor: default;
  color: #a494b5;
}
.bonbon-game .rule-pages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  padding: 2px;
  display: flex;
}
.bonbon-game .rule-page {
  display: flex;
  flex-direction: column;
  flex: 0 0 100%;
  height: 100%;
  justify-content: space-evenly;
  gap: var(--bb-rule-gap);
  align-items: center;
  text-align: center;
  color: #59377f;
  font-size: var(--bb-rule-body);
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}
.bonbon-game .rule-page[hidden] {
  display: none;
}
.bonbon-game .rule-page > * {
  flex-shrink: 0;
}
.bonbon-game .rule-page h3 {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font:
    700 var(--bb-rule-heading)/1.35 "Zen Maru Gothic",
    "Hiragino Maru Gothic ProN",
    sans-serif;
  color: #8650d4;
  text-shadow: 0 2px 0 #fff;
}
.bonbon-game .rule-page p {
  display: grid;
  gap: 4px;
  margin: 0;
}
.bonbon-game .rule-sentence {
  display: block;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.bonbon-game .rule-page .rule-note {
  font-size: var(--bb-rule-meta);
  color: #826c98;
  line-height: 1.45;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border-radius: 14px;
  background: #fff5fc94;
}
.bonbon-game .rule-figure {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 18px;
  background: #fff9fe;
  box-shadow: 0 4px 0 #e2c7f4;
}
.bonbon-game .rule-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  max-width: 320px;
}
.bonbon-game .rule-piece-row .rule-tile:first-child {
  grid-column: 9;
  grid-row: 1;
}
.bonbon-game .rule-piece-row .rule-tile:nth-child(2) {
  grid-column: 8;
  grid-row: 2;
}
.bonbon-game .rule-piece-row .rule-tile:nth-child(3) {
  grid-column: 9;
  grid-row: 2;
}
.bonbon-game .rule-piece-row .rule-tile:nth-child(4) {
  grid-column: 10;
  grid-row: 2;
}

.bonbon-game .rule-tile {
  --rule-tile: #ff68ad;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #ffffffba;
  border-radius: 7px;
  background:
    linear-gradient(145deg, #ffffff90, transparent 55%), var(--rule-tile);
  box-shadow:
    0 3px 0 color-mix(in srgb, var(--rule-tile), #7d3680 25%),
    inset 0 2px 0 #ffffffa0;
  color: #fff;
  font: 900 clamp(13px, 3vw, 22px)/1 sans-serif;
  text-shadow: 0 2px 0 #00000022;
}
.bonbon-game .tone-1 {
  --rule-tile: #ffd558;
}
.bonbon-game .tone-2 {
  --rule-tile: #54da91;
}
.bonbon-game .tone-3 {
  --rule-tile: #51c7ff;
}
.bonbon-game .rule-empty {
  background: #f1e8fa;
  color: #b5a0ce;
  box-shadow: none;
  border: 2px dashed #c6b0df;
}
.bonbon-game .rule-bon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.bonbon-game .rule-bon .rule-tile {
  width: var(--bb-rule-tile);
}
.bonbon-game .rule-caption,
.bonbon-game .rule-limit {
  font-size: var(--bb-rule-meta);
}
.bonbon-game .rule-arrow {
  font-size: 20px;
  line-height: 1.1;
  color: #bb7bde;
}
.bonbon-game .rule-clear {
  color: #eb48a0;
  font-size: var(--bb-rule-figure);
  font-weight: 700;
}
.bonbon-game .rule-spark .rule-tile {
  opacity: 0.6;
}

.bonbon-game .rule-convert-example {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.bonbon-game .rule-convert-group {
  display: flex;
  gap: 3px;
}
.bonbon-game .rule-convert-group .rule-tile {
  width: 30px;
  flex: 0 0 auto;
}
.bonbon-game .rule-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  font-size: var(--bb-rule-meta);
}

.bonbon-game .rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bonbon-game .rules-intro {
  margin: 0;
  color: rgba(76, 50, 118, 0.88);
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-size: var(--wk-font-body, 16px);
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.bonbon-game .rules-grid--controls {
  grid-template-columns: 1fr;
  gap: 10px;
}

.bonbon-game .rules-card {
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
  padding: 11px 12px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    0 4px 10px rgba(106, 68, 170, 0.13);
  box-sizing: border-box;
}

.bonbon-game .rules-card-title {
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-size: 19px;
  letter-spacing: 0.08em;
  color: #8051cf;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.75);
  margin-bottom: 7px;
  text-align: center;
}

.bonbon-game .rules-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-size: var(--wk-font-body, 16px);
  font-weight: 800;
  line-height: 1.42;
  color: rgba(76, 50, 118, 0.82);
  text-align: left;
}
.bonbon-game .rules-list li {
  position: relative;
  padding-left: 14px;
}
.bonbon-game .rules-list li::before {
  content: "◆";
  position: absolute;
  top: 0.08em;
  left: 0;
  color: #9b62e5;
  font-size: max(var(--wk-font-min, 14px), 0.72em);
}

.bonbon-game .rules-keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-size: var(--wk-font-body, 16px);
  font-weight: 800;
  line-height: 1.35;
  color: rgba(76, 50, 118, 0.82);
  text-align: center;
  justify-items: center;
}

.bonbon-game .rules-grid--controls .rules-card {
  padding: 20px 18px;
}

.bonbon-game .controls-device-card--tablet,
.bonbon-game .controls-device-card--mobile {
  display: none;
}

.bonbon-game .rules-grid--controls .rules-card-title {
  font-size: 23px;
  margin-bottom: 12px;
}

.bonbon-game .rules-grid--controls .rules-keys {
  grid-template-columns: 1fr;
  gap: 10px;
  font-size: 16px;
  line-height: 1.38;
  justify-items: stretch;
}

.bonbon-game .rules-grid--controls .rules-keys > span {
  display: block;
  text-align: center;
}

.bonbon-game .rules-grid--controls .rules-card:last-child .rules-keys {
  grid-template-columns: 1fr;
  text-align: center;
}

@media (min-width: 601px) and (max-width: 1024px),
  (pointer: coarse) and (min-width: 601px) {
  .bonbon-game .controls-device-card--pc,
  .bonbon-game .controls-device-card--mobile {
    display: none;
  }
  .bonbon-game .controls-device-card--tablet {
    display: block;
  }
}

.bonbon-game .ranking-close {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 2px 2px 3px;
  padding: 0 0 2px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  outline: 2px solid rgba(255, 255, 255, 0.34);
  outline-offset: 0;
  border-radius: 50%;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-family: var(--wk-record-font);
  font-size: 23px;
  line-height: 1;
  text-align: center;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.68),
    0 4px 0 rgba(86, 47, 146, 0.28),
    0 7px 11px rgba(106, 68, 170, 0.18);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  text-shadow: none;
}

.bonbon-game .ranking-head .ranking-close {
  grid-column: 3;
  justify-self: end;
}

.bonbon-game .ranking-period-tabs {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: var(--wk-record-period, 18px);
}

.bonbon-game .ranking-tab {
  min-height: 38px;
  border: 3px solid rgba(150, 105, 220, 0.36);
  border-radius: 22px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.76),
      rgba(255, 255, 255, 0.46)
    ),
    linear-gradient(
      135deg,
      rgba(232, 218, 255, 0.54),
      rgba(205, 181, 246, 0.44)
    );
  color: #7445bc;
  cursor: pointer;
  font-family: var(--wk-record-font);
  font-size: var(--wk-font-control, 18px);
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow: none;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.72),
    0 2px 0 rgba(130, 82, 194, 0.2),
    0 6px 12px rgba(106, 68, 170, 0.1);
  backdrop-filter: blur(7px) saturate(1.5);
  -webkit-backdrop-filter: blur(7px) saturate(1.5);
}

.bonbon-game .ranking-tab.is-active {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0.02) 42%,
      rgba(70, 24, 150, 0.78)
    ),
    linear-gradient(135deg, rgba(126, 72, 214, 0.96), rgba(82, 31, 170, 0.96));
  border-color: rgba(255, 255, 255, 0.92);
  color: #fff;
  text-shadow:
    0 2px 0 rgba(61, 22, 120, 0.48),
    0 0 10px rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 2px 7px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 3px 0 rgba(54, 22, 112, 0.42),
    0 0 0 2px rgba(126, 72, 214, 0.38),
    0 8px 16px rgba(82, 31, 170, 0.18);
}

.bonbon-game .ranking-period {
  flex-shrink: 0;
  min-height: 22px;
  padding: 0 8px 3px;
  line-height: 1.2;
  border-bottom: 2px solid rgba(141, 85, 220, 0.18);
  text-align: center;
  font-family: var(--wk-record-font);
  font-size: var(--wk-record-period, 18px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(95, 67, 141, 0.78);
}

.bonbon-game .ranking-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px 2px;
}

.bonbon-game .ranking-empty {
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--wk-record-font);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: rgba(95, 67, 141, 0.66);
}

.bonbon-game .ranking-error {
  flex-direction: column;
  gap: 14px;
  color: #583487;
}
.bonbon-game .ranking-error p {
  margin: 0;
  line-height: 1.5;
}
.bonbon-game .ranking-retry {
  width: min(220px, 100%);
  font-size: 16px;
}
.bonbon-game .ranking-item {
  display: grid;
  box-sizing: border-box;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 2px 8px;
  flex-shrink: 0;
  min-height: 64px;
  margin: 0;
  padding: 6px 10px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 4px 10px rgba(106, 68, 170, 0.14);
}

.bonbon-game .ranking-item.is-best {
  background: linear-gradient(
    135deg,
    rgba(255, 241, 127, 0.82),
    rgba(255, 198, 95, 0.62)
  );
  border-color: rgba(255, 255, 255, 0.86);
}

.bonbon-game .ranking-item.is-mine {
  outline: 3px solid #f279b7;
  outline-offset: -3px;
}

.bonbon-game .ranking-rank {
  width: 38px;
  height: 38px;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #b387f4, #7f48cc);
  color: #fff;
  font-family: var(--wk-record-font);
  line-height: 1;
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.32),
    0 3px 0 rgba(72, 38, 132, 0.38);
  min-width: 0;
}

.bonbon-game .ranking-rank strong {
  font-size: 20px;
  font-weight: 400;
}

.bonbon-game .ranking-rank span {
  margin-top: 2px;
  font-size: var(--wk-font-min, 14px);
  letter-spacing: 0.08em;
}

.bonbon-game .ranking-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.bonbon-game .ranking-score-line,
.bonbon-game .ranking-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px 8px;
  flex-wrap: wrap;
}

.bonbon-game .ranking-own {
  border: 1px solid #f6accc;
  border-radius: 999px;
  background: #fff2f9;
  color: #bb3c82;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.bonbon-game .ranking-score {
  font-family: var(--wk-record-font);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
  color: var(--bb-accent);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.75);
}

.bonbon-game .ranking-meta,
.bonbon-game .ranking-date {
  font-family: var(--wk-record-font);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.3;
  color: #5f438d;
  white-space: nowrap;
}

.bonbon-game .ranking-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 5px;
}

.bonbon-game .ranking-date {
  min-width: 0;
  color: #6c518e;
  white-space: nowrap;
  text-align: left;
  font-size: 12px;
  line-height: 1.3;
}

.bonbon-game .ranking-bottom-close {
  flex-shrink: 0;
  align-self: center;
  font-family: var(--wk-record-font);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: var(--wk-font-control, 16px);
  padding: 11px 44px;
  margin-top: 2px;
  animation: none;
}

/* ラベル・数値テキスト */
.bonbon-game .lbl {
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0.1em;
  color: var(--bb-tool-label, var(--bb-text));
  margin-bottom: 2px;
  white-space: nowrap;
  text-align: center;
}
.bonbon-game .val {
  font-family: "Fredoka One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 37px;
  color: var(--bb-accent);
  text-shadow: 0 2px 0 rgba(255, 120, 180, 0.3);
  word-break: break-all;
  text-align: center;
  line-height: 1;
}
.bonbon-game .btn-icon {
  display: inline-block;
  transform: translateY(-2px);
  font-size: max(var(--wk-font-min, 14px), 0.75em);
}

/* リセット・ポーズボタン */
.bonbon-game .reset-btn {
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  -webkit-appearance: none;
}
.bonbon-game .reset-btn .lbl {
  font-size: 20px;
  letter-spacing: 0.1em;
  margin: 0;
  white-space: nowrap;
}
.bonbon-game .reset-btn:hover,
.bonbon-game .reset-btn:active {
  background: var(--wk-button-neutral-hover);
  transform: scale(1.04) translateY(-2px);
}

.bonbon-game .play-bgm-btn {
  --bb-tool-color: #ffb641;
  --bb-tool-label: #fff;
  --bb-tool-edge: #ef8b23;
  width: 100%;
  min-height: 44px;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s;
}

.bonbon-game .bgm-toggle-btn {
  --bb-tool-color: #ffb641;
  --bb-tool-label: #fff;
  --bb-tool-edge: #ef8b23;
  width: 100%;
  cursor: pointer;
  transition:
    transform 0.16s,
    box-shadow 0.16s;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 44px;
  padding: 8px 4px;
  outline: none;
  -webkit-appearance: none;
}
.bonbon-game .bgm-toggle-btn .lbl {
  margin: 0;
  font-size: var(--bb-sound-label-size, var(--wk-font-control, 18px));
  line-height: 1.2;
}
.bonbon-game .play-bgm-btn:hover,
.bonbon-game .play-bgm-btn:focus-visible,
.bonbon-game .bgm-toggle-btn:hover,
.bonbon-game .bgm-toggle-btn:focus-visible {
  transform: translateY(-1px);
}
.bonbon-game .play-bgm-btn:active,
.bonbon-game .bgm-toggle-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 var(--bb-tool-edge, #a088d8),
    inset 0 1px 0 #ffffff70;
}
.bonbon-game #bgm-toggle-icon {
  color: var(--bb-tool-label, var(--bb-accent));
  font-size: var(--bb-sound-label-size, var(--wk-font-control, 18px));
}

/* 中間高さ対応（601px〜935px のウィンドウ高さ） */
@media (max-height: 935px) and (min-width: 601px) {
  .bonbon-game {
    height: min(936px, calc(100vh - 60px));
  }
  .bonbon-game #start-scr {
    grid-template-rows: auto auto auto;
    row-gap: 20px;
    padding-top: 3px;
    padding-bottom: 5px;
  }
  .bonbon-game #title-canvas {
    max-height: clamp(82px, calc(100vh - 560px), 210px);
  }
  .bonbon-game .title-brand {
    padding-top: 154px;
  }
  .bonbon-game .title-start {
    padding-bottom: 116px;
  }
  .bonbon-game .select-panel {
    gap: 6px;
    padding: 4px 18px;
  }
  .bonbon-game .setting-cycle-btn {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .bonbon-game #start-btn {
    font-size: 22px;
    padding: 8px 0;
  }
  .bonbon-game .ranking-open-btn,
  .bonbon-game .rules-open-btn,
  .bonbon-game .controls-open-btn {
    padding: 11px 0;
  }
  .bonbon-game .go-title {
    max-height: clamp(100px, 25vh, 200px);
  }
  .bonbon-game .go-score {
    font-size: clamp(32px, 6vw, 60px);
  }
  .bonbon-game .go-label {
    font-size: clamp(18px, 3vw, 30px);
  }
  .bonbon-game .go-code {
    font-size: clamp(16px, 2.5vw, 24px);
  }
  .bonbon-game .overlay {
    gap: 16px;
  }
}

/* スマホ用（600px以下） */
@media (max-width: 600px) {
  body:has(.bonbon-game) { overflow: hidden; }
  .bonbon-game {
    --bb-title-side-button-h: 44px;
    --bb-record-score-size: var(--wk-record-score, 28px);
    --bb-record-meta-size: var(--wk-record-body, 16px);
    position: fixed;
    inset: 64px 8px 8px;
    z-index: 900;
    width: auto;
    max-width: none;
    margin: 0;
    height: auto;
    min-height: 0;
    max-height: none;
    border-radius: 8px;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .game-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 8px;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .canvas-col {
    flex: 1 1 0;
    width: 100%;
    min-height: 0;
  }
  .bonbon-game .overlay {
    overflow-x: hidden;
    overflow-y: auto;
  }
  .bonbon-game #title-canvas {
    --bb-title-logo-width: auto;
    max-height: 118px;
  }
  .bonbon-game .game-wrapper {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 5px;
    padding: 4px 5px;
  }
  .bonbon-game .side {
    --bb-preview-size: 76px;
    gap: 4px;
  }
  .bonbon-game .bon-action {
    font-size: 20px;
  }
  .bonbon-game .bon-action .lbl {
    font-size: 20px;
  }
  .bonbon-game .bon-icon {
    width: 24px;
    height: 24px;
  }
  .bonbon-game .next-box {
    gap: 4px;
    padding-top: 4px;
  }
  .bonbon-game .stats-group .stat-box {
    padding: 2px 1px;
    border-radius: 10px;
  }
  .bonbon-game .stats-group .lbl {
    font-size: 14px;
    letter-spacing: 0;
  }
  .bonbon-game .stats-group .val {
    font-size: max(var(--wk-font-min, 14px), var(--bb-number-fit, 24px));
  }

  .bonbon-game:not(.is-title-screen):not(.is-gameover-screen) .bgm-toggle-btn {
    --bb-sound-label-size: 16px;
    flex-direction: column;
    gap: 1px;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .side {
    display: flex;
    flex: 0 0 auto;
    gap: 14px;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
  }
  .bonbon-game .box {
    padding: 3px 3px 4px;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn,
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .history-open-btn,
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn {
    padding: 3px 3px 4px;
  }
  .bonbon-game .val {
    font-size: 22px;
    line-height: 1.05;
    white-space: nowrap;
  }
  .bonbon-game .lbl {
    font-size: var(--wk-font-min, 14px);
    letter-spacing: 0.025em;
    margin-bottom: 1px;
    white-space: nowrap;
  }
  .bonbon-game .go-title {
    max-height: clamp(100px, 26vw, 140px);
  }
  .bonbon-game .go-label {
    font-size: max(var(--wk-font-min, 14px), clamp(11px, 4.5vw, 18px));
  }
  .bonbon-game .go-score {
    font-size: clamp(20px, 9vw, 42px);
  }
  .bonbon-game .go-code {
    font-size: clamp(14px, 4vw, 20px);
    letter-spacing: 0.1em;
    padding: 8px 14px;
  }
  .bonbon-game .overlay {
    --bb-title-art-y: 50px;
    --bb-title-art-shift: 8px;
    gap: 8px;
    padding: 10px 10px;
  }
  .bonbon-game #start-scr {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    align-content: center;
    justify-items: center;
    row-gap: 22px;
    padding: 10px 8px;
  }
  .bonbon-game .title-brand {
    width: calc(100% + 8px);
    padding-top: 84px;
  }
  .bonbon-game #start-scr #title-canvas {
    margin: 0 auto;
    max-width: 100%;
    max-height: clamp(112px, 30vw, 160px);
    transform: rotate(-1.5deg);
  }
  .bonbon-game .title-mascot {
    --bb-title-art-size: 84px;
  }
  .bonbon-game .title-start {
    width: 82%;
    margin: 10px 0 0;
    padding-bottom: 68px;
  }
  .bonbon-game .title-apple {
    --bb-title-art-size: 80px;
  }
  .bonbon-game .btn {
    font-size: var(--wk-font-control, 16px);
    padding: 10px 18px;
  }

  .bonbon-game .title-options {
    width: 100%;
    gap: 10px;
  }

  .bonbon-game .select-panel {
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
  }
  .bonbon-game .select-title {
    font-size: 12px;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .bonbon-game .title-side-btn .lbl {
    font-size: var(--wk-font-control, 16px);
    letter-spacing: 0.02em;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .history-open-btn {
    min-height: 0;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .lbl {
    font-size: var(--wk-font-control, 16px);
    letter-spacing: 0.02em;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .val {
    font-size: 16px;
    line-height: 1;
  }
  .bonbon-game .setting-cycle-btn {
    box-sizing: border-box;
    min-width: 0;
    min-height: 44px;
    font-size: var(--wk-font-control, 16px);
    letter-spacing: 0.02em;
    padding: 8px 6px;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .bonbon-game #start-btn {
    box-sizing: border-box;
    width: 100%;
    font-size: 23px;
    padding: 13px 0;
    margin: 0;
    min-height: 52px;
  }
  .bonbon-game .ranking-open-btn,
  .bonbon-game .rules-open-btn,
  .bonbon-game .controls-open-btn {
    width: 100%;
    font-size: var(--wk-font-control, 16px);
    padding: 9px 0;
  }
  .bonbon-game .go-actions {
    gap: 8px;
  }
  .bonbon-game .ranking-overlay,
  .bonbon-game .history-overlay {
    padding: 9px;
  }
  .bonbon-game .rules-overlay,
  .bonbon-game .controls-overlay {
    position: fixed;
    height: 100dvh;
    border-radius: 0;
    padding: 12px;
  }
  .bonbon-game .title-confirm-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    padding: 12px;
    border-radius: 0;
  }
  .bonbon-game .title-confirm-panel {
    width: min(320px, calc(100vw - 24px));
    padding: 18px 16px 17px;
  }
  .bonbon-game .title-confirm-title {
    font-size: 18px;
    letter-spacing: 0.02em;
    line-height: 1.18;
  }
  .bonbon-game .title-confirm-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
  }
  .bonbon-game .title-confirm-actions .btn {
    width: 100%;
    padding: 8px 4px;
    font-size: var(--wk-font-control, 16px);
    letter-spacing: 0.03em;
    min-width: 0;
  height: auto;
  min-height: 44px;
}
  .bonbon-game .ranking-panel,
  .bonbon-game .rules-panel,
  .bonbon-game .history-panel {
    gap: var(--bb-panel-mobile-gap, 8px);
    border-radius: 10px;
    font-family: var(--wk-record-font);
  font-weight: 700;
  line-height: 1.5;
}
  .bonbon-game .ranking-panel,
  .bonbon-game .history-panel {
    width: 98%;
    max-height: 96%;
    padding: var(--bb-panel-mobile-padding, 14px);
    font-family: var(--wk-record-font);
  font-weight: 700;
  line-height: 1.5;
}
  .bonbon-game .rules-panel {
    width: min(360px, calc(100% - 12px));
    max-height: calc(100% - 18px);
    padding: 13px 11px 12px;
  }
  .bonbon-game #rules-scr .rules-panel {
    --bb-rule-body: 16px;
    --bb-rule-heading: 22px;
    --bb-rule-meta: 14px;
    --bb-rule-figure: 16px;
    --bb-rule-gap: 6px;
    --bb-rule-tile: 34px;
    width: min(400px, 100%);
    height: min(680px, 100%);
    max-height: 100%;
  }
  .bonbon-game .rule-page .rule-note {
    color: #6b4c89;
    line-height: 1.6;
  }
  .bonbon-game .rule-pages {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .bonbon-game .rule-page {
    height: auto;
    min-height: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    gap: 12px;
    padding: 4px 2px 10px;
    line-height: 1.6;
  }
  .bonbon-game .ranking-panel {
    --bb-panel-mobile-padding: 10px;
    --bb-panel-mobile-gap: 5px;
    font-family: var(--wk-record-font);
  font-weight: 700;
  line-height: 1.5;
}
  .bonbon-game .controls-panel {
    width: min(400px, 100%);
    height: min(680px, 100%);
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }
  .bonbon-game .ranking-title,
  .bonbon-game .rules-title {
    font-size: 24px;
  }
  .bonbon-game .ranking-head,
  .bonbon-game .rules-head {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }
  .bonbon-game .ranking-close {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
  .bonbon-game .ranking-tab {
    min-height: 44px;
    font-size: var(--wk-font-control, 16px);
  }
  .bonbon-game .ranking-period {
    font-size: var(--wk-record-period, 18px);
  }
  .bonbon-game .ranking-empty {
    min-height: 120px;
    font-size: 14px;
  }
  .bonbon-game .history-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 3px 8px;
    min-height: 76px;
    padding: 9px 8px;
    border-radius: 10px;
  }
  .bonbon-game .ranking-item {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 2px 6px;
    min-height: 60px;
    padding: 5px 8px;
    border-radius: 10px;
  }
  .bonbon-game .ranking-rank {
    width: 34px;
    height: 34px;
  }
  .bonbon-game .ranking-score {
    font-size: 24px;
  }
  .bonbon-game .ranking-rank strong {
    font-size: 18px;
  }
  .bonbon-game .ranking-rank span {
    font-size: var(--wk-font-min, 14px);
  }
  .bonbon-game .ranking-bottom-close {
    min-height: 44px;
    padding: 10px 34px;
    font-size: var(--wk-font-control, 16px);
  }
  .bonbon-game .history-section {
    padding: 10px 11px;
  }
  .bonbon-game .history-section-title {
    font-size: 17px;
  }
  .bonbon-game .history-best-score {
    font-size: var(--wk-record-best, 36px);
  }
  .bonbon-game .history-row-count {
    width: 48px;
    padding: 0 4px;
  }
  .bonbon-game .rules-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .bonbon-game .rules-card {
    padding: 9px 10px;
  }
  .bonbon-game .rules-card-title {
    font-size: 15px;
    margin-bottom: 5px;
  }
  .bonbon-game .rules-intro {
    font-size: var(--wk-font-min, 14px);
    line-height: 1.35;
  }
  .bonbon-game .rules-list {
    gap: 4px;
    font-size: var(--wk-font-min, 14px);
    line-height: 1.42;
  }
  .bonbon-game .rules-grid--controls {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    gap: 10px;
  }
  .bonbon-game .rules-grid--controls .rules-card {
    padding: 12px;
  }
  .bonbon-game .rules-grid--controls .rules-card-title {
    font-size: 20px;
    margin-bottom: 8px;
  }
  .bonbon-game .rules-keys {
    font-size: var(--wk-font-min, 14px);
    gap: 3px 6px;
  }
  .bonbon-game .rules-grid--controls .rules-keys {
    grid-template-columns: 1fr;
    gap: 10px;
    font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
  }
  .bonbon-game .controls-device-card--mobile .rules-keys > span {
    display: grid;
    grid-template-columns: 5.5em minmax(0, 1fr);
    align-items: start;
    column-gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(128, 81, 207, 0.18);
    color: #59377f;
    text-align: left;
  }
  .bonbon-game .controls-device-card--pc,
  .bonbon-game .controls-device-card--tablet {
    display: none;
  }
  .bonbon-game .controls-device-card--mobile {
    display: block;
  }
  .bonbon-game .reset-btn .lbl {
    font-size: var(--wk-font-control, 16px);
  }
  .bonbon-game .canvas-col {
    justify-content: center;
    gap: 4px;
  }
}

@media (max-width: 340px) {
  .bonbon-game .rules-panel {
    padding: 9px 8px 8px;
    gap: 5px;
  }

  .bonbon-game .rules-head {
    padding: 3px 3px 6px;
  }

  .bonbon-game .rules-title {
    font-size: 24px;
  }

  .bonbon-game .rules-intro {
    font-size: var(--wk-font-min, 14px);
    line-height: 1.25;
  }

  .bonbon-game .rules-grid {
    gap: 5px;
  }

  .bonbon-game .rules-card {
    padding: 6px 7px;
  }

  .bonbon-game .rules-card-title {
    margin-bottom: 3px;
    font-size: var(--wk-font-min, 14px);
  }

  .bonbon-game .rules-list {
    gap: 2px;
    font-size: var(--wk-font-min, 14px);
    line-height: 1.28;
  }

  .bonbon-game .rules-list li {
    padding-left: 11px;
  }

  .bonbon-game #rules-bottom-close {
    min-height: 30px;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: var(--wk-font-min, 14px);
  }
}
