/**
 * bonbon-drop.css
 * BONBON DROP ゲーム専用スタイル
 * すべてのセレクターは .bonbon-game スコープに限定する
 */

/* ゲームルートコンテナ */
.bonbon-game {
  --bb-bg: #d8c8f5;
  --bb-accent: #9966dd;
  --bb-accent2: #7755bb;
  --bb-text: #5a3a8a;
  --bb-dim: #c8b8e8;
  --bb-title-side-button-h: 42px;

  position: relative;
  width: 100%;
  max-width: 749px;
  margin-left: auto;
  margin-right: auto;
  margin-top: -16px;
  height: min(936px, calc(100vh - 60px));
  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: none;
  -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: flex;
  gap: 14px;
  align-items: stretch;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 8px 10px;
  box-sizing: border-box;
}

.bonbon-game .canvas-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}
.bonbon-game .top-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.bonbon-game .top-btns .reset-btn { flex: 1; }

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .top-btns,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .next-box {
  display: none !important;
  pointer-events: none;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .side {
  justify-content: stretch;
  gap: 8px;
}

.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: 100%;
}

.bonbon-game.is-title-screen #start-scr {
  inset: 0;
  min-height: 100%;
}

.bonbon-game .title-side-actions {
  display: none;
}

.bonbon-game .best-box {
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid rgba(255,255,255,0.35);
  color: inherit;
  cursor: default;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .best-box {
  cursor: pointer;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .stat-box {
  display: none !important;
}

.bonbon-game .title-best-content {
  display: none;
}

.bonbon-game .game-best-content,
.bonbon-game .title-best-content {
  position: relative;
  z-index: 1;
  width: 100%;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .best-box {
  order: 2;
  flex: 1 1 0;
  min-height: 0;
  height: auto;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .game-best-content {
  display: none !important;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-best-content {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
  height: 100%;
  padding: 2px 0;
}

.bonbon-game .title-best-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
  color: var(--bb-accent2);
  line-height: 1;
}

.bonbon-game .title-best-row span {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 13px;
  letter-spacing: .06em;
  text-align: left;
  opacity: .9;
}

.bonbon-game .title-best-row strong {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--bb-accent);
  text-shadow: 0 3px 0 rgba(255,120,180,0.30);
}

.bonbon-game .title-best-current {
  display: block;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
  color: var(--bb-accent);
  text-shadow: 0 3px 0 rgba(255,120,180,0.30);
  text-align: center;
}
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-actions {
  display: contents;
}

.bonbon-game .title-side-btn {
  width: 100%;
  height: var(--bb-title-side-button-h);
  min-height: var(--bb-title-side-button-h);
  flex: 0 0 var(--bb-title-side-button-h);
  padding: 6px 8px 8px;
  cursor: pointer;
  color: var(--bb-text);
  transition: transform .16s, background .16s, box-shadow .16s;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .best-box,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: auto !important;
  box-sizing: border-box;
  padding: 6px 8px 8px;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn {
  order: 1;
  display: flex !important;
  pointer-events: auto;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .lbl {
  font-size: 18px;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .val {
  font-size: 24px;
  line-height: 1;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) #ranking-btn { order: 3; }
.bonbon-game:is(.is-title-screen, .is-gameover-screen) #rules-btn { order: 4; }
.bonbon-game:is(.is-title-screen, .is-gameover-screen) #controls-btn { order: 5; }

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .best-box,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn {
  border-color: rgba(255,255,255,0.70);
  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%);
  backdrop-filter: blur(7px) saturate(1.9);
  -webkit-backdrop-filter: blur(7px) saturate(1.9);
  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.30) inset,
    -1px 0 0 rgba(126,72,200,0.07) inset,
    0 4px 0 rgba(116,74,190,0.07),
    0 10px 24px rgba(124,82,205,0.10),
    0 0 24px rgba(255,255,255,0.28) inset;
}

.bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn::after,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .best-box::after,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-btn::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:is(.is-title-screen, .is-gameover-screen) .title-best-row {
  display: none;
}

.bonbon-game .title-side-btn .lbl {
  margin: 0;
  font-size: 19px;
  letter-spacing: .08em;
  color: var(--bb-accent2);
  white-space: nowrap;
}

.bonbon-game .title-side-btn:hover,
.bonbon-game .title-side-btn:active {
  background: rgba(255,255,255,0.28);
  transform: scale(1.035) translateY(-1px);
}

/* キャンバス領域 */
.bonbon-game .canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 2px solid rgba(255,255,255,0.30);
  border-radius: 18px;
  box-shadow: 0 2px 0 rgba(255,255,255,0.18), 0 4px 20px rgba(100,70,180,0.20), inset 0 1px 0 rgba(255,255,255,0.35);
  overflow: hidden;
  background: #a088d8;
  display: flex;
  align-items: stretch;
}

.bonbon-game #gc {
  display: block;
  image-rendering: pixelated;
  width: 100%;
  height: 100%;
}

.bonbon-game .side {
  width: 173px;
  min-width: 173px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 100%;
}
.bonbon-game .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.60) 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.10) 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::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) .best-box.box,
.bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-side-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%);
}

.bonbon-game #next-canvas {
  width: 100%;
  display: block;
  image-rendering: pixelated;
  margin-top: 4px;
  background: #a088d8;
  border-radius: 10px;
}
.bonbon-game .next-box {
  justify-content: flex-start !important;
  gap: 4px;
  padding-top: 10px;
}
.bonbon-game .next-box .lbl {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin: 0 0 2px;
}
.bonbon-game .next-box #next-canvas {
  flex: 1 1 auto;
  min-height: 0;
  object-fit: contain;
}

.bonbon-game .order-box {
  display: none !important;
}
.bonbon-game.is-order-mode:not(.is-title-screen):not(.is-gameover-screen) .best-box {
  display: none !important;
}
.bonbon-game.is-order-mode:not(.is-title-screen):not(.is-gameover-screen) .order-box {
  display: flex !important;
  flex: 1.28 1 0;
  justify-content: flex-start;
  gap: 0;
  padding: 8px 9px 9px;
  border-color: rgba(255,255,255,.68);
  background:
    linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,.12)),
    rgba(232,222,252,.58);
  box-shadow:
    0 1px 0 rgba(255,255,255,.75) inset,
    0 -2px 0 rgba(120,80,200,.18) inset,
    0 4px 0 rgba(100,60,180,.22),
    0 6px 18px rgba(120,80,200,.14);
}
.bonbon-game .order-box::after {
  height: 26%;
  opacity: .72;
}
.bonbon-game .order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 25px;
  padding-bottom: 5px;
  border-bottom: 2px solid rgba(112,73,172,.18);
}
.bonbon-game .order-head .lbl {
  margin: 0;
  color: #513579;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0;
}
.bonbon-game .order-number {
  display: flex;
  align-items: baseline;
  gap: 3px;
  color: #7951ad;
  line-height: 1;
}
.bonbon-game .order-number span {
  font-size: 8px;
  letter-spacing: 0;
}
.bonbon-game .order-number strong {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 19px;
  font-weight: 400;
}
.bonbon-game .order-section-label {
  width: 100%;
  margin: 6px 0 3px;
  color: rgba(81,53,121,.68);
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 9px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: .08em;
  text-align: left;
}
.bonbon-game .order-targets {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 3px;
  width: 100%;
}
.bonbon-game .order-targets.is-single {
  flex: 1 1 auto;
}
.bonbon-game .order-target {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 27px;
  padding: 3px 5px 3px 3px;
  border-left: 3px solid var(--order-color);
  border-bottom: 1px solid rgba(112,73,172,.13);
  background: rgba(255,255,255,.16);
  color: #513579;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0;
  box-sizing: border-box;
}
.bonbon-game .order-target-count {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  min-width: 30px;
  color: #6d3db0;
  white-space: nowrap;
}
.bonbon-game .order-target-count small {
  margin-right: 1px;
  font-size: 10px;
}
.bonbon-game .order-target-count strong {
  color: #6d3db0;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 19px;
  font-weight: 400;
}
.bonbon-game .order-swatch {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.86);
  border-radius: 4px;
  background: var(--order-color);
  box-shadow: 0 0 0 1px rgba(71,48,108,.32), inset 0 4px 0 var(--order-light);
  box-sizing: border-box;
  image-rendering: pixelated;
}
.bonbon-game .order-color-name {
  min-width: 0;
  text-align: left;
  white-space: nowrap;
}
.bonbon-game .order-remaining {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 4px;
  width: 100%;
  margin-top: auto;
  padding-top: 6px;
  border-top: 2px solid rgba(112,73,172,.18);
  color: #513579;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}
.bonbon-game .order-limit-label,
.bonbon-game .order-piece-unit {
  color: rgba(81,53,121,.72);
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .04em;
}
.bonbon-game .order-remaining strong {
  color: #7c43bc;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 23px;
  font-weight: 400;
  text-align: right;
}

.bonbon-game .mode-hint {
  position: absolute;
  top: 9%;
  left: 50%;
  z-index: 18;
  max-width: calc(100% - 24px);
  padding: 9px 15px 11px;
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 12px;
  background: rgba(52,35,82,.90);
  box-shadow: 0 4px 0 rgba(45,25,79,.32), 0 8px 22px rgba(36,20,68,.24);
  color: #fff;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -8px);
}
.bonbon-game .mode-hint.show {
  animation: bb-mode-hint 1.7s ease both;
}
@keyframes bb-mode-hint {
  0% { opacity: 0; transform: translate(-50%, -8px); }
  14%, 72% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 4px); }
}



.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.30) 38%, rgba(165,230,255,0.18) 62%, transparent 72%);
  opacity: 0; pointer-events: none; z-index: 5;
  transition: opacity .05s;
  border-radius: 14px;
}
.bonbon-game #flash.show { opacity: 1; }
.bonbon-game #flash[data-power="2"].show { opacity: .82; }
.bonbon-game #flash[data-power="3"].show { opacity: .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.70), 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 .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 .70s ease-out both;
}
.bonbon-game .bb-line-burst::after {
  animation-delay: .11s;
  opacity: .55;
}
.bonbon-game .bb-line-burst--2 { box-shadow: 0 0 16px rgba(255,255,255,.82), 0 0 36px rgba(205,145,255,.68); }
.bonbon-game .bb-line-burst--3 { box-shadow: 0 0 20px rgba(255,255,255,.9), 0 0 44px rgba(255,130,220,.74); }
.bonbon-game .bb-line-burst--4 { box-shadow: 0 0 24px rgba(255,255,255,.96), 0 0 54px rgba(120,230,255,.68); }

.bonbon-game .bb-line-label {
  position: absolute;
  pointer-events: none;
  z-index: 9;
  transform: translate(-50%, -50%) scale(.65);
  opacity: 0;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: clamp(15px, 4vw, 34px);
  color: #fff;
  letter-spacing: .09em;
  white-space: nowrap;
  text-shadow:
    0 2px 0 rgba(118,65,190,.70),
    0 0 12px rgba(255,255,255,.95),
    0 0 24px rgba(255,120,220,.78),
    0 0 42px rgba(135,230,255,.58);
  animation: bb-line-label .82s ease-out both;
}
.bonbon-game .bb-line-label--4 { font-size: clamp(22px, 6vw, 48px); }

.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,.95);
  border-radius: 14px;
  box-shadow:
    0 0 0 3px rgba(255,130,225,.55),
    0 0 18px rgba(255,255,255,.98),
    0 0 36px rgba(255,110,220,.85),
    0 0 54px rgba(120,230,255,.65);
  animation: bb-bon-ring .95s ease-out both;
}
.bonbon-game .bb-bon-word {
  position: absolute;
  pointer-events: none;
  z-index: 12;
  transform: translate(-50%, -50%) scale(.62);
  opacity: 0;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: clamp(22px, 7vw, 56px);
  color: #fff;
  letter-spacing: .10em;
  text-shadow:
    0 4px 0 rgba(115,60,190,.65),
    0 0 12px rgba(255,255,255,1),
    0 0 28px rgba(255,120,220,.9),
    0 0 52px rgba(120,230,255,.75);
  animation: bb-bon-word .95s 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 .58s ease-out both;
}

.bonbon-game .bb-bon-cell-burst {
  position: absolute;
  pointer-events: none;
  z-index: 11;
  transform: translate(-50%, -50%) scale(.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 .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: .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);
}

.bonbon-game .bb-drop-bonus {
  position: absolute;
  pointer-events: none;
  z-index: 13;
  transform: translate(-50%, -50%) scale(.72);
  opacity: 0;
  display: grid;
  gap: 2px;
  justify-items: center;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  color: #fff;
  letter-spacing: .06em;
  text-align: center;
  white-space: nowrap;
  text-shadow:
    0 3px 0 rgba(112,62,185,.62),
    0 0 12px rgba(255,255,255,1),
    0 0 26px rgba(255,120,220,.86),
    0 0 48px rgba(120,230,255,.68);
  animation: bb-drop-bonus 1.08s cubic-bezier(.17,.84,.32,1.16) both;
}
.bonbon-game .bb-drop-bonus span {
  font-size: clamp(15px, 4.6vw, 34px);
}
.bonbon-game .bb-drop-bonus strong {
  font-size: clamp(21px, 6vw, 46px);
  color: #fff07a;
}

@keyframes bb-line-burst {
  0% { opacity: 0; transform: scaleX(.08); }
  16% { opacity: 1; transform: scaleX(1.04); }
  55% { opacity: .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-line-label {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.62); }
  20% { opacity: 1; transform: translate(-50%, -62%) scale(1.08); }
  70% { opacity: 1; transform: translate(-50%, -95%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -132%) scale(.92); }
}
@keyframes bb-bon-ring {
  0% { opacity: 0; transform: scale(.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(.55); }
  18% { opacity: 1; transform: translate(-50%, -80%) scale(1.16); }
  66% { opacity: 1; transform: translate(-50%, -135%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(.9); }
}
@keyframes bb-bon-target-highlight {
  0% { opacity: 0; transform: scale(.62); }
  28% { opacity: 1; transform: scale(1.16); }
  58% { opacity: .94; transform: scale(.94); }
  100% { opacity: 0; transform: scale(1.34); }
}
@keyframes bb-bon-cell-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.28) rotate(0deg); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(14deg); }
  55% { opacity: .88; transform: translate(-50%, -50%) scale(1.22) rotate(34deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.72) rotate(70deg); }
}
@keyframes bb-drop-bonus {
  0% { opacity: 0; transform: translate(-50%, -45%) scale(.62); }
  16% { opacity: 1; transform: translate(-50%, -60%) scale(1.12); }
  48% { opacity: 1; transform: translate(-50%, -92%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -142%) scale(.9); }
}

.bonbon-game .chain-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 6;
  transform: translate(-50%, -50%) scale(0.85);
  pointer-events: none;
  opacity: 0;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: var(--status-pop-size, clamp(24px, 8vw, 54px));
  line-height: 1.12;
  color: #fff;
  letter-spacing: .08em;
  white-space: nowrap;
  text-shadow:
    0 4px 0 rgba(125,70,200,0.55),
    0 10px 24px rgba(255,90,180,0.35);
}
.bonbon-game .chain-pop.show {
  animation: bb-chain-pop .9s ease-out both;
}

@keyframes bb-chain-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.72); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  62%  { opacity: 1; transform: translate(-50%, -62%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -86%) scale(0.96); }
}

/* オーバーレイ（スタート・ゲームオーバー） */
.bonbon-game .overlay {
  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;
  overflow: hidden;
  box-sizing: border-box;
  gap: 16px;
}

.bonbon-game #start-scr {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows:
    minmax(0, .36fr)
    auto
    minmax(32px, .58fr)
    auto
    minmax(32px, .58fr)
    auto
    minmax(32px, .58fr)
    auto
    minmax(0, .40fr);
  justify-content: stretch;
  align-content: stretch;
  align-items: center;
  justify-items: center;
  row-gap: 0;
  padding: clamp(22px, 4.4vh, 42px) 28px clamp(40px, 7vh, 64px);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.20) 0 10px, transparent 10px 22px),
    rgba(253,232,248,0.94);
  background-size: 44px 44px, auto;
}

.bonbon-game #start-scr #title-canvas {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
  align-self: center;
  margin: 0 auto 0 !important;
  transform: rotate(-2deg);
}

.bonbon-game #title-canvas {
  display: block !important;
  margin: 0 auto !important;
  max-width: 96% !important;
  max-height: 321px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
}

.bonbon-game .go-title {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-weight: 400;
  font-size: 60px;
  letter-spacing: .15em;
  padding-left: .15em;
  color: #ffffff;
  -webkit-text-stroke: 2px #7440bd;
  text-shadow:
    0 4px 0 #5d2ea2,
    0 8px 0 rgba(74,34,136,0.32),
    0 0 14px rgba(255,255,255,0.9);
  transform: rotate(-3deg);
  text-align: center;
  line-height: 1.2;
  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: .1em;
  color: #ffffff;
  -webkit-text-stroke: 1.7px #7440bd;
  text-shadow:
    0 3px 0 #5d2ea2,
    0 6px 0 rgba(74,34,136,0.30),
    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;
}
/* CODEの表示スタイル（ゲームオーバー画面） */
.bonbon-game .go-code {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .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: 11px;
  color: rgba(153,102,221,0.5);
  text-align: center;
  margin-top: 4px;
  letter-spacing: .05em;
}
/* CODEの表示スタイル（サイドバー） */
.bonbon-game .side-code {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--bb-accent2);
  word-break: break-all;
  text-align: center;
  line-height: 1.4;
}

/* ボタン共通スタイル */
.bonbon-game .btn {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 20px;
  padding: 13px 43px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.30), rgba(255,255,255,0.08) 42%, rgba(134,80,218,0.58)),
    linear-gradient(135deg, rgba(207,171,255,0.66), rgba(132,82,212,0.50));
  border: 3px solid rgba(255,255,255,0.72);
  color: #fff;
  cursor: pointer;
  letter-spacing: .1em;
  border-radius: 50px;
  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 10px 22px rgba(140,80,220,0.22);
  transition: all .2s;
  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;
  backdrop-filter: blur(7px) saturate(1.5);
  -webkit-backdrop-filter: blur(7px) saturate(1.5);
}
.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 {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0.12) 44%, rgba(150,91,229,0.62)),
    linear-gradient(135deg, rgba(218,189,255,0.72), rgba(150,93,225,0.56));
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.72),
    inset 0 -2px 0 rgba(95,49,164,0.18),
    0 7px 0 rgba(100,50,180,0.30),
    0 14px 26px rgba(140,80,220,0.28);
  transform: scale(1.05) translateY(-2px);
}
.bonbon-game .btn:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px rgba(180,120,255,0.7), 0 5px 0 rgba(100,50,180,0.5);
}
/* ボタンパルスアニメーション */
@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.20); }
  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.30), 0 12px 30px rgba(140,80,220,0.36); transform: translateY(-1px); }
}

.bonbon-game .bgm-btn {
  position: relative;
  flex: 1;
  justify-content: center;
  font-size: 15px;
  padding: 12px 9px;
  animation: none;
}
.bonbon-game .select-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.bonbon-game .start-controls {
  display: contents;
}
.bonbon-game .audio-panel {
  grid-column: 1;
  grid-row: 4;
  width: min(440px, 90%);
}
.bonbon-game .mode-panel {
  grid-column: 1;
  grid-row: 6;
  width: min(360px, 78%);
}
.bonbon-game .select-title {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: clamp(22px, 3.2vw, 34px);
  font-weight: 400;
  color: #ffffff;
  letter-spacing: .08em;
  line-height: .92;
  transform: rotate(-3deg);
  -webkit-text-stroke: 2px #7440bd;
  text-shadow:
    0 3px 0 #5d2ea2,
    0 6px 0 rgba(74,34,136,0.34),
    0 0 12px rgba(255,255,255,0.85);
}
.bonbon-game .select-buttons {
  display: flex;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
}
.bonbon-game .mode-btn {
  position: relative;
  flex: 1;
  justify-content: center;
  font-size: 14px;
  letter-spacing: .04em;
  padding: 12px 8px;
  animation: none;
}
.bonbon-game .start-actions {
  display: contents;
}
.bonbon-game #start-btn {
  grid-column: 1;
  grid-row: 8;
  justify-self: center;
  width: min(360px, 86%);
  justify-content: center;
  font-size: 25px;
  padding: 17px 0 16px;
  margin: clamp(6px, 1vh, 12px) 0 clamp(4px, .8vh, 10px);
}

.bonbon-game .bgm-btn.active,
.bonbon-game .mode-btn.active {
  background:
    linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,.02) 42%),
    linear-gradient(180deg, #7169df, #4f35b2);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.78),
    inset 0 -3px 0 rgba(41,25,116,.28),
    0 4px 0 #38237d,
    0 0 0 2px #7654cb;
  transform: translateY(0);
  border-color: #3d278c;
  color: #fff;
  animation: none;
}

.bonbon-game .ranking-open-btn {
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 14px;
  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: 14px;
  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: 14px;
  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 {
  position: absolute;
  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);
  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: .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 {
  min-width: 0;
  justify-content: center;
  padding: 12px 10px;
  font-size: 14px;
  letter-spacing: .06em;
  animation: none;
  white-space: nowrap;
}

.bonbon-game .title-confirm-cancel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), rgba(255,255,255,0.06) 42%, rgba(81,67,105,0.58)),
    linear-gradient(135deg, rgba(142,128,168,0.60), rgba(101,85,121,0.50));
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.42),
    0 4px 0 rgba(54,38,76,0.26),
    0 8px 18px rgba(55,40,90,0.16);
}

.bonbon-game .title-confirm-ok {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.30), rgba(255,255,255,0.08) 42%, rgba(128,72,213,0.60)),
    linear-gradient(135deg, rgba(192,153,255,0.68), rgba(138,88,219,0.52));
}

.bonbon-game .ranking-panel,
.bonbon-game .rules-panel,
.bonbon-game .history-panel {
  width: min(470px, 94%);
  max-height: 92%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  box-sizing: border-box;
  border: 3px solid rgba(255,255,255,0.72);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,242,255,0.98), rgba(230,209,255,0.98));
  box-shadow: 0 8px 0 rgba(116,77,178,0.42), 0 18px 36px rgba(68,28,128,0.28);
  color: #5f438d;
}

.bonbon-game .ranking-panel {
  gap: 12px;
  padding: 20px;
}

.bonbon-game .history-content {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
}

.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(106,68,170,0.14);
  padding: 12px 14px;
}

.bonbon-game .history-section-title {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 18px;
  letter-spacing: .08em;
  color: var(--bb-accent2);
  text-align: center;
  line-height: 1;
  margin-bottom: 8px;
}

.bonbon-game .history-best-score {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 34px;
  line-height: 1;
  text-align: center;
  color: var(--bb-accent);
  text-shadow: 0 3px 0 rgba(255,120,180,0.30);
}

.bonbon-game .history-best-code {
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,0.58);
  color: rgba(95,67,141,0.86);
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 12px;
  letter-spacing: .04em;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.bonbon-game .history-best-meta,
.bonbon-game .history-row-meta {
  display: block;
  margin-top: 4px;
  color: rgba(95,67,141,0.78);
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .02em;
  white-space: nowrap;
}

.bonbon-game .history-x-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 999px;
  background: linear-gradient(180deg, #221734, #111);
  color: #fff;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(95,67,141,0.40), 0 8px 14px rgba(0,0,0,0.12);
}

.bonbon-game .history-x-btn:disabled,
.bonbon-game .history-x-btn.is-disabled {
  opacity: .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: 5px;
}

.bonbon-game .history-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.52);
}

.bonbon-game .history-row span,
.bonbon-game .history-row strong,
.bonbon-game .history-empty {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
}

.bonbon-game .history-row-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.bonbon-game .history-row-main strong {
  display: block;
}

.bonbon-game .history-row-count {
  color: #fff;
  background: linear-gradient(135deg, #b387f4, #7f48cc);
  border-radius: 999px;
  text-align: center;
  line-height: 24px;
  min-width: 56px;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  justify-self: center;
  white-space: nowrap;
}

.bonbon-game .history-row strong {
  color: var(--bb-accent);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255,255,255,0.75);
}

.bonbon-game .history-row time {
  color: rgba(95,67,141,0.76);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.bonbon-game .history-empty {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(95,67,141,0.66);
  font-size: 18px;
}

.bonbon-game .controls-panel {
  width: min(430px, 94%);
  min-height: 380px;
}

.bonbon-game .ranking-head,
.bonbon-game .rules-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 0;
  padding: 5px 4px 7px;
}

.bonbon-game .rules-head::before {
  content: "";
  display: block;
}

.bonbon-game .ranking-title,
.bonbon-game .rules-title {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 27px;
  color: #8d55dc;
  letter-spacing: .12em;
  text-shadow: 0 2px 0 rgba(255,255,255,0.8);
  grid-column: 2;
  text-align: center;
  padding-left: .12em;
}

.bonbon-game .rules-head .ranking-close {
  grid-column: 3;
  justify-self: end;
}

.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,.88);
  font-family: 'Baloo 2', 'Arial Rounded MT Bold', sans-serif;
  font-size: 14px;
  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: .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: 13px;
  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: .08em;
  left: 0;
  color: #9b62e5;
  font-size: .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: 13px;
  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:
    linear-gradient(180deg, rgba(255,255,255,0.34), rgba(255,255,255,0.08) 42%, rgba(129,76,214,0.62)),
    linear-gradient(135deg, rgba(193,156,255,0.68), rgba(139,88,219,0.54));
  color: #fff;
  cursor: pointer;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  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;
}

.bonbon-game .ranking-head .ranking-close {
  grid-column: 3;
  justify-self: end;
}

.bonbon-game .ranking-mode-tabs,
.bonbon-game .ranking-period-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.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: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 15px;
  letter-spacing: .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.20),
    0 6px 12px rgba(106,68,170,0.10);
  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 {
  min-height: 22px;
  padding: 2px 8px 5px;
  border-bottom: 2px solid rgba(141,85,220,0.18);
  text-align: center;
  font-family: 'Baloo 2', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  color: rgba(95,67,141,0.78);
}

.bonbon-game .ranking-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding-right: 2px;
}

.bonbon-game .ranking-empty {
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 18px;
  letter-spacing: .08em;
  color: rgba(95,67,141,0.66);
}

.bonbon-game .ranking-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(92px, auto);
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 11px;
  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 rgba(255,120,190,0.6);
  outline-offset: -3px;
}

.bonbon-game .ranking-rank {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #b387f4, #7f48cc);
  color: #fff;
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  line-height: 1;
  box-shadow: inset 0 2px 5px rgba(255,255,255,0.32), 0 3px 0 rgba(72,38,132,0.38);
}

.bonbon-game .ranking-rank strong {
  font-size: 20px;
  font-weight: 400;
}

.bonbon-game .ranking-rank span {
  margin-top: 2px;
  font-size: 8px;
  letter-spacing: .08em;
}

.bonbon-game .ranking-main {
  min-width: 0;
}

.bonbon-game .ranking-score {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: clamp(19px, 5vw, 24px);
  line-height: 1;
  white-space: nowrap;
  color: #7f48cc;
  text-shadow: 0 2px 0 rgba(255,255,255,0.75);
}

.bonbon-game .ranking-score span {
  margin-left: 5px;
  font-size: 10px;
  color: rgba(95,67,141,0.62);
}

.bonbon-game .ranking-meta,
.bonbon-game .ranking-date {
  font-family: 'Baloo 2', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  color: rgba(95,67,141,0.7);
  line-height: 1.35;
}

.bonbon-game .ranking-date {
  justify-self: end;
  min-width: 92px;
  white-space: nowrap;
  text-align: right;
}

.bonbon-game .ranking-bottom-close {
  align-self: center;
  font-family: 'Baloo 2', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  font-weight: 800;
  letter-spacing: .04em;
  font-size: 16px;
  padding: 11px 44px;
  margin-top: 2px;
  animation: none;
}

.bonbon-game .mini-mode {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-size: 10px;
  letter-spacing: .03em;
  color: rgba(119,85,187,0.72);
  line-height: 1;
  margin-bottom: 4px;
}

/* ラベル・数値テキスト */
.bonbon-game .lbl {
  font-family: 'Fredoka One', 'Arial Rounded MT Bold', sans-serif;
  font-weight: 400;
  font-size: 19px;
  letter-spacing: .1em;
  color: 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: 0.75em;
}

/* リセット・ポーズボタン */
.bonbon-game .reset-btn {
  width: 100%;
  cursor: pointer;
  transition: all .2s;
  outline: none;
  -webkit-appearance: none;
}
.bonbon-game .reset-btn .lbl {
  font-size: 20px;
  letter-spacing: .1em;
  margin: 0;
  white-space: nowrap;
}
.bonbon-game .reset-btn:hover,
.bonbon-game .reset-btn:active {
  background: rgba(255,255,255,0.30);
  transform: scale(1.04) translateY(-2px);
}

.bonbon-game .bgm-toggle-btn {
  width: 100%;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  outline: none;
  -webkit-appearance: none;
}
.bonbon-game .bgm-toggle-btn:hover,
.bonbon-game .bgm-toggle-btn:active {
  transform: scale(1.04) translateY(-2px);
}
.bonbon-game #bgm-toggle-icon {
  color: var(--bb-accent);
  font-size: 24px;
}

/* 中間高さ対応（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:
      minmax(0, .32fr)
      auto
      minmax(26px, .54fr)
      auto
      minmax(26px, .54fr)
      auto
      minmax(26px, .54fr)
      auto
      minmax(0, .36fr);
    row-gap: 0;
    padding-top: 22px;
    padding-bottom: 34px;
  }
  .bonbon-game #title-canvas { max-height: 267px !important; }
  .bonbon-game .bgm-btn,
  .bonbon-game .mode-btn { padding-top: 10px; padding-bottom: 10px; }
  .bonbon-game #start-btn { font-size: 22px; padding: 14px 0; }
  .bonbon-game .ranking-open-btn,
  .bonbon-game .rules-open-btn,
  .bonbon-game .controls-open-btn { padding: 11px 0; }
  .bonbon-game .go-title  { font-size: clamp(32px, 5vw, 60px); }
  .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) {
  .bonbon-game {
    --bb-title-side-button-h: 34px;
    margin-top: -24px;
    height: calc(100svh - 180px);
    max-height: calc(100svh - 180px);
    border-radius: 8px;
  }
  .bonbon-game .overlay {
    overflow-x: hidden;
    overflow-y: auto;
  }
  .bonbon-game #title-canvas {
    max-height: 132px !important;
  }
  .bonbon-game .game-wrapper { gap: 5px; padding: 4px 5px; }
  .bonbon-game .side { width: 76px; min-width: 76px; gap: 4px; }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .side {
    gap: 2px;
    min-height: 0;
  }
  .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) .best-box,
  .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: 11px; letter-spacing: .025em; margin-bottom: 1px; white-space: nowrap; }
  .bonbon-game .go-title  { font-size: clamp(18px, 8vw, 32px); }
  .bonbon-game .go-label  { font-size: 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: .1em; padding: 8px 14px; }
  .bonbon-game .overlay   { gap: 8px; padding: 10px 10px; }
  .bonbon-game #start-scr {
    grid-template-columns: 1fr;
    grid-template-rows:
      minmax(0, .26fr)
      auto
      minmax(14px, .52fr)
      auto
      minmax(14px, .52fr)
      auto
      minmax(14px, .52fr)
      auto
      minmax(0, .30fr);
    align-content: stretch;
    justify-items: center;
    row-gap: 0;
    padding: 10px 10px 18px;
  }
  .bonbon-game #start-scr #title-canvas {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    margin: 0 auto -1px !important;
    max-width: 94% !important;
    max-height: 134px !important;
    transform: rotate(-1.5deg);
  }
  .bonbon-game .btn       { font-size: 12px; padding: 10px 18px; }
  .bonbon-game .start-controls {
    display: contents;
  }
  .bonbon-game .audio-panel {
    grid-column: 1;
    grid-row: 4;
    width: 90%;
  }
  .bonbon-game .mode-panel {
    grid-column: 1;
    grid-row: 6;
    width: 82%;
  }
  .bonbon-game .select-panel { gap: 10px; }
  .bonbon-game .select-title {
    font-size: 18px;
    -webkit-text-stroke-width: 1.4px;
    text-shadow:
      0 2px 0 #5d2ea2,
      0 4px 0 rgba(74,34,136,0.30),
      0 0 9px rgba(255,255,255,0.82);
  }
  .bonbon-game .title-side-btn .lbl {
    font-size: 13px;
    letter-spacing: .02em;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .best-box {
    flex-basis: 0;
    min-height: 0;
  }
  .bonbon-game .title-best-row {
    gap: 4px;
    padding: 0 1px;
  }
  .bonbon-game .title-best-row span {
    font-size: 8px;
  }
  .bonbon-game .title-best-row strong {
    font-size: 17px;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-best-row {
    display: none;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .title-best-current {
    display: block;
    font-size: 21px;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .lbl {
    font-size: 13px;
    letter-spacing: .02em;
  }
  .bonbon-game:is(.is-title-screen, .is-gameover-screen) .bgm-toggle-btn .val {
    font-size: 19px;
    line-height: 1;
  }
  .bonbon-game .select-buttons {
    gap: 6px;
    min-width: 0;
  }
  .bonbon-game .mode-panel {
    width: 90%;
  }
  .bonbon-game .mode-panel .select-buttons {
    width: min(220px, 100%);
    flex-direction: column;
    align-items: stretch;
    margin: 0 auto;
  }
  .bonbon-game .bgm-btn,
  .bonbon-game .mode-btn   { font-size: 9px; letter-spacing: .02em; padding: 8px 5px; white-space: nowrap; }
  .bonbon-game .mode-btn {
    width: 100%;
    flex: 0 0 auto;
    padding-left: 10px;
    padding-right: 10px;
  }
  .bonbon-game .mini-mode  { font-size: 8px; letter-spacing: 0; margin-bottom: 2px; white-space: nowrap; }
  .bonbon-game.is-order-mode:not(.is-title-screen):not(.is-gameover-screen) .order-box {
    flex: 1.38 1 0;
    gap: 0;
    padding: 4px 4px 5px;
  }
  .bonbon-game .order-head {
    min-height: 18px;
    padding-bottom: 3px;
    border-bottom-width: 1px;
  }
  .bonbon-game .order-head .lbl { font-size: 10px; }
  .bonbon-game .order-number { gap: 1px; }
  .bonbon-game .order-number span { display: none; }
  .bonbon-game .order-number strong { font-size: 13px; }
  .bonbon-game .order-section-label {
    display: none;
  }
  .bonbon-game .order-targets { gap: 2px; margin-top: 4px; }
  .bonbon-game .order-target {
    grid-template-columns: 13px minmax(0, 1fr) auto;
    gap: 2px;
    min-height: 19px;
    padding: 2px 1px;
    border-left-width: 2px;
    font-size: 10px;
  }
  .bonbon-game .order-swatch {
    width: 12px;
    height: 12px;
    border-width: 1px;
    border-radius: 2px;
  }
  .bonbon-game .order-target-count { min-width: 19px; }
  .bonbon-game .order-target-count small { font-size: 8px; }
  .bonbon-game .order-target-count strong { font-size: 13px; }
  .bonbon-game .order-remaining {
    grid-template-columns: auto 1fr;
    gap: 2px;
    padding-top: 3px;
    border-top-width: 1px;
  }
  .bonbon-game .order-limit-label { font-size: 7px; letter-spacing: 0; }
  .bonbon-game .order-piece-unit { display: none; }
  .bonbon-game .order-remaining strong { font-size: 16px; }
  .bonbon-game .mode-hint {
    top: 7%;
    max-width: calc(100% - 14px);
    padding: 7px 9px 8px;
    border-radius: 8px;
    font-size: 11px;
  }
  .bonbon-game .start-actions {
    display: contents;
  }
  .bonbon-game #start-btn {
    grid-column: 1;
    grid-row: 8;
    width: 78%;
    font-size: 15px;
    padding: 11px 0;
    margin: 4px 0 3px;
  }
  .bonbon-game .ranking-open-btn,
  .bonbon-game .rules-open-btn,
  .bonbon-game .controls-open-btn { width: 100%; font-size: 10px; padding: 9px 0; }
  .bonbon-game .go-actions { gap: 8px; }
  .bonbon-game .ranking-overlay,
  .bonbon-game .rules-overlay,
  .bonbon-game .controls-overlay,
  .bonbon-game .history-overlay { padding: 9px; }
  .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: .02em;
    line-height: 1.18;
  }
  .bonbon-game .title-confirm-actions {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 14px;
  }
  .bonbon-game .title-confirm-actions .btn {
    width: 100%;
    padding: 11px 10px;
    font-size: 13px;
    letter-spacing: .03em;
  }
  .bonbon-game .ranking-panel,
  .bonbon-game .rules-panel,
  .bonbon-game .history-panel {
    gap: 8px;
    border-radius: 10px;
  }
  .bonbon-game .ranking-panel,
  .bonbon-game .history-panel {
    width: 98%;
    max-height: 96%;
    padding: 11px;
  }
  .bonbon-game .rules-panel {
    width: min(360px, calc(100% - 12px));
    max-height: calc(100% - 18px);
    padding: 13px 11px 12px;
  }
  .bonbon-game .ranking-panel { gap: 9px; }
  .bonbon-game .controls-panel {
    min-height: min(430px, calc(100dvh - 28px));
  }
  .bonbon-game .ranking-title,
  .bonbon-game .rules-title { font-size: 20px; }
  .bonbon-game .ranking-head,
  .bonbon-game .rules-head { grid-template-columns: 34px minmax(0, 1fr) 34px; }
  .bonbon-game .ranking-close { width: 34px; height: 34px; font-size: 19px; }
  .bonbon-game .ranking-tab { min-height: 32px; font-size: 11px; }
  .bonbon-game .ranking-period { font-size: 11px; }
  .bonbon-game .ranking-empty { min-height: 120px; font-size: 14px; }
  .bonbon-game .ranking-item {
    grid-template-columns: 43px minmax(0, 1fr);
    gap: 4px 8px;
    min-height: 60px;
    padding: 7px 9px;
    border-radius: 10px;
  }
  .bonbon-game .ranking-rank { width: 40px; height: 40px; }
  .bonbon-game .ranking-rank strong { font-size: 18px; }
  .bonbon-game .ranking-rank span { font-size: 7px; }
  .bonbon-game .ranking-score { font-size: clamp(17px, 5.2vw, 20px); }
  .bonbon-game .ranking-score span { font-size: 9px; }
  .bonbon-game .ranking-meta { font-size: 10px; }
  .bonbon-game .ranking-date {
    grid-column: 2;
    justify-self: start;
    min-width: 0;
    margin-top: -1px;
    font-size: 10px;
    text-align: left;
  }
  .bonbon-game .ranking-bottom-close {
    min-height: 36px;
    padding: 9px 34px;
    font-size: 12.5px;
  }
  .bonbon-game .history-section { padding: 10px 11px; }
  .bonbon-game .history-section-title { font-size: 17px; }
  .bonbon-game .history-best-score { font-size: 32px; }
  .bonbon-game .history-best-code { font-size: 11px; }
  .bonbon-game .history-row strong { font-size: 22px; }
  .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: 11px; line-height: 1.35; }
  .bonbon-game .rules-list { gap: 4px; font-size: 11.5px; line-height: 1.42; }
  .bonbon-game .rules-grid--controls { gap: 8px; }
  .bonbon-game .rules-grid--controls .rules-card { padding: 9px 10px; }
  .bonbon-game .rules-grid--controls .rules-card-title {
    font-size: 18px;
    margin-bottom: 8px;
  }
  .bonbon-game .rules-keys { font-size: 10px; gap: 3px 6px; }
  .bonbon-game .rules-grid--controls .rules-keys {
    grid-template-columns: 1fr;
    gap: 5px;
    font-size: 13px;
  }
  .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: 9px; }
  .bonbon-game .top-btns  { gap: 4px; }
  .bonbon-game .canvas-col { gap: 4px; }
}

@media (max-width: 480px) {
  .bonbon-game .history-row {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 7px;
  }
  .bonbon-game .history-row-meta,
  .bonbon-game .history-best-meta {
    font-size: 9px;
  }
}

@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: 18px;
  }

  .bonbon-game .rules-intro {
    font-size: 9.5px;
    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: 13px;
  }

  .bonbon-game .rules-list {
    gap: 2px;
    font-size: 9px;
    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: 11px;
  }
}
